Malware Analysis Professional: Debugging Multi-Thread Applications
Malware Analysis Professional: Debugging Multi-Thread Applications
Professional
Debugging Multi-Thread
Applications
S e c t i o n 0 2 | M o d u l e 1 5
© Caendra Inc. 2020
All Rights Reserved
Table of Contents
MODULE 15 | DEBUGGING MULTI-THREAD APPLICATIONS
Tools:
• Olly Debugger v1.10
Target:
• RE_Lab_15.zip
Introduction
Multi-Threading in
Practice
Creating a New
Thread
Threads
Synchronization
These APIs will put the calling thread in a 'wait' state until
the operation involved with the object(s) specified by the
handle, or the array of handles, such as the termination of
one or more running threads, is completed.
The main reason for this, is that the handle to the new
thread created by this API is not guaranteed to be valid. If
for example the new thread created with that API
terminates very quickly, then the handle returned to the
caller might be invalid or pointing to another thread,
because the handle associated with the new thread is
automatically closed upon its termination.
Threads
Manipulation
In the first scenario the new thread will stay in suspended mode
until the caller uses the ResumeThread API. It is also possible to
suspend or kill a running thread by using the SuspendThread and
TerminateThread (or _endthreadex if the new thread was created
using the _beginthreadex function) APIs respectively.
MAPv1: Section 02, Module 15 - Caendra Inc. © 2020 | p.27
15.5 Threads Manipulation
For this reason the handle to the targeting thread must also
have the THREAD_SUSPEND_RESUME access right.
MAPv1: Section 02, Module 15 - Caendra Inc. © 2020 | p.32
15.5 Threads Manipulation
Debugging Multi-
Thread Applications
Conclusion
So, when you see a process having more than one active
threads, you know which APIs might have used and all you
need to do is to monitor for those and place some
breakpoints at the entry points of the functions scheduled
to run via a new thread.
MAPv1: Section 02, Module 15 - Caendra Inc. © 2020 | p.39
15.7 Conclusion
RE_Lab_15.zip