📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

 Forums >>  Brainstorms - General  >>  Debugging DLLs

Topic created on: January 2, 2007 17:58 CST by ryanlrussell .

What do people do in general to be able to debug a random DLL? I've got a few packed DLLs that I'd like to unpack. I might be able to track down the program they go with, and catch them on load there, but at least part of it is a driver, and going back and forth between the kernel and userland probably won't be fun. But if I can't, how does one usually load a DLL in order to debug it? Will a C program that simply does a LoadLibrary do it, or is it harder than that? Pointers to reading on the subject welcome. I prefer to debug in IDA Pro or Ollydbg if possible.

  asotirov     January 2, 2007 19:00.32 CST
I usually start Notepad with a debugger attached, put a breakpoint on LoadLibraryA and go. When the breakpoint hits, edit the memory where the DLL path is and replace it with the name of your DLL.

Writing a single line C program that does LoadLibrary(argv[1]) should work too.

Remember to put a breakpoint on the DllMain (with 'bu' in WinDbg) before you load the DLL if you want to catch it before it executes.

  p0l     January 2, 2007 19:22.45 CST
I don't know if you've tried it, but OllyDbg 1.10 allows you to debug a DLL.

http://www.ollydbg.de/Loaddll.htm

  Nevar     January 2, 2007 23:53.51 CST
An alternate method (works well wif sice/i3here on) is to simply patch in a CC byte at the EP of the DLL (or one of its exports) and then "rundll32 dllname" or "rundll32 dllname,export"

When using this method u may need to fixup the arguments if DllMain checks how its being invoked.  I use this method for stubborn dlls that dont often play nice.

-nevar

  simpleuser   January 3, 2007 03:38.59 CST
change the PE characteristics to turn your DLL into an EXE,
and unpack as usual with OllyDbg.

  frankboldewin     January 3, 2007 16:03.30 CST
in most cases loaddll.exe from ollydbg works fine,
otherwise use e.g. the pe-editor of pe-tools. click file-header--->characteristics--->unmark dll bit.

now unpacking with olly should be no problem.

Note: Registration is required to post to the forums.

There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit