SonicWALL Inc.

09/12/2024 | Press release | Distributed by Public on 09/13/2024 02:16

Hold – Verify – Execute: Rise of Malicious POCs Targeting Security Researchers

Overview

While investigating CVE-2024-5932, a code injection vulnerability in the GiveWP WordPress plugin, our team encountered a malicious Proof of Concept (POC) targeting cybersecurity professionals. This has become a growing threat to cybersecurity professionals from threat actors to achieve their motives, such as crypto mining, data exfiltration and backdoor installation. We have dissected an instance we encountered and felt it important to share to help bring awareness to this problem. While security researchers are often very well equipped to handle and detect this situation, it is easy to become overconfident, leading to compromise.

Security researchers often need to verify publicly available POCs to accomplish their various tasks, and GitHub is a hotspot for such POCs. POCs on GitHub are widely considered reliable due to their ease of accessibility and the website's reputation. Should defenders execute a script without thoroughly vetting it? The subsequent sections will elaborate on why it is critical for researchers to be extra vigilant while leveraging such scripts. For the specific example used in this blog, SonicWall has created a signature to ensure the protection of our customers' IPS: 4496 XMRig Crypto Mining Activity. It's important to recognize the larger threat is not one specific example but the technique being used to target security researchers.

Analysis of a Real-world Sample

Initially, there was only a single instance of POC for CVE-2024-5932 by EQSTLab, which is a legitimate one. However, after a few hours, a couple of similar instances popped up, which looked like replicas of the original repository at first glance. The links of those repositories (taken down at the moment) are as follows.

http[s]://github[.]com/niktoproject/CVE-2024-5932 (malicious repo)
http[s]://github[.]com/sqlmap-projects/CVE-2024-5932 (malicious repo)

A screenshot of one of the instances can be seen in Figure 1.

[Link]

Figure 1: Screengrab of the malicious POC repository

Although such instances are not unusual, we decided to dig into them out of curiosity. It unveiled the addition of a discreet malicious code in the script, as seen in Figure 2.

[Link]

Figure 2: Evil code from POC script

This malicious code is executed when the script is run for the first time by the victim and performs the following tasks.

  • It clones the specified malicious script from the repository (http[s]://github[.]com/niktoproject/c/blob/main/c[.]sh - malicious), which contains crypto mining code.
  • It makes the script executable and runs it
  • It deletes the script

The cloned malicious script that uses XMRig miner to mine Monero can be seen in Figure 3.

[Link]

Figure 3: Crypto mining code

The above code performs the following tasks.

  • Downloads the miner and saves the executable file into a hidden directory and a hidden file at /home//.xconfig/.x path
  • Collects information of the machine resources, such as RAM and CPU, to use as a unique identifier
  • Creates a cronjob to make sure the mining process persists across reboots
  • Cleans temporary files to evade suspicion
  • Executes the miner

Indicators of Compromise (IOCs)

If someone has (accidentally) executed the malicious script, it can be identified using the indicators below.

  • Look for the process named ".x", which consumes the maximum resources, as seen in Figure 4.

[Link]

Figure 4: Crypto mining process

  • Check the cronjob list to see if the malicious cronjob is created
  • Observe the outgoing network connections going on the specified port in the script, as seen in Figure 5

[Link]

Figure 5: Network connection originated by mining process

Steps to Remove the Miner

The below steps can be followed to remove the miner.

  • Kill the process ".x" shown in Figure 4
  • Delete the miner executable from /home//.xconfig/.x
  • Remove the cronjob

Best Practices

Following are some established practices that can aid researchers in improving their security posture.

  • Always use isolated VMs and networks to do research or work.
  • Execute but verify! Run scripts only after vetting them thoroughly.
  • Never use the host machine to test anything.
  • Check the "Issues" section of the suspected repository. Some good souls may likely have warned the users.

Flagging on Social Media

Some researchers also flagged this issue on the social media platform "X," as seen in the links below.

https://x.com/win3zz/status/1828704644987511107
https://x.com/nav1n0x/status/1828715567785636112

Conclusion

Although researchers will undoubtedly need to use public POCs, their execution ought to be done with utmost caution to avoid dire consequences and severe attacks such as ransomware, data exfiltration, spoofing and botnets.

MITRE ATT&CK Mapping

Resource Development Initial Access Execution Persistence Defense Evasion Discovery Impact
T1588.005 T1189 T1204.002 T1053.003 T1070.004 T1082 T1496
Obtain Capabilities: Exploits Drive-by Compromise User Execution: Malicious File Scheduled Task/Job: Cron Indicator Removal: File Deletion System Information Discovery Resource Hijacking

Figure 6: MITRE ATT&CK mapping

Senior Threat Researcher| SonicWall
Hasib Vhora is a Senior Threat Researcher at SonicWall, where his focus is to identify, analyze and mitigate critical vulnerabilities. His primary role is to actively monitor zero days and novel threats by keeping an eye on the Open-Source Threat Intelligence (OSINT) space using various methods including leveraging the power of automation. Hasib is a seasoned vulnerability researcher, specializing in the development of protection signatures in Intrusion Prevention Systems (IPS) and Web Application Firewalls (WAF).