x64dbg - 第十五章 | 反匯編練習(四) 下
前置作業
這篇延續上一篇文章,所以請先行觀看x64dbg - 第十四章 | 反匯編練習(四) 上
任務目標
- 根據
MessageBoxA特性阻止Nag視窗。
實際分析
開啟
RegisterMe.Oops.exe於反匯編視窗點選右鍵選擇
搜尋(S)->目前模組->跨模組呼叫(I)發現
MessageBoxA,對其設定中斷點F9執行程式斷點
0040101F | E8 C6010000 | call <JMP.&MessageBoxA> |F8步過彈出視窗標題為
Register Me內容為Remove the nags to register This will make program fully registered :))在此可以確認,這邊就是第一個
Nag向上觀察
1
2
3
4
500401011 | 6A 00 | push 0 |
00401013 | 68 7D304000 | push registerme.oops.40307D | 40307D:"Register Me"
00401018 | 68 34304000 | push registerme.oops.403034 | 403034:"Remove the nags to register\r\nThis will make program fully registered :))"
0040101D | 6A 00 | push 0 |
0040101F | E8 C6010000 | call <JMP.&MessageBoxA> |總共傳入四個參數
調用了
MessageBoxA0040101D | 6A 00 | push 0 |是該函數的第一個參數
(要建立的消息框的所有者窗口的句柄。如果此參數為NULL,則消息框沒有所有者窗口。)按下確認按鈕
F8繼續步過,並持續觀察步過到下方指令時
1
00401034 | E8 19000000 | call registerme.oops.401052 |
彈出視窗標題為
Register Me ! Wait no longer :))內容為You need to register me now! It is supposed to be quite easy. Just patch the program to remove the Nags.在此可以確認,這邊是主程式的一個函數
00401052關閉視窗
斷點
00401047 | E8 9E010000 | call <JMP.&MessageBoxA> |F8步過彈出視窗標題為
Register Me內容為Oops! I am not registered !!在此可以確認,這邊就是第二個
Nag向上觀察
1
2
3
4
500401039 | 6A 00 | push 0 |
0040103B | 68 7D304000 | push registerme.oops.40307D | 40307D:"Register Me"
00401040 | 68 89304000 | push registerme.oops.403089 | 403089:"Oops! I am not registered !!"
00401045 | 6A 00 | push 0 |
00401047 | E8 9E010000 | call <JMP.&MessageBoxA> |總共傳入四個參數
調用了
MessageBoxA00401045 | 6A 00 | push 0 |是該函數的第一個參數
(要建立的消息框的所有者窗口的句柄。如果此參數為NULL,則消息框沒有所有者窗口。)
註:函數:MessageBoxA
分析總結
- 兩個
Nag皆使用MessageBoxA,並沒有傳入所有者窗口的句柄。
修改思路
根據分析總結
- 將兩個
Nag的MessageBoxA,第一個參數(所有者窗口的句柄),傳入不存在的句柄。
實際修改
開啟
RegisterMe.Oops.exe0040101D | 6A 00 | push 0 |按下空白鍵將指令修改為
push 0x00000001,按下確定修改後如下
1
2
3
4// 修改前
0040101D | 6A 00 | push 0 |
// 修改後
0040101D | 6A 00 | push 1 |00401045 | 6A 00 | push 0 |按下空白鍵將指令修改為
push 0x00000001,按下確定修改後如下
1
2
3
4// 修改前
00401045 | 6A 00 | push 0 |
// 修改後
00401045 | 6A 00 | push 1 |點擊
修補程式或是快捷鍵Ctrl + P點擊
修補檔案(P)另存檔名
RegisterMe.Oops.NoNag.exe恭喜補丁產生
RegisterMe.Oops.NoNag.exe

註:以上參考了
x64dbg
x64dbg’s documentation!
CSDN billvsme的专栏 的 OllyDbg 使用笔记 (四)
