Objective 9.4: Recover Alabaster’s Password

Objective 9.4, the last one, it won’t be the easy one. Well, let’s get on! We need to Recover Alabaster’s password as found in the encrypted password vault (https://www.holidayhackchallenge.com/2018/challenges/forensic_artifacts.zip)

If we speak to Alabaster Snowball, they tell us the following.
“Yippee-Ki-Yay! Now, I have a ma… kill-switch!
Now that we don’t have to worry about new infections, I could sure use your L337 security skills for one last thing.
As I mentioned, I made the mistake of analysing the malware on my host computer and the ransomware encrypted my password database.
Take this zip with a memory dump and my encrypted password database, and see if you can recover my passwords.
One of the passwords unlocks our access to the vault so we can get in before the hackers.”

Again Shinny Upatree gives us the same hint.
“Have you heard that new ransomware called Wannacookie hit Kringle Castle? 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.”

Alabaster Snowball does give us a new hint “wannacookie.min.ps1? I wonder if there is a non-minified version? If so, it may be easier to read and give us more information and maybe source comments?”
Also, a hint: “Pulling strings from a memory dump using the Linux strings command requires you specify the -e option with the specific format required by the OS and processor. Of course, you could also use powerdump.”

Well, I guess it’s back to PowerShell scripts.
Do you remember this?
“6B6579666F72626F746964” = Keyforbotid.
“6B696C6C737769746368” = Killswitch.
“7365727665722E637274” = Server.crt.
“72616e736f6d697370616964” = Ransomispaid

Do you remember how we were able to download a full version of the wannacookie PowerShell script just by changing the HEX code? Yep, that’s what we’re going to do here! Download the other files as we need them to decrypt the vault.

Using the old wannacookie script, we can rebuild it and use it to download the files we need, if you look at the script here and here.

“function get_over_dns($f)” is pretty much self-said, it gets over the DNS, and we can use this to get the files we need over DNS. And not forgetting “function H2A()” as “get_over_dns” calls from it. Once we have that, we have our script ready!

So that’s working a charm! We only need the server.crt (“7365727665722E637274” = Server.crt.) from here. Nothing else for now.

(Remember to change the HEX code and file name to what you need!)

We have the server.crt file, but we don’t have the server.key file!
“crt and key files represent both parts of a certificate, the key being the private key to the certificate and crt being the signed certificate.”

We need this key, or else we’re not going to get far. However, we don’t know where it is, well we do! Do you remember the website we used before?
(http://www.unit-conversion.info/texttools/hexadecimal/) Yep, all we need to do is get the HEX for server.key!
“7365727665722e6b6579” = server.key

Now we need to download the file, using the same PowerShell script as before. Also, we have our file! Now we have both server.crt and server.key!

(Note: The keys may not work, this comes down to Windows formatting of text, if you’re having issues you can find the keys here).

Now it’s time for the next hint to play this part, and that is to download Power Dump.

Also, don’t forget we need “Powershell.exe_181109_104716.dmp”, which we can get from the first URL.

Even if we try to open “Powershell.exe_181109_104716.dmp” were meet with lot’s of Garbish, so we need to decrypt it!

Power Dump comes into play, let’s load it up and get ready to do some Power Dumps.
First, let’s load up the script with this command “./power_dump.py

Next, we want to load the PowerShell Memory Dump File by using “1”.
It now asks us where the file is if the file is in the same directory as power_dump.py then you can do “ld Powershell.exe_181109_104716.dmp” If it’s in another folder, you need to point it to the full path.
Once the file loaded, do “B” to go back to the menu.

Great now our file is loaded, but not been processed yet, we want “2” Process PowerShell Memory Dump… So we wait

Now that’s done, let’s dump the stored PS Variables by using “4” and using this command “dump all”, now we have everything dumped into “variable_values.txt.

Nothing left to do now, but to look through the text file and find something that we need, and yes there is much text here. Much text! However, we’re looking for some decrypt key so let’s look for keywords here “decrypt”, “key” and so on, and we find this long string!

We have what we need here; now we need to decrypt it, and get closer to unlocking the vault!
…. Now how are we going to decrypt this? Simple! We use the same Wannacookie PowerShell script (the one that encrypted files) to decrypt the files.

Before we do any decrypting, we first need to create a server.pfx file we can use OpenSSL for this and this command.

openssl pkcs12 -export -in server.crt -inkey server.key -out server.pfx -passout pass:topsecret

(Make sure you have the .key and .crt in the same folder), we should now have a server.pfx file, that’s all we needed.

You already know we can take parts from wannacookie PowerShell and re-use them, in this case, I have created a small and simple python 3 script (You don’t need the server files here, only this script and alabaster_passwords.elfdb.wannacookie. The script handles the rest!

Moreover, the python decrypter script works a charm!

Now we have two files; one file is encrypted “TIM image” and the other file decrypted which is a “SQLite.”

The decrypted file is SQLite, and you remember from “Pepper Minstix – Yule Log Analysis” we could just dump all, but we only need the passwords so that we can shorten the command needed and doing:

sqlite3 alabaster_passwords.elfdb 'select password,usedfor from passwords'

Moreover, we got the password! “ED#ED#EED#EF#G#F#G#ABA#BA#B”…. I wonder if this opens the piano door?

(You can also open the file in Notepad++ if you choose too)

Leave a Comment

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