ãã使ããããªãã®ã®è¦æ¸ã
ã·ã³ãã«ãµã¼ãã®æå®
ç°å¢å¤æ°ãç¨ãã¦æå®ãã¦ããã¨ããã
>set _NT_SYMBOL_PATH=srv*C:\Symbols*http://msdl.microsoft.com/download/symbols
ãããã°æ å ±ä»ãã§ã³ã³ãã¤ã«
ã³ã³ãã¤ã«ãªãã·ã§ã³ã¨ãã¦/Zi
ãä»ããã
>cd /Zi hello.c
å®è¡ãã¡ã¤ã«ãæå®ãã¦èµ·å
>cdb hello.exe
主è¦ãªã³ãã³ãã®ä¸è¦§ã表示
0:000> ?
å種æ å ±ã®è¡¨ç¤º
ã¬ã¸ã¹ã¿
0:000> r
ã¡ã¢ãªå 容
dc
ã¯dword+asciiå½¢å¼ã§è¡¨ç¤ºãdps
ã¯ãã¤ã³ã¿é
åã¨ã¿ãªã対å¿ããã·ã³ãã«ã¨åããã¦è¡¨ç¤ºã
0:000> dc esp 0:000> dps esp
ãã£ã¹ã¢ã»ã³ãã«çµæ
å¼æ°ã¨ãã¦ã·ã³ãã«åã使ãå ´åã¯ã[module]![symbol]
ã®å½¢ã§æå®ããã
poi()
ãªãã¬ã¼ã¿ã使ããã¨ã§ããã¤ã³ã¿ãæãå
ã®ã¢ãã¬ã¹ãæ±ããã¨ãã§ããï¼gdbã«ããã*addr
ã«å¯¾å¿ï¼ã
0:000> u eip 0:000> u kernel32!VirtualProtectStub 0:000> u poi(kernel32!_imp__VirtualProtect)
ã¹ã¿ãã¯ãã¬ã¼ã¹
kv
ã使ãã¨ç¬¬3å¼æ°ã¾ã§ã®å¤ãåããã¦è¡¨ç¤ºã§ããã
0:000> k 0:000> kv
ãã¹ã¦ã®ã¹ã¬ããã®ã¹ã¿ãã¯ãã¬ã¼ã¹ã表示ããã«ã¯æ¬¡ã®ããã«ããã
0:000> ~* k
æ§é ä½æ å ±
-r
ãªãã·ã§ã³ã§æ·±ããæå®ã§ããã
0:000> dt _PEB 7ffde000 -r2
ãã¼ãããã¦ããã¢ã¸ã¥ã¼ã«
0:000> lm
PEãããæ å ±
0:000> !dh -f 00400000
ã¡ã¢ãªã®ä¿è·å±æ§
0:000> !vprot esp
ãã¼ãã¨ã³ããª
0:000> !heap -x 007B7218 Entry User Heap Segment Size PrevSize Unused Flags ----------------------------------------------------------------------------- 007b7210 007b7218 00780000 00780000 1008 88 8 busy
ä¸ã®çµæããã0x007b7218ãã0x1008ãã¤ãã®é åã確ä¿ããã¦ãããæ«å°¾ã®8ãã¤ãã¯æªä½¿ç¨ãfreeããã¦ããªãç¶æ ï¼busyï¼ã§ãããã¨ããããã
ã»ã°ã¡ã³ãã®ãã¼ã¹ã¢ãã¬ã¹
0:000> dg fs P Si Gr Pr Lo Sel Base Limit Type l ze an es ng Flags ---- -------- -------- ---------- - -- -- -- -- -------- 0053 7ffdd000 00000fff Data RW Ac 3 Bg By P Nl 000004f3
fs:[0h]
ã«ã¯Thread Environment Blockï¼TEBï¼ãé
ç½®ããã¦ãããããããProcess Environment Blockï¼PEBï¼ãå«ãå種æ
å ±ããã©ããã¨ãã§ããã
0:000> dt _TEB 7ffdd000 -r2
å®è¡é¢é£
é ã«gdbã«ãããcontinue
ãnexti
ï¼é¢æ°ã®ä¸ã«å
¥ããªãï¼ãstepi
ï¼é¢æ°ã®ä¸ã«å
¥ãï¼ãfinish
ï¼ãªã¿ã¼ã³ããã¾ã§é²ããï¼ã«å¯¾å¿ããã
0:000> g 0:000> p 0:000> t 0:000> gu
ãã¬ã¼ã¯ãã¤ã³ãé¢é£
é ã«è¨å®ã表示ãåé¤ã
0:000> bp kernel32!VirtualProtectStub 0:000> bl 0:000> bc
ã¬ã¸ã¹ã¿ã®æ¸ãæã
0:000> r eax=41414141 0:000> r eax=ebx+4
ã¡ã¢ãªå 容ã®æ¤ç´¢
ä¸è¨ã®ããã«æå®ããã¨ã¢ãã¬ã¹0ãã0x80000000ãã¤ããæ¤ç´¢ããã
-b
ãªãã·ã§ã³ã§ãã¤ãåã-a
ãªãã·ã§ã³ã§ASCIIæååãæå®ããã
0:000> s -b 0 L?80000000 c9 c3 0:000> s -a 0 L?80000000 MZ
çµäº
0:000> q
é¢é£ãªã³ã¯
- Debugger Reference (Windows Debuggers)
- Common WinDbg Commands (Thematically Grouped)
- WinDbg. From A to Z!
- Windbg cheatsheet
- windbg/kd fun - A Hole In My Head - MSDN Blogs
- WinDbg: search for a string - Distributed Services: Notes from the field - Site Home - MSDN Blogs
- windbg 㨠gdb ã«é¢ä¿ããåºæ¬æä½ã¡ã¢ã | ã¿ããã®æè¨æ帳