CS 2019 Fall - Homework 0x05
[0x05] Casino
先 checksec
然後去找到可以 overflow 的點
這題的主要流程 & 一些小細節︰(GOT hijack)
- 把 shellcode 寫到 name 上
- 把
name
寫到 overflow 可以蓋過seed
和age
- 數值產生順序 :
seed
→name
→age
- 我們可以藉由
name
overflow 來控制seed
,進而預測lottery[i]
的結果
→ 寫一個 c code 來生成
- 如果直接把 shellcode 寫在
name
上,後面輸入age
時會蓋到 shellcode 的內容
→ 把 shellcode 的位置調整到age
後面
- 利用 guess[idx] 的 idx 來改寫 GOT
rip
為 8 Bytes,但藉由read_int()
一次只能改寫 4 Bytes,所以要改寫兩次
- 觸發某個 function 讓他去 GOT 上查表,並跳轉到 shellcode 上
- 目標為
puts()
而不是printf()
- 理由為
printf()
在進行第二輪猜測時仍會使用到,如果這時已經改寫了 GOT 上printf()
的位置,那就會跳到奇怪的地方導致程式死去
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →