This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
session:07 [2020/06/17 23:26] Rareş-Mihail VISALOM (67101) |
session:07 [2020/07/19 12:49] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== 0x06. Shellcodes ====== | + | ====== 0x06. Shellcodes |
===== Resources ===== | ===== Resources ===== | ||
- | {{:public: | + | To work this session, first clone/ |
- | [[http:// | + | Other resources: |
- | + | | |
- | [[http:// | + | |
===== Initial info ===== | ===== Initial info ===== | ||
Line 15: | Line 14: | ||
An attacker will typically employ information leak attacks to extract address and values, would use buffer overflow attacks to overwrite sensible data, inject shellcodes and execute them by modifying the program control flow and others. The way these steps are woven together depends on the vulnerability and the program specifics. The attacker is the one that needs to find the best way to tie these steps together to exploit the vulnerability. | An attacker will typically employ information leak attacks to extract address and values, would use buffer overflow attacks to overwrite sensible data, inject shellcodes and execute them by modifying the program control flow and others. The way these steps are woven together depends on the vulnerability and the program specifics. The attacker is the one that needs to find the best way to tie these steps together to exploit the vulnerability. | ||
- | When doing a shellcode-based attack, the attacker needs to execute code from that shellcode into memory. For that to happen, the attacker needs to run three steps: | ||
- | - The attacker needs to create the shellcode. This is typically done by writing assembly code and then assembling that code into binary code. | ||
- | - The attacker places the shellcode inside the vulnerable process address space. This is done by feeding the binary shellcode as input: standard input, program arguments, reading from sockets, environment variables. | ||
- | - The attacker needs to trigger the execution of the shellcode. This means altering the program control flow by typically altering a function return address or a function pointer to point to the start of the shellcode. | ||
- | |||
- | While the above three steps are not necessarily chronological, | ||
===== Shellcode ===== | ===== Shellcode ===== | ||
Line 851: | Line 844: | ||
Inside the '' | Inside the '' | ||
- | * the initial data is now read from standard input using '' | + | |
- | * the buffer we are going to overwrite is now 70 characters long | + | * the buffer we are going to overwrite is now 70 characters long |
- | * we've added an extra local variable before the buffer to make it a bit more challenging to determine the return address | + | * we've added an extra local variable before the buffer to make it a bit more challenging to determine the return address |
Similarly to the task above, exploit the vulnerability by causing a buffer overflow of the '' | Similarly to the task above, exploit the vulnerability by causing a buffer overflow of the '' |