Scenario
Following a recent report of a data breach at their company, the client submitted a potentially malicious executable file. The file originated from a link within a phishing email received by a victim user. Your objective is to analyze the binary to determine its functionality and possible consequences it may have on their network. By analyzing the functionality and potential consequences of this binary, you can gain valuable insights into the scope of the data breach and identify if it facilitated data exfiltration. Understanding the binary’s capabilities will enable you to provide the client with a comprehensive report detailing the attack methodology, potential data at risk, and recommended mitigation steps.
Notes:
- The client provided the following file:
heartbreaker.exe
- The client suspects that the binary may have been used to exfiltrate data from their network.
Questions
To solve this Sherlock, you must answer the following questions:
- To accurately reference and identify the suspicious binary, please provide its SHA256 hash.
- When was the binary file originally created, according to its metadata (UTC)?
- Examining the code size in a binary file can give indications about its functionality. Could you specify the byte size of the code in this binary?
- It appears that the binary may have undergone a file conversion process. Could you determine its original filename?
- Specify the hexadecimal offset where the obfuscated code of the identified original file begins in the binary.
- The threat actor concealed the plaintext script within the binary. Can you provide the encoding method used for this obfuscation?
- What is the specific cmdlet utilized that was used to initiate file downloads?
- Could you identify any possible network-related Indicators of Compromise (IoCs) after examining the code? Separate IPs by comma and in ascending order.
- The binary created a staging directory. Can you specify the location of this directory where the harvested files are stored?
- What MITRE ID corresponds to the technique used by the malicious binary to autonomously gather data?
- What is the password utilized to exfiltrate the collected files through the file transfer program within the binary?
Seems like we have a lot of work to do. Let’s start the investigation.
Data
We got one zip file from the task. Let’s extract it and start the investigation.
Only one file was extracted from the zip file: Superstar_MemberCard.tiff.exe
. Let’s start by analyzing this binary.
Tools
In this investigation, we will use the following tools:
- PEStudio
- HxD
- VirusTotal
- Base64 Decoder
Analysis
Files Identification
For the first question, we need to get the SHA256 hash of the binary file.
SHA-256 hashes are not built into the files themselves, they are an essential tool in cybersecurity for verifying, identifying, and tracking files.
Therefore, it acts as a unique identifier for the file. We can get it by using the sha256sum
command or by PEStudio
.
First task solved!
Next we need to find out when the binary file was originally created. We can get this information from the file’s metadata using exiftool
. However, I found it not convenient because I have to convert the time to UTC manually. So I will use PEStudio
to get this information.
Second task solved!
The third question asks us to specify the byte size of the code in this binary. We can get this information from the PEStudio
tool.
Location of the code section in the binary mainly located in the .text
section. The .text
section contains the executable code of the program. It starts at 0x00000200
and ends at 0x00009800
. The size of the code section is 0x00009600
bytes or 38400
bytes.
Third task solved!
The fourth question asks us to determine the original filename of the binary. We can get this from resources
section.
Seems like the original filename is binded to the .text
section.
Also, the fifth question asks us to specify the hexadecimal offset where the obfuscated code of the identified original file begins in the binary. The location
column in the resources
section shows the offset of the resource in the binary.
Remeber the format of the answer is XXXX
so remember to remove the 0x0000
prefix.
Fourth task solved! Fifth task solved!
Obfuscation
The sixth question asks us to provide the encoding method used for this obfuscation.
I checked with strings
command and found the variable that stores the encoded script:
The $enC
variable first reverses the string and then decodes it from base64. So the encoding method used for this obfuscation is Base64
.
Therefore, remember to reverse the string before decoding it from base64.
Sixth task solved!
Script Analysis
The seventh question asks us to identify the specific cmdlet utilized that was used to initiate file downloads.
This question itself requires us to have some knowledge about PowerShell. Otherwise, we can search for the cmdlet on the internet.
The cmdlet used to initiate file downloads is Invoke-WebRequest
.
Seventh task solved!
The eighth question asks us to identify any possible network-related Indicators of Compromise (IoCs) after examining the code.
With the code snippet we decoded from the binary:
We can see that the binary connects to the IP 35.169.66.138
and 44.206.187.144
.
Eighth task solved!
The ninth question asks us to specify the location of the staging directory where the harvested files are stored.
I found the staging directory in the code snippet:
However, we can also find it with Virustotal
:
The Files Written
section showed that almost all files are written to C:\Users\Public\Public Files
.
Ninth task solved!
The tenth question asks us to identify the MITRE ID that corresponds to the technique used by the malicious binary to autonomously gather data.
The technique used by the malicious binary to autonomously gather data is Automated Collection.
Once established within a system or network, an adversary may use automated techniques for collecting internal data. Methods for performing this technique could include use of a Command and Scripting Interpreter to search for and copy information fitting set criteria such as file type, location, or name at specific time intervals.
Tenth task solved!
The eleventh question asks us to identify the password utilized to exfiltrate the collected files through the file transfer program within the binary.
The password utilized to exfiltrate the collected files through the file transfer program within the binary is M8&C!i6KkmGL1-#
as shown in the code snippet:
This code snippet is used to upload the collected files to the attacker’s server.
Eleventh task solved!
Conclusion
This Sherlocks task was very interesting. The amount knowledge required to solve this task was not much but it covered a wide range of topics and tools. I hope you enjoyed this write-up and learned something new.