The Abuse of GitHub for Malware Distribution and LummaStealer Analysis

Listen to this Post

Another story from our SOC. “A network connection event or file download seen on your network has been linked to an emerging threat activity group. The following file has triggered this alert:”

`C:\Users\username\Downloads\NanoPhanoTool.exe`

According to the analysis, the user downloaded this file 17 times (!), seemingly because it was blocked every time the download was completed. This is some persistence by the user 🙂

`NanoPhanoTool.exe` is a LummaStealer, the sample is here on Malware Bazaar [1]

Trendmicro wrote an interesting article about the abuse of GitHub as a trusted platform for delivering malware:

While distinctions exist in the infection chain order and specific implementation details, several key components are consistent. Quote from [2]

  • Compromised websites: used to deploy malicious PHP scripts for validation and redirection.
  • GitHub repositories: used as a trusted platform to host and distribute payloads.
  • Redirect infrastructure: tailored redirection mechanisms are employed to direct victims to malicious content.

[1] https://lnkd.in/e_hxgZZW
[2] https://lnkd.in/et6p-cy4

Practice Verified Codes and Commands:

1. Detecting Malicious Downloads on Windows:

Get-ChildItem -Path C:\Users*\Downloads* -Recurse | Where-Object { $_.Name -eq "NanoPhanoTool.exe" } | Remove-Item -Force

2. Blocking Suspicious URLs via Firewall:

iptables -A OUTPUT -p tcp --dport 443 -d github.com -j DROP

3. Scanning for Malware with ClamAV:

sudo apt-get install clamav
freshclam
clamscan -r /home/

4. Monitoring Network Connections on Linux:

sudo netstat -tuln | grep ESTABLISHED

5. Analyzing GitHub Repositories for Malicious Content:

git clone <repository-url>
grep -r "malicious_pattern" <repository-directory>

6. Removing Malicious PHP Scripts:

find /var/www/html -name "*.php" -exec grep -l "malicious_code" {} \; -delete

7. Blocking GitHub Repositories in Enterprise Environments:

sudo nano /etc/hosts

<h1>Add the following line to block GitHub</h1>

127.0.0.1 github.com

8. Using YARA Rules to Detect LummaStealer:

yara -r lumma_stealer.yar /path/to/scan

9. Analyzing Suspicious Files with Cuckoo Sandbox:

cuckoo submit /path/to/NanoPhanoTool.exe

10. Enhancing Security with SELinux:

sudo setenforce 1

What Undercode Say:

The abuse of GitHub for malware distribution highlights the evolving tactics of cybercriminals who exploit trusted platforms to deliver malicious payloads. LummaStealer, as seen in the `NanoPhanoTool.exe` case, is a prime example of how persistent attackers can be. To mitigate such threats, organizations must adopt a multi-layered security approach. Start by monitoring network connections and downloads using tools like `netstat` and PowerShell scripts. Implement strict firewall rules to block suspicious domains, and regularly scan systems with antivirus tools like ClamAV. Additionally, analyze GitHub repositories for malicious content before cloning or executing any code. Use YARA rules to detect specific malware signatures and sandbox environments like Cuckoo to analyze suspicious files. Finally, enforce strict access controls and SELinux policies to limit the impact of potential breaches. By combining these strategies, organizations can significantly reduce the risk of falling victim to such sophisticated attacks. For further reading, refer to the Trendmicro article on GitHub abuse [2] and the Malware Bazaar sample [1]. Stay vigilant and proactive in your cybersecurity efforts.

References:

Hackers Feeds, Undercode AIFeatured Image