Git Product home page Git Product logo

trashdbg's Introduction

trashdbg2

The world's worse debugger

Over the course of multiple OALABS Twitch streams we will build the world's worst debugger! The purpose of the streams is to learn more about the inner workings of debugging under Windows and gain a better general understanding of what our tools are doing when we are debugging malware.

References

Much of the code in this project is heavily copy-pasted from multiple sources on the Internet. We will try to maintain a list of original sources here, but we may occasionally miss sources while on stream. If we missed something let us know so we can add it!

Notes

System Breakpoint

The "system breakpoint" is set automaticall for a debugged process by ntdll:LdrpDoDebuggerBreak. We can receive this in our debugger as a software breakpoint event but we need to be careful... the context debug registers are restored in ntdll after this bp so we cannot set a hardware breakpoint from here it will be cleared!

oS2S6R9

Hardware Breakpoints

The hardware breakpoint dr registers are set in thread specific context so it is possible to set different hw bp per thread. In practice this is not usually what we want as an analyst -- we want to set a hw bp that fires for all threads. To accomplish this we needed to add some helper methods that track all of the process threads. When a new hw bp is added it is added to all threads, and when a new thread is created the hw bps are added to it.

No PRs

Because this project is meant to be a community effort on stream we won’t be accepting PRs. Aside from some maintenance/cleanup all coding will be done on-stream. If you have feature requests or suggestions leave your feedback as an Issue or come chat with us on Discord.

Join Us!

πŸ’– Check out our schedule we stream Thursdays and Sundays at 1300 EST

Chat Support

trashdbg's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

clayne

trashdbg's Issues

Cannot get access to DLL info when handling LOAD_DLL_DEBUG_EVENT event

When we attempt to handle a LOAD_DLL_DEBUG_EVENT event we find we don't have access to information about the DLL that was just loaded.

def handle_load_dll(pEvent):

We tried querying information about the DLL via GetModuleFileNameExW using pEvent.u.LoadDll.lpBaseOfDll but we were getting an invalid handle issue for the module handle.

We also tried using EnumProcessModulesEx and CreateToolhelp32Snapshot to enumerate the modules and find the newly loaded module but it seems when the LOAD_DLL_DEBUG_EVENT event is raised the full information about the DLL has not been populated yet so both these methods cannot access the new DLL.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.