Relic Maps

Challenge Description

Pandora received an email with a link claiming to have information about the location of the relic and attached ancient city maps, but something seems off about it. Could it be rivals trying to send her off on a distraction? Or worse, could they be trying to hack her systems to get what she knows?Investigate the given attachment and figure out what's going on and get the flag. The link is to http://relicmaps.htb:/relicmaps.one. The document is still live (relicmaps.htb should resolve to your docker instance).

Solution

From the challenge description, we will visit the link http://relicmaps.htb:/relicmaps.one, and a file named relicmaps.one will be downloaded automatically . This file's format is OneNote file.

According to a blogarrow-up-right post by Didier Stevens, we used a tool called 010 Editorarrow-up-right to analyze the file. Browsing around, I discovered that this OneNote file embeds a malicious script.

relicmaps.one in 010 Editor

We can copy the malicious code to a file or using onedump.pyarrow-up-right to dump the VBS script

We can notice that this script tries to use WMI to create and execute cmd. It's use cmd to download 2 malicious files from hxxp[://]relicmaps[.]htb/uploads/soft/topsecret-maps[.]one and hxxp[://]relicmaps[.]htb/get/DdAbds/window[.]bat . Both files will be saved and executed. To analyze these 2 files, we will need to download them by visiting 2 malicious URLs.

After receiving the two files, we will focus on analyzing the window.bat file.

window_bat file

Looking into the window.bat file, it appears to be a .BAT file containing multiple scripts and heavily obfuscated. To make it more readable, I created a script to deobfuscate it.

After running the code above, we will receive a clearer script.

The PowerShell payload will search for the long comment in the middle of the .bat file (window_bat), decode it from Base64 format, and then decrypt it using AES. We can observe that the key and IV values are hardcoded in lines 15 and 16. Finally, the payload decompresses the data to extract the malware. As a result, I will create a python file to achieve the malware from encrypted data in .bat file

After save the decrypted data to a file, I will calculate the md5 hash value of it.

MD5 Hash value

MD5: 5415CC2ABDC197D89DAC3087D6E9E859

Then, I will put this value into VirusTotal to gain more information of this malware

According to VirusTotal, this is malware written in .NET. For this reason, I will use DNSpy to analyze its code, and we can find the flag in the Main() function.

FLAG: HTB{0neN0Te?_iT'5_4_tr4P!}

Last updated