2025 神盾杯 Qual - writeup
Author: 堇姬 Naup
跟 CakeisTheFake 拿了第三名
高速 speedrun writeup
HiProxy
ACL rules 擋下了訪問 admin
直接 urlencode bypasscurl -i https://aegis2025-web-ha.chals.io/%61dmin
AEGIS{H77P_r3QU357_5MU6611N6_5UCC355}
n2
analyze
main function 提供了三個功能,add、backup_and_delete、show
1 | int __fastcall main(int argc, const char **argv, const char **envp) |
他首先會先去 malloc 一塊 metadata,大小是 0x18
他第一個元素是 show_content 的 function pointer
第二個是 note pointer,指向 data 儲存的 chunk
第三個是 int size
另外他限制了 size 不可以大於 0x800
以及分配完後,會將 meta data chunk pointer push back 到 vector 中
這個 vector 是一個全域 notes 變數
1 | unsigned __int64 add_note(void) |
backup and delete 邏輯非常簡單,就是指定 index,若 size < 0x200 就會在內心做 backup 之後 free
但若大於 0x200 就直接 free
不過大於 0x200 的狀況就沒有去清空 vector 中的 pointer,所以有個 UAF
1 | unsigned __int64 backup_and_delete_note(void) |
show note 就是輸入 index,他會去找 function pointer call 他
把你的 note 內容輸出出來
1 | unsigned __int64 show_note(void) |
attack
思路基本上就是 UAF leak libc
UAF 覆蓋掉 function pointer 成 one gadget
就可以開一個 shell 了
詳見腳本
exploit
1 | from pwn import * |
AEGIS{Wh0_the_h31l_let_you_m4ke_tHe_d3cision}
after all
冷知識:
泡芙阿姨 + open 醬 猜工具
ans: openpuff (from misc chalenge)