Foreword: Vmem is basically going to be a memory dump of a virtual machine. Using various free tools you can dump processes as well as all the ram, which can be rather time consuming, of a machine. This can be done in both Windows as well as
NIX
Extracting the tgz file
tar xvf hn_forensics.tgz
Now we can start working with out file there is a lot of output so we want to output to text using “>> file.txt”. But before we do that lets see what all volatility has we use 'volatility --info | less" in another terminal to make our lives easier or you can use “man volatility”
1. Using volatility pscan also I used pstree as well as psxviewwe find our processes are:
2. connscan/connection/
https://pastebin.com/t0sxjxWW
3. using strings filename | grep “^http://” | sort | uniq we get our urls: https://pastebin.com/Bs4eeaLY
From the sites we see our employee visited a banking site, which looked interesting we remember that for later as we will recover this file from the memory as seen below
938bf771e971f1ae16cc5e93687d1669efccb3ab538d3dbba96f5a626608d326 executable.644.exe
But winlogon is started after our employee decided to download the pdf. So we can assume it's probably infected.
4. Dumping passwords isn't too hard we use hashdump feature of volatility and for cracking we use john; remember that the Guest generally is not enabled and is a blank password.
volatility hashdump -f Bob.vmem >> passwd
Administrator:500:e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
HelpAssistant:1000:9f8ac2eaebcd2e3a6f94d53c19803662:d95e38a172b3ddaa1ce0b63bb1f5e1fb:::
SUPPORT_388945a0:1002:aad3b435b51404eeaad3b435b51404ee:ad052c1cbab3ec2502df165cd25d95bd:::
john --show passdmp
Administrator:PASSWORD:500:e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c:::
Guest::501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
SUPPORT_388945a0::1002:aad3b435b51404eeaad3b435b51404ee:ad052c1cbab3ec2502df165cd25d95bd:::
4 password hashes cracked, 2 left
As we can see in our report we will tell management that their admin screwed the pooch on the PASSWORD
5. Here we are going to do most of our foremost work. There is a bit of guess work but we saw a banking site and that acroread32 (PID 1752) opened and from our connections it makes a connection to an unknown site. So we need our pdf's. The first step is to memdump the resulting files will have a dmp extension, which is perfect for foremost. Our command here will be
foremost -i filename.dmp -t pdf -o output
Also it is strongly suggested using the timeliner function so you can have a good idea of how the system fell to this attack. Being that we recovered a ton of PDF's we need to figure out which PDF is the culprit using grep. (We could use pdfinfo although we can't use a wildcard such as so it is going to be lengthy.
grep -i java *.pdf
Binary file 00601560.pdf matches
Extracted PDF Analysis:
If you are wondering why we are using the -i because often we see in payloads jAvAScRiPt or any number of combinations to thwart analysis.
So when looking using pdf-parser we see :
PDF Comment '%}\xffb\xb3\xec\x04\x00:\t\x00\x00\xf6\x00\x00\x00\xb4\x08\xa1\x0c\x12\xe0\x04\x000\n'
There is much more shellcode so it appears as though our user had gotten a pdf after the user downloaded this pdf.. so now we use an AV to check the sha256sum against VT, of course if VT doesn't have our hash we upload.
We go ahead and use sha256sum and search VT finding
https://www.virustotal.com/#/file/0bd1a5.../detection
Now we use jsunpack to figure out what all of this shellcode is trying to do and what exploits are included:
malicious: Utilprintf CVE-2008-2992 detectedmalicious: collectEmailInfo CVE-2007-5659 detected
hxxp://search-network-plus.com/load.php?a=a&st=Internet Explorer 6.0&e=2 -- this is the malicious site that the payload is downloaded from
After resolving the host we have a better idea of more URLs to search for
hxxp://search-network-plus.com/cache/PDF.php?st=Internet%20Explorer%206.0
hxxp://search-network-plus.com/load.php?a=a&st=Internet%20Explorer%206.0&e=2
hxxp://search-network-plus.com/load.php?a=a&st=Internet Explorer 6.0&e=1
hxxp://search-network-plus.com/load.php?a=a&st=Internet Explorer 6.0&e=2
hxxp://search-network-plus.com/load.php?a=a&st=Internet Explorer 6.0&e=3
(Note this is an old host dnstrails can help but this was a very old host)
Using pstree to find program run under other programs:
Volatility Foundation Volatility Framework 2.6
.. 0x81e5b2e8:winlogon.exe 644 548 21 521 2010-02-26 03:34:04 UTC+0000
... 0x82256da0:services.exe 688 644 16 293 2010-02-26 03:34:05 UTC+0000
... 0x82129da0:lsass.exe 700 644 22 416 2010-02-26 03:34:06 UTC+0000
Volatility Foundation Volatility Framework 2.6
. 0x82068020:firefox.exe 888 1756 9 172 2010-02-27 20:11:53 UTC+0000
.. 0x820618c8:AcroRd32.exe 1752 888 8 184 2010-02-27 20:12:23 UTC+0
Now we figure out what the file is that got dropped using filedump:
DataSectionObject 0x82264028 644 \Device\HarddiskVolume1\WINDOWS\system32\sdra64.exe
volatility filescan -f Bob.vmem | grep sdra
Volatility Foundation Volatility Framework 2.6
0x000000000230ff28 1 0 -WD--- \Device\HarddiskVolume1\WINDOWS\system32\sdra64.exe
0x0000000002464028 1 1 R----- \Device\HarddiskVolume1\WINDOWS\system32\sdra64.exe
We now we see where the file was dropped to disk and later we will hivescan the registry for two things one figure out what has been changed and also we can get some indicators of compromise (IOC) so we can now create YARA ruleset to scan files being downloaded by users and block malicious files.
Now a quick run to various Google and threatfeeds we are looking at Zeus Bot
https://www.symantec.com/security_respon...99&tabid=2
Using foremost we go ahead and extract all exe's for that PID 1752
foremost -i 1752.dmp -t exe -o exe
Then using grep we search for our payload file
grep "^http://"
| uniq -u
Binary file 00000016.exe matches
A quick sha256sum gives us:
sha256sum 00000016.exe
94aa18f7e5961469acd1e80805a5ef8a0a804bd85e99fe927cd00eaff23429bd 00000016.exe
We plugin our sha256sum into VT
https://www.virustotal.com/#/file/94aa18.../detection
6. Here we will be using our cmdline and cmdscan, this is helpful because if we start finding lots of commands like “net users” and so on we can tell if in fact we got an attacker who had enough time to start issuing commands, perhaps continuing down the kill chain for further exploitation. https://pastebin.com/h2wMF9Qd
7.EventLogs were recovered Secevents/AppEvents/SysEvents
8. Registry hivescan/hivedump/hivelist will be our tools here
Remember that winlogon.exe is also infected it is running from memory with no file on disk, it is was really winlogon I would think it'd be on disk.
Now we have an idea where we are looking from hivelist, lets dump that hive we know what we will be looking for winlogon.exe and or sdra64.exe as well so after we dump we are going to grep for our results. Dumping the hive will take a while so keep that in mind.
volatility dumpregistry -f Bob.vmem --dump-dir text/registry/
grep -i winlogon
Binary file registry.0xe1035b60.system.reg matches
Binary file registry.0xe1526748.software.reg matches
Binary file registry.0xe15a3950.default.reg matches
Binary file registry.0xe17a3820.NTUSERDAT.reg matches
Binary file registry.0xe17deb60.NTUSERDAT.reg matches
Binary file registry.0xe1de0b60.NTUSERDAT.reg matches
grep -i userinit *
Binary file registry.0xe1035b60.system.reg matches
Binary file registry.0xe1526748.software.reg matches
Now we know were the keys we need to focus on are going to be looking at we can use multiple tools more than just volatility like reglookup
https://pastebin.com/51Y7YU4h
Now I had issues with using Volatility and printkey I was only seeing subkeys either way we have to be comfortable with using anything to get our mission accomplished
Now we have clear proof that we know that we were on the correct path as to be able to quickly craft a powershell script to remotely test-key to see if the path is on other machines, in addition with our sha256sum we can quickly see what programs are loaded in memory and get ourselves the sha256sum values for all the programs as to prevent further compromise. Also we can now go ahead and craft up YARA rules and block hosts to filter such malicious files before they are transfered and compromise a user, and if a user was to open a compromised PDF and this same payload was going to be dropped we can prevent it from doing so.
Edit: Yes I went a bit above by extracting out the payload from memory which was not required, but it's important that users do see that your payloads and everything is fair game to an analyst. Let us remember that there is a good percentage of InfoSec professionals who have been hired much like privateers to strike back at hackers.