Corelan Team
:: Knowledge is not an object, it's a flow ::
Exploit writing tutorial part 5 : How debugger modules & plugins
can speed up basic exploit development
Corelan Team (corelanc0d3r) · Saturday, September 5th, 2009
In the first parts of this exploit writing tutorial, I have mainly used Windbg as a tool to watch registers and stack contents while evaluating crashes andbuilding exploits. Today, I will discuss some other debuggers and debugger plugins that will help you speed up this process. A typical exploit writingtoolkit arsenal should at least contain the following tools :
qqqqqq
windbg (for a list of Windbg commands, click here) ollydbg
immunity debugger (requires python) metasploit
pyDbg (if you are using python and want to build your own custom debugger, as explained in the awesome Gray Hay Python book scripting tools such as perl / python, etc
In the previous chapters, we have already played with windbg, and I have briefly discussed a windbg extension / plugin from Microsoft, which willevaluate crashes and will tell you if they think the crash is exploitable or not. This plugin (MSEC) can be downloaded fromdoc.guandang.net. While MSEC can be handy to give you a first impression, don’t rely on it too much. It’s always better to manuallylook at registers, stack values, and try to see if a vulnerability can lead to code execution or not.
Byakugan : introduction, pattern_offset and searchOpcode
Everybody knows that ollydbg has numerous plugins (I’ll talk about these plugins later). Windbg also has a framework/API for buildingplugins/extension. MSEC was just one example… Metasploit has built & released their own windbg plugin about a year ago, called byakugan.Pre-compiled binaries for WIndows XP SP2, SP3, Vista and Windows 7 can be found in the framework3 folder (get latest trunk via svn), under \external\source\byakugan\bin Place byakugan.dll and injectsu.dll under the windbg application folder (not under winext !), and put detoured.dll underqqqq
jutsu : set of tools to track buffers in memory, determining what is controlled at crash time, and discover valid return addresses pattern_offset
mushishi : framework for anti-debugging detection and defeating anti-debugging techniques tenketsu : vista heap emulator/visualizer.
the first parts of this tutorial series to demonstrate the features of that component) and pattern_offset. You can load the byakugan module in windbgusing the following command :
The jutsu component offers the following functions :
qqqqq
In addition to jutsu, there’s pattern_offset, which allows you to find a metasploit pattern in memory and shows the offset to eip
In order to demonstrate how byakugan can speed up the exploit development process, we’ll use a vulnerability found in BlazeDVD 5.1Professional/Blaze HDTV Player 6.0, where a malformed plf file leads to a stack buffer overflow.We’ll try to build a working exploit with only one crash :-)
Get yourself a copy of BlazeDVD 5 Professional from doc.guandang.net

A local copy of this vulnerable application can be downloaded here :
BlazeDVD 5.1 Professional (10.6 MiB, 706 hits)
Usually, we would start with building a payload that contains lots of A’s. But this time we will use a metasploit pattern right away.Create a metasploit pattern that contains 1000 characters and save the pattern in a file (e.g. blazecrash.plf) :
Launch windbg, and execute blazedvd from within windbg. (This will make sure that, if the application crashes, windbg will catch it). Push theapplication out of the breakpoint (you may have to press F5 a couple of times (about 27 times on my system) to launch the application). WhenblazeDVD is launched, open the plf file (which only contains the metasploit pattern). When the application dies, press F5 again.
Corelan Team - Copyright - All rights reserved. Terms Of Use are applicable to this pdf file and its contents. See doc.guandang.net
12/02/2011 - 1 / 12
If you want to show your respect for my work - donate : doc.guandang.net

/
Knowledge is not an object, it’s a flow
identBuf / listBuf / rmBuf : find buffers (plain ascii, metasploit patterns, or data from file) in memory…
memDiff : compare data in memory with a pattern and mark the changes. This will help you determining whether e.g. shellcode has beenchanged/corrupted in memory, whether certain ‘bad characters’ need to be excluded from shellcode, etc hunt
findReturn : search for the addresses that point to a usable function to return to.
searchOpcode : converts assembler instruction to opcode, AND it lists all executable opcode sequence addresses at the same time. searchVtptr trackVal
3-Writing_SEH_BasedExplo... 5-Debugger modules_&_plu... 8-Win32_Egg_Hunting1/2 相关文档推荐 网络与司法 5页 5财富值 06-TO-004-C1 TD-SCDMA...
3-Writing_SEH_BasedExplo... 5-Debugger modules_&_plu... 8-Win32_Egg_Hunting1/2 相关文档推荐 网络与司法 5页 5财富值 06-TO-004-C1 TD-SCDMA...
热门文档