Name:
Hunting CryptoBot in the wild
TTP:
T1566.002 Phishing: Spearphishing Link
Hypothesis:
Attackers are using spearphishing emails containing malicious links to deliver malware that uses Rundll32 and Mshta for defense evasion.
Suspected TTPs:
- Initial Access: Spearphishing Link
- Execution: Rundll32
- Defense Evasion: Mshta
Campaign Type:
Hybrid
Data Sources:
- Endpoint logs (e.g., Sysmon, Windows Event Logs)
- Network traffic logs (e.g., Zeek/Bro, Suricata)
- Email security gateway logs
Tools:
- An environment for the attack: This can be a virtual machine or a physical machine.
- The Windows Operating System: The testing will need to be done on a Windows system, as the technique itself is Windows-specific.
- A means to collect logs: Sysmon and WEC (Windows Event Collector) will be set up to collect the logs generated during testing.
- The right auditing: Ensure that the system is set up to collect the right level of logs, including enabling the correct audit policy and Sysmon configuration file.
- The attack vector: A script or an HTA file will be created for testing purposes.
Scenario:
- Initial Access: Attacker sends a spearphishing email containing a malicious link to a victim within the organization.
- Execution: The victim clicks on the malicious link, which executes a script or downloads a malicious file.
- Defense Evasion: The script or the file uses Rundll32 and/or Mshta to execute malicious code while evading defenses.
- Persistence: The malware establishes persistence on the victim’s machine.
- Privilege Escalation (Optional): The malware attempts to gain elevated privileges.
- Lateral Movement (Optional): The malware spreads to other systems within the network.
- Exfiltration (Optional): The malware exfiltrates sensitive data from the compromised systems.
- Impact: The attacker achieves their objective, which could be data theft, disruption of services, or financial gain.
Recommendations:
- Implement strong email filtering rules to block or quarantine suspicious emails containing malicious links.
- Educate users about phishing attacks and the risks of clicking on suspicious links or attachments.
- Deploy endpoint detection and response (EDR) solutions to monitor and block malicious activity on endpoints.
- Regularly review and update security controls to mitigate the latest threats and vulnerabilities.
Step-by-Step Threat Hunting Emulation:
Prepare the Environment:
- Set up a Windows virtual machine (VM) with the desired configuration.
- Install Sysmon and configure it with the desired ruleset.
- Enable the necessary audit policies for the operating system.
- Set up a centralized log management system (e.g., HELK, QRadar, Azure Sentinel) to collect and store security events.
Emulate the Attack Techniques:
- Create a malicious script or HTA file that uses Rundll32 and/or Mshta to execute a benign payload (e.g., calculator).
- Execute the script or HTA file on the Windows VM.
Emulate Post-Compromise Activities:
- (Optional) Simulate privilege escalation by executing a privilege escalation exploit or technique.
- (Optional) Simulate lateral movement by using tools like PsExec or WMI to connect to and execute commands on other systems.
- (Optional) Simulate exfiltration by transferring files or data from the compromised VM to an external system.
Collect and Analyze Logs:
- Collect the generated security event logs from your centralized log management system.
- Use analysis tools (e.g., Kibana, Splunk, QRadar) to search for events related to the emulated attack techniques.
- Filter events based on relevant criteria, such as process names, command-line parameters, network connections, and registry activity.
Refine Detections:
- Analyze the collected logs to identify patterns and refine your detection rules.
- Consider using threat detection frameworks like YARA or SIGMA to create more robust detection rules.
- Document your analysis and findings to improve future threat hunting efforts.
Hunting Strategy:
- Analyze email security gateway logs for emails containing suspicious links or attachments.
- Correlate email logs with endpoint and network logs to identify users who clicked on suspicious links or downloaded the files.
- Search endpoint logs (Sysmon, Windows Event Logs) for the execution of Rundll32 and Mshta with unusual command-line parameters.
- Analyze network traffic logs for any unusual connections or data transfers initiated by the victim’s machine after clicking the link.
- Investigate any outliers or suspicious events identified in the previous steps.
- If a threat is validated, perform further analysis to determine the malware’s capabilities, persistence mechanisms, and any other related activity.
- Remediate the threat by isolating the compromised systems, removing the malware, and implementing necessary patches or security controls.
- Document the findings of the threat hunt, including indicators of compromise (IOCs), attack paths, and remediation actions taken.
False Positive Consideration:
- Legitimate use of Rundll32 and Mshta by system administrators or software installers.
- Users accessing legitimate websites or web applications that may trigger the detection rules.
D3 Diagram:
T1055.001 - Process Injection: Dynamic-link Library Injection Implementations: * Process Hollowing * Thread Execution Hijacking * Asynchronous Procedure Call (APC) Injection * Thread Local Storage (TLS) Injection Observables: * Process Name: svchost.exe (Analytic Robustness: 3 - Pre-Existing Tool, Event Robustness: U - User-Mode) * Rationale: Windows utility, can be renamed by an adversary. * Process Name: rundll32.exe (Analytic Robustness: 3 - Pre-Existing Tool, Event Robustness: U - User-Mode) * Rationale: Windows utility, can be renamed by an adversary. * Command Line: “CreateRemoteThread” (Analytic Robustness: 4 - Some Implementations, Event Robustness: K - Kernel-Mode) * Rationale: Specific to this technique, but other process injection techniques could be used. * Loaded DLL: “KERNEL32.DLL” (Analytic Robustness: 4 - Some Implementations, Event Robustness: A - Application) * Rationale: Indicates the execution of process injection. Notes: * This D3 diagram is not exhaustive and may evolve with further research and analysis. * The robustness levels assigned are based on a generalized assessment and may vary depending on the specific context. * Defenders should consider combining multiple observables to improve the accuracy and robustness of their detections.