IllustratorsLeak
oalabs
oalabs

patreon


Debugging Fundamentals Module 1 - Debugger Events

Further Research

Lab Environment Setup

We recommend using the FLARE-VM virtual machine (VM) for the labs running Window 10 x64. For more information on how to setup a free FLARE-VM virtual machine please see our Dynamic Malware Analysis Lab Setup tutorial.

For the labs you will need to enable networking on the VM so you can install the required Python libraries. Before enabling networking ensure that you have restored a clean snapshot of your VM and ensure that it does not contain any malware.

Python is required for the labs. It is important to install the correct version of Python - we will be using the Python 3.8.10 (32-bit).

If you are using the FLARE-VM you will already have a Python 64-bit version installed which may cause issues for the labs. We recommend installing Python 3.8.10 (32-bit) using the Windows-installer (32-bit)

Once Python has been installed it can be launched using the install path: 


C:\Python32-32\python.exe


Lab Debugger Setup

Copy the lab zip file to your VM and unzip the lab directory.

In the directory there will be requirements.txt file that can be used to install the Python libraries required for the debugger. 

To install these you can launch the Python PIP module from your newly installed Python 3.8.10 environment.

C:\Python38-32\python.exe -m pip install -r requirements.txt

Once the requirements have been installed the debugger can be launched via the same Python 3.8.10 environment. The debugger must be launched from inside the lab directory as it requires a relative path to the dbglib folder (also included in the lab directory).

C:\Python38-32\python.exe module_1_debug_events.py

Launching the debugger without an argument will raise an error. The debugger requires a path to the target binary to be passed as the first argument. 

A target.exe binary has been supplied in the lab directory. This target binary is a simple “hello world” executable that can be used to test the debugger.

C:\Python38-32\python.exe module_1_debug_events.py target.exe

Lab 1 

When launched the debugger will print out the CREATE_PROCESS_DEBUG_EVENT and some associated information. The target will also print “Hello World” to the console.

The debugger will continue to wait for debug events until the return key is entered in the console. Note that the debugger will wait for events even after the target has completed execution so it is the responsibility of the user to press enter to quit the debugger.

Lab 1 - Exercise

Now that your a familiar with how the debugger receives debug events, add a handler for the EXIT_PROCESS_DEBUG_EVENT which returns an EXIT_PROCESS_DEBUG_INFO struct (ExitProcess) with the process exit code (dwExitCode). 

Print the exit code to the console from your new handler.


Debugging Fundamentals Module 1 - Debugger Events

Comments

https://support.patreon.com/hc/en-us/articles/212052266-Getting-Discord-access

OALABS

How can I join #oa-reversers channel on Discord?

Piotr Rozwadowski-Gruczek

Hey! Thank you for this very informative tutorial. Could you share slides, please?

Leon Sarkisov


More Creators