Jump to content


Photo
- - - - -

An OllyDbg Bug Disables Software Breakpoints


  • Please log in to reply
2 replies to this topic

#1 waliedassar

waliedassar

    Member

  • (Full Member)
  • 86 posts
  • Gender:Male
  • Interests:Reverse code engineering, malware analysis, and security research.

Posted 14 January 2012 - 04:31 PM

I have found a new bug in OllyDbg v1.10. The bug is triggered when the BaseAddress value is changed in the LDR_MODULE structure for the main executable. Any subsequent DLL loading forces Olly to call the psapi "EnumProcessModules" function in order to update the module list, and since the psapi "EnumProcessModules" function traverses and reads from the LDR_MODULE linked list, the new (fake) base address will definitely be returned.

A simple application was written to test this bug. See the image below.
Posted Image

Here is how the source code above looks in olly.

Posted Image

If some breakpoints are set after the troublesome code and OllyDbg is left to run, an error message shows up once we step over the "LoadLibrary" function call and none of the breakpoints are hit.

Posted Image

Posted Image

Posted Image

The problem is that OllyDbg trusts the data retrieved from the psapi "EnumProcessModules" function call and tries to update data related to the main executable, including software breakpoints. At this point, all software breakpoints are deleted since OllyDbg thinks their addresses are no longer valid. Actually they are, but this is how it goes in OllyDbg v1.10.

N.B Software breakpoints outside the main executable e.g. in ntdll.dll are not affected by this bug.

A demo here https://docs.google....h7b7nWNzSE/edit
Original topic http://waleedassar.b...s-software.html

#2 Mr. eXoDia

Mr. eXoDia

    Freedom!

  • (Full Member)
  • 643 posts
  • Gender:Male

Posted 15 January 2012 - 07:07 AM

Really interesting :) I like this kind of posts!

Mr. eXoDia
noProtection (database with program protection information, pm for an account!)

TPoDT is dead!

Armadillo Version Detector, Inline Helper, Key Generator, Key Analyzer, Environment Variable Finder

#3 Peter Ferrie

Peter Ferrie

    just some random guy

  • (Full Member)
  • 140 posts
  • Gender:Male

Posted 17 January 2012 - 04:44 PM

This is a nice find. Olly simply resumes execution after the LoadLibrary returns (step over won't stop), so execution escapes Olly's control. Certain APIs (like MessageBox) will crash unless you change the value back afterwards, though.
It might even be possible to choose a page that does not cause the message to appear, making a very stealthy way to run. :-)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users