Recollection

Description

A junior member of our security team has been performing research and testing on what we believe to be an old and insecure operating system. We believe it may have been compromised & have managed to retrieve a memory dump of the asset. We want to confirm what actions were carried out by the attacker and if any other assets in our environment might be affected. Please answer the questions below.

Files

We are given a memory dump for analysis.

└─$ 7z x recollection.zip -p"hacktheblue"
└─$ la recollection.bin
Permissions Size User Group  Date Modified Name
.rwxrwx---  4.8G root vboxsf  6 Feb 10:03  recollection.bin 

I'll use Volatility 2 and Hacktricks Volatility - CheatSheetarrow-up-right

Tasks

Task 1. What is the Operating System of the machine?

➜ .\vol2.exe -f .\recollection.bin imageinfo
Volatility Foundation Volatility Framework 2.6
INFO    : volatility.debug    : Determining profile based on KDBG search...
          Suggested Profile(s) : Win7SP1x64, Win7SP0x64, Win2008R2SP0x64, Win2008R2SP1x64_23418, Win2008R2SP1x64, Win7SP1x64_23418
                     AS Layer1 : WindowsAMD64PagedMemory (Kernel AS)
                     AS Layer2 : FileAddressSpace (~\VBoxShare\recollection.bin)
                      PAE type : No PAE
                           DTB : 0x187000L
                          KDBG : 0xf80002a3f120L
          Number of Processors : 1
     Image Type (Service Pack) : 1
                KPCR for CPU 0 : 0xfffff80002a41000L
             KUSER_SHARED_DATA : 0xfffff78000000000L
           Image date and time : 2022-12-19 16:07:30 UTC+0000
     Image local date and time : 2022-12-19 22:07:30 +0600
circle-check

Task 2. When was the memory dump created?

Image date and time row from imageinfo contains relevant information.

circle-check

Task 3. After the attacker gained access to the machine, the attacker copied an obfuscated PowerShell command to the clipboard. What was the command?

circle-check

Task 4. The attacker copied the obfuscated command to use it as an alias for a PowerShell cmdlet. What is the cmdlet name?

SECURONIX THREAT RESEARCH KNOWLEDGE SHARING SERIES: HIDING THE POWERSHELL EXECUTION FLOWarrow-up-right

Writeup.png

IEX is an alias for Invoke-Expressionarrow-up-right

circle-check

Task 5. A CMD command was executed to attempt to exfiltrate a file. What is the full command line?

To see commands ran on system we can use cmdline or consoles analysis. (also cmdscan too!)

cmdline didn't show anything interesting, but consoles did.

circle-check

Task 6. Following the above command, now tell us if the file was exfiltrated successfully?

Based on IP not appearing on netscan I think it's safe to say the file was not exfiltrated.

circle-check
circle-info

Note: There was another line which showed the error The network path was not found. and that is the true indicator of fail!

Task 7. The attacker tried to create a readme file. What was the full path of the file?

After trying to exfiltrate the files we see encoded powershell being executed.

circle-check

Task 8. What was the Host Name of the machine?

Environment usually holds PC related information.

circle-check

Task 9. How many user accounts were in the machine?

My initial thought was to extract the usernames from env:

But it's better to dump user hashes and identify users that way.

circle-check

Task 10. In the "\Device\HarddiskVolume2\Users\user\AppData\Local\Microsoft\Edge" folder there were some sub-folders where there was a file named passwords.txt. What was the full file location/path?

Task 11. A malicious executable file was executed using command. The executable EXE file's name was the hash value of itself. What was the hash value?

During consoles analysis we saw the binary run. .\b0ad704122d9cffddd57ec92991a1e99fc1ac02d5b4d8fd31720978c02635cb1.exe

circle-check

Task 12. Following the previous question, what is the Imphash of the malicious file you found above?

Import hash: Import hash (or imphash) is a technique in which hash values are calculated based on the library/imported function (API) names and their particular order within the executable. If the files were compiled from the same source and in the same manner, those files would tend to have the same imphash value.

Since we have the hash of the file we can do online scanning, such as VirusTotalarrow-up-right:

Writeup-1.png
circle-check

Task 13: Following the previous question, tell us the date in UTC format when the malicious file was created?

From the VirusTotal "Creation Time".

circle-check

Task 14: What was the local IP address of the machine?

Answer: 192.168.0.104

Task 15: There were multiple PowerShell processes, where one process was a child process. Which process was its parent process?

circle-check

Task 16: Attacker might have used an email address to login a social media. Can you tell us the email address?

I was unable to dump the iehistory, but found this blog post: Extracting Browser History artifacts using Memory Forensics: Volatilityarrow-up-right

I tried extracting URLs via Yara rule and the output was overwhelming. My poor attempt to parse the urls was not so good too D:

strings command was more useful for this case and since we had URL matching regex from Yara it was easy to extract urls. I narrowed down to login because that's the most likely endpoint that exists on social media for login.

We see few requests made to facebook and 3 of the include device-based authentication. But we need an email address.

circle-check

Task 17: Using MS Edge browser, the victim searched about a SIEM solution. What is the SIEM solution's name?

Know we really need MS Edge browser history. First locate the History file which contains edge history:

Dump files:

Writeup-2.png

Looks like the victim not only searched, but downloaded SIEM solution: Wazuh - Open Source XDR. Open Source SIEM.arrow-up-right

circle-check

Task 18: The victim user downloaded an exe file. The file's name was mimicking a legitimate binary from Microsoft with a typo (i.e. legitimate binary is powershell.exe and attacker named a malware as powershall.exe). Tell us the file name with the file extension?

In edge download history we noticed <hash>.zip was downloaded. We can filter filescan by directory to see if it was extracted in same directory:

We see few exe files and the executable that seems to be mimicking the legitimate program is csrsss.exe

circle-check

Last updated