Shellcode is a small piece of code used as the payload in exploitation attacks. It is typically written in machine code and is injected into a target process to gain control of its execution flow. Shellcode is designed to execute commands, open a shell (hence the name), or perform other malicious activities within the exploited system.
Key Characteristics:
Types of Shellcode:
Use Cases in Exploitation:
Buffer Overflow Attacks: Injected into a buffer to overwrite the instruction pointer and execute the shellcode.
Remote Code Execution: Delivered through vulnerabilities like SQL injection or insecure deserialization.
Defensive Measures:
Address Space Layout Randomization (ASLR): Makes it harder for shellcode to locate the necessary memory addresses.
Data Execution Prevention (DEP): Prevents executing code from non-executable memory regions.
Input Validation: