06- Basic Dynamic Malware Analysis
06- Basic Dynamic Malware Analysis
• It can involve
✓ Monitoring malware as it runs or
✓ Examining the system after the malware has been executed.
• The sandbox may not record all events, because neither you
nor the sandbox may wait long enough.
– For example, if the malware is set to sleep for a day before it performs
malicious activity, you may miss that event.
– Most sandboxes hook the Sleep function and set it to sleep only briefly, but there is more
than one way to sleep, and the sandboxes cannot account for all of these.
Reverse Engineering Qasem Abu Al-Haija 12
Sandbox Drawbacks (2)
• Malware often detects when it is running in a VM.
– If a VM is detected, the malware might stop running or
behave differently.
– Not all sandboxes take this issue into account.
Lsass.exe
Local Security Authority
Subsystem Service
15
Running Malware
• All recorded events are kept, but you can filter the display to
make it easier to find items of interest
• Don't run it too long, or it will fill up all RAM and crash the machine
– Procmon monitors all system calls it can gather as soon as it is run.
• You can also use it to kill a process, log out users, and
launch and validate processes.
Reverse Engineering Qasem Abu Al-Haija 35
Process Explorer Interface
Options ->
Configure colors …
– Processes in blue,
• Run your malware and watch as DNS requests appear in the ApateDNS window.
• You can catch additional domains used by a malware sample through the use of
the nonexistent domain (NXDOMAIN) option.
– Malware will often loop through the different domains it has stored if the first or second
domains are not found.
– Using this NXDOMAIN option can trick malware into giving you additional domains it has in
its configuration.
49
Monitoring with Netcat
• Netcat, the “TCP/IP Swiss Army knife,” can be used over
both inbound and outbound connections for port
scanning, tunneling, proxying, port forwarding, and much
more.
• The easiest way to run INetSim if your base operating system is Microsoft
Windows is to install it on a Linux virtual machine and set it up on the
same virtual network as your malware analysis virtual machine.
• INetSim is the best free tool for providing fake services, allowing you to
analyze the network behavior of unknown malware samples by emulating
services such as HTTP, HTTPS, FTP, IRC, DNS, SMTP, and others.
• Refer INetSim
• Log files are stored in the /var/log/inetsim/ directory:
– debug.log: debug information in case inetsim is run in debug mode
– main.log: information logs (services started, stopped, ...)
– service.log: when connections are made against the services, logs are added to this file