Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
第一次自幹debugger就上手
Search
LegBone
March 16, 2014
Research
960
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
第一次自幹debugger就上手
LegBone
March 16, 2014
Transcript
39 slides
第一次自幹DEBUGGER就上手 軟體除錯器撰寫 SITCON 2014
About Me • LegBone(蔡耀德) • TDOH 南區召集人 • 本業是廚師,coder 的身份
只是掩飾,平常最大的興趣 就是到處亂拆,debug 只是 為了世界和平,來自傳說中 的黑暗料理界。 • 慣用Visual C/C++,asm • 平常到處拆點東西 • 不務正業
以下內容如果有錯誤,歡迎指正
What is debugger?
相信大家寫code常用到 (Micro$oft visual studio)
當你SOURCE CODE 不見又想修改的時候... (OllyDbg)
還有你想註冊的時候…疑!? (LegDbg)
None
「有了Debugger Cracking也是彩色的」 -貝拉克.歐巴馬
今天的重點
可以對64-bit的程式除錯的Debugger
跳坑的起因
撰寫工具:Visual Studio 2013
先來談談Debugger的運作原理
透過中斷系統以及自己程式裡面接 收被Debug行程的異常來進行處理
Well……聽起來很複雜很麻煩
但是M$很好心的幫我們封裝好了 Debug函數
首先要Debug一個process就要先以 Debug模式啟動 建立一個Debug的執行緒 DEBUG_ONLY_THIS_PROCESS
使用範例 CreateProcess(“要啟動程式的路徑”, NULL, NULL, NULL, False, /* bInheritHandles */ /*
DWORD dwCreationFlags */ DEBUG_ONLY_THIS_PROCESS, NULL, NULL, &si, &pi)
異常訊息接收 在我們自己的程式裡面,也有一個迴圈在等著接收異 常訊息 while (!isExit&&WaitForDebugEvent(&de, INFINITE)) 由de.dwDebugEventCode裡面的異常訊息來判斷 除錯的目標發生的異常事件
顯示數值 很單純就用ReadProcessMemory這個WINAPI去讀取
補充資訊 • 64-bit的CPU底下有16個通用 暫存器 • 其中,R8到R15,是新增的; 而前面的八個暫存器,RAX、 RBX、RCX、RDX、RBP、 RSP、RSI、RDI,是把原有的 32
位元加以擴充而成。 32位元 64位元 EAX RAX EBX RBX ECX RCX EDX RDX EBP RBP ESP RSP EDI RDI EIP RIP R8 R9 R10 R11 R12 R13 R14 R15
顯示暫存器內容 從CONTEXT這個結構體中取得暫存器內容 CONTEXT ctThreadContext; ctThreadContext.(暫存器名稱)就可以存取了
顯示堆疊內容 ESP <= 在32-bit中是堆疊指標暫存器 只不過在64-bit底下ESP變成RSP 所以讀取程序的RSP就可以了
攔截載入DLL訊息 攔截到LOAD_DLL_DEBUG_EVENT訊息後,在對他 做出相關的回應
顯示組合語言內容 由於自己刻一個反組譯核心工程太大了,所以用了一 個Open source的反組譯核心BeaEngine
然後由於這個64bit的除錯器的反組 譯核心是開源的…… 整個除錯器也是參考一款32bit的除 錯器寫出來的…… 所以…………………
它也是Open source
只不過下載回去的使用者請安裝 http://www.microsoft.com/zh- tw/download/details.aspx?id=40770 讓VS2013支援多位元組字元集
請各位有興趣的大大一起修改它,完 善它,希望有朝一日它可以成為64bit 底下的ollydbg! <(_ _)>
DEMO
工商服務時間 由於莫風大大去年還是沒徵到另一伴… 誠徵女友!! 有興趣請洽大大本人 <(_ _)>
The Declaration of hacker (TDOH)
如果你對資安有興趣
也對我們想作的事情有興趣
可以到這邊了解我們 ↓ http://tdohacker.org/
也可以在FB上搜尋 "The Declaration of hacker"
等一下還有我們的總召集人的 Lightning Talk 敬請期待
Q&A
More Decks by LegBone
See All by LegBone
SITCON2015-列印點數歡樂談
cowby123
0
360
東華大學資工周-我的程式安全嗎
cowby123
0
170
Other Decks in Research
See All in Research
横浜市長(山中氏)の言動にかかる第三者による調査報告書
sishi2026
0
680
Karkada さんの論文 × 2 の紹介: (1) Closed-Form Training Dynamics Reveal Learned Features and Linear Structure in Word2Vec-like Models, (2) Symmetry in language statistics shapes the geometry of model representations
eumesy
PRO
1
1k
ThermoGS (ECCV2026)解説 — 4D Gaussian Splatting × Thermodynamics CVと物理の統合モデルとして
godel
PRO
0
120
Work in progress: How have changes in the labour market over the past decade affected attitudes to work?
resolutionfoundation
0
380
Kaggle|AI Agent Security — しくじり先生、俺みたいになるな
pomcho555
1
140
Local Development Companies Network - National Conference 2026
ldcn
0
180
ros2-perf-multihost: 分散システムにおける客観的なアーキテクチャ評価フレームワーク
takasehideki
0
350
ハードウェア研究で国際トップ会議を目指す!IROS 2027での論文採択を目指して
ayatokanada
7
4.2k
視覚若手の会LENSって何??
mickey_0226
0
420
最先端NLP勉強会2026 論文紹介:Reasoning with Sampling: Your Base Model is Smarter Than You Think (ICLR 2026 paper)
kogoro
4
980
ふとした出会いで生まれたSkillが、 社内利用1位になるまで
mikimhk
22
25k
Développer des solutions de réduction des émissions de méthane entérique : 1ers résultats Méthane 2030
institutdelelevage
PRO
0
290
Featured
See All Featured
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
670
How to Talk to Developers About Accessibility
jct
2
620
Amusing Abliteration
ianozsvald
1
390
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
2
530
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
How STYLIGHT went responsive
nonsquared
100
6.4k