Pwn CTF pivotquest Writeup
Exploitation
先看一下這題的主邏輯:
1 | int __fastcall main(int argc, const char **argv, const char **envp) |
有 canary 沒有 PIE,然後有兩個輸入點都可以 overflow,而且是 statically linked。
首先第一步是我們可以透過填滿 canary 前的空間讓他 printf 的時候一直印到 canary 的 null byte 為止,這樣我們就可以先取得 canary,然後再透過 migration 把 stack 搬到 bss 段,接著第二次輸入時就可以正常 rop 而且 /bin/sh 是在 bss 段了。
Exploit
1 | from pwn import * |
Pwned !!!
- Title: Pwn CTF pivotquest Writeup
- Author: kazma
- Created at : 2024-11-11 19:44:15
- Updated at : 2024-11-11 19:55:57
- Link: https://kazma.tw/2024/11/11/Pwn-CTF-pivotquest-Writeup/
- License: This work is licensed under CC BY-NC-SA 4.0.
Comments