Anti-Analysis Part 2

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
3 hours 41 minutes
Difficulty
Advanced
CEU/CPE
5
Video Transcription
00:00
Hello and welcome to anti analysis Part two.
00:03
In this session, we're going to learn about some anti reverse engineering techniques.
00:07
This is gonna be a brief overview. As a lot of these techniques are quite advanced, it will be covered in their own separate. Siri's
00:15
probably one of the most basic anti analysis techniques that mount where authors employ is looking for if they're matter where is being debugged.
00:23
Now we're uses a variety of techniques to see f a D buggers attached, and these include using the windows A P I s such as the function you see here is the bugger present.
00:33
This is one of the simplest AP functions that and malware author could implement to check for the bugger
00:40
other a P s include check remote debunker, present anti query information process and output debug strength.
00:47
Some of these AP eyes were designed for to bugger detection, and some were designed for other purposes. However, the easiest way to overcome anti debugging AP I functions is to modify the malware not to call these functions.
01:00
Speaking of the day, bugger, Remember that buggers use break points to step through a process. However, also remember that When you're stepping through your code, the debunker modifies the code. In the process.
01:12
There's several anti debugging techniques to detect this type of debugging behavior
01:19
into scanning and timing checks.
01:22
What is an in three, though
01:23
this is a software interrupt use by the buggers to create a break point. When the do Bugger sets a break point, it modifies the code by inserting a CC instruction.
01:34
A common anti debugging technique is for the Mauer to scan this process for this instruction,
01:41
timing checks or another popular way from our to detect the buggers.
01:45
This works by seeing how much time has elapsed while it processes running. As you single step through a program, the execution will be much slower. Not only can malware a scan if it's being debugged, but it can also interfere with the bugger functionality
01:59
Techniques such as thread, local storage callbacks and interrupt insertion try to disrupt the program's execution if it's being rung in a do bugger.
02:08
When you load a program into do bugger, we've seen that it pauses at the first instruction, which is typically the entry point. However, this could be modified to execute code before this point. This is a thread local storage call back. It's used to execute code before the entry point.
02:24
Interrupt insertion is a form of anti debugging, similar to inserting our CC instruction.
02:31
Depending on the the bugger settings, thes insertions could cause the bugger to stop.
02:37
To prevent malware from being analyzed by us, the analyst malware authors try to confuse us by adding code or data into a program that will make disassembly fail. Now there's a few ways that these air implemented. But in most cases, the malware author creates a code sequence or an algorithm
02:54
that tricks the dis assembler into showing a different list of instructions
02:58
than the ones that are supposed to be executed. This works by taking advantage of a linear dis assembler.
03:04
For instance, the dis assembler. Can Onley represent each bite of a program as one instruction at a time when the dis assembler is tricked at the wrong, offset instructions can be hidden from view.
03:15
In this code segment, we can see that we've got a call instruction, but the target of the call instruction doesn't make any sense
03:22
because the first instruction is a jump whose target fails because it's in the middle of the next instruction. You could see this by the indication of a plus one. Here,
03:31
you can somewhat pick these out sometimes. Typically the coat around. The instructions will be highlighted in red, indicating that the disassembly has failed in some way
03:42
underneath where you've got the same code segment. But instead we used a flow oriented dis assembler rather than a linear, dis assembler,
03:49
flow oriented disassemble to make choices and assumptions. Now you would think that choices and assumptions might seem unnecessary, but simple code instructions are complicated by the addition of problematic code aspects such as pointers exceptions and conditional branches. The second fragment reveals a different sequence of assembly instructions, and it appears to be correct.
04:09
Here we can see the call to the A P I function. Sleep.
04:13
The target of the first jump instruction is now properly formatted,
04:16
and we can see that it jumps to a push instruction, followed by the call to sleep. The bite on the third line of the example
04:24
zero X e eight. This is not executed by program because the jump instruction skipped over it.
04:30
Now there's many ways to implement anti disassembly techniques, and the primary way is to basically force this assembler to provide you inaccurate results by taking advantage of the choices it makes
04:43
thes air implemented by forcing this assembler down a specific disassembly path that will never be executed when the process is run.
04:50
Popular techniques that use these types of implementations are jumps with the same target address
04:58
jumping to an instruction that always has the same condition, for example, using a Jay Z instruction when we always know the condition will be zero. And other techniques that will explore in the later Siri's include misusing structured exception handlers and abusing how the dis assembler uses the call stack.
05:16
Okay, so let's wrap up the Malware Challenges module with a brief summary.
Up Next