7-Hunting Malware Part 2
7-Hunting Malware Part 2
Lab 7
GOALS
• Find the code injection and/or rootkits in the memory images.
RECOMMENDED TOOLS
• Mandiant Redline
• Volatility Framework
• Hunting Workstation:
o IP: 172.16.151.50
o RDP Credentials: elshunter:ahuntingweg0!
TASKS
TASK 1. CREATE A MANS FILE OF APTA.VMEM.
• Run Redline and create a Mandiant Analysis File called APTA.
You should see Redline creating the analysis of the memory file, as shown below.
As we can see nothing is redlined. Based on what we know about Windows processes we
can attempt to see if anything is odd (wrong parent process, wrong path, etc.). To do this
we can switch to Hierarchical Processes view.
Do we see anything out of the ordinary? If not then let’s look at Memory Sections for signs
of code injection.
3. Click on Memory Sections (submenu item under Processes) under Analysis Data.
4. Click on Injected Memory Sections under Filters.
We should see 24 items listed as injected with code and by glancing at the results it appears
to be nearly every processes within the memory image.
We can look at Strings and/or Ports but instead we’ll look at Hooks to see any indicators
of some sort of rootkit.
We didn’t see anything under SSDT and IDT Hooks but we’re seeing some entries under
Untrusted Hooks. At this point, with the data gathered, we definitely know there was code
injection in many processes. We can now take a closer look at things in Volatility.
If we compare Redline and Volatility we should see 1 process, cmd.exe (124), that we didn’t
see in Redline.
Next we can take a look at the processes with Volatility using PSSCAN.
PS>python vol.py -f ..\apta.vmem –-profile=WinXPSP2x86 psscan
If we compare Redline and Volatility we should see another process, VMip.exe (1944), that
we didn’t see in Redline.
We can use PSXVIEW to see if this process is showing indicators that it’s a hidden process.
By the output from PSXVIEW we see that VMip.exe (1944) shows indicators of a hidden
process, along with cmd.exe (124). Remember that we didn’t see these 2 processes in Redline
but does this mean that these 2 processes are malicious? Remember that Redline indicated
many processes were injected except these 2 processes because they were not visible in
Redline. Let’s see if VMip.exe is trying to connect to any remote IP addresses by using
CONNSCAN (Windows XP).
From the output we can see that process 856 is made outbound connections on ports 1054
& 1056 to an IP on port 80. What is process 856? The answer is svchost.exe.
This process is one of the processes shown as injected. Let’s us MALFIND to further
examine.
Based on the output we can see 1 memory section containing an MZ header which is an
indicator of code injection.
From the output we see 2 APIs are hooked (NtCreateThread and ZwCreateThread).
Unknown being shown as the Hooking module adds to conclusion suspicious activity.
Note: We have only focused on process 856 but you can use these techniques with nearly
all of the processes as they’re all injected. The malware you just examined was Zeus.
We should see 1 item listed as injected with code and it has the same process as the previous
memory image. Next we’ll look at Hooks to see any indicators of some sort of rootkit.
We didn’t see anything under SSDT and IDT Hooks but we’re seeing some entries under
Untrusted Hooks. As before, we can now take a closer look at things in Volatility.
Since the goal is to look for a rootkit, we should only focus on the Volatility plugins for rootkit
detection. Let’s use SSDT.
Next we can extract this malcious driver for further analysis. This process starts with using
MODULES.
We need to obtain the base address. The base address is 0xff0d1000. Now we can use
MODDUMP to extract the driver from the memory image.
PS>mkdir ..\APTB\Moddump
PS>$dumpdir=’--dump-dir=”..\APTB\Moddump”’
PS>python vol.py -f ..\aptb.vmem --profile=WinXPSP2x86 moddump -b 0xff0d1000
$dumpdir
Let’s look for this malicious driver in Redline and see if it would have been easy to identify.
As we can see its not the only driver without a full path but it is the only driver that is
named with a number value. Also you can see the Module Base address which was obtained
in Volatility using MODULES and extracted using MODDUMP.