Analytics Story: NPM Supply Chain Compromise

Description

Behavioral detections and hunting content for detecting npm supply chain compromises, including the Shai-Hulud worm and its 2.0 variant. Focuses on preinstall/postinstall script abuse, credential exfiltration via curl/wget, malicious GitHub Actions workflow injection (shai-hulud-workflow.yml, discussion.yaml), package file patching, cloud credential harvesting, self-hosted runner backdoors, and rapid npm publishing activity.

Why it matters

Recent incidents highlight self-replicating worms ("Shai-Hulud" and "Shai-Hulud 2.0") abusing the npm ecosystem.

After compromising developer credentials, malicious packages execute during preinstall/postinstall phases to exfiltrate secrets, plant malicious GitHub Actions workflows, register self-hosted runner backdoors, and republish tampered packages to spread across the ecosystem.

Shai-Hulud 2.0 (November 2025) introduced new payload files (setup_bun.js, bun_environment.js), exfiltration artifacts (cloud.json, contents.json, environment.json, truffleSecrets.json), and a backdoor workflow (discussion.yaml) that enables remote command execution via GitHub Discussions on compromised self-hosted runners named "SHA1HULUD".

The campaign has affected 25,000+ repositories across ~500 GitHub users, with propagation rates of ~1,000 new repos every 30 minutes.

This story provides Linux and Windows analytics using Sysmon, auditd, and GitHub audit logs. Prioritize monitoring npm installs, curl/wget posts, node_modules file patching, workflow YAML writes under .github/workflows, self-hosted runner registrations, and cloud credential file access.

Detections

Name ▲▼ Technique ▲▼ Type ▲▼
GitHub Enterprise Delete Branch Ruleset Disable or Modify Tools, Supply Chain Compromise Anomaly
GitHub Enterprise Disable Audit Log Event Stream Disable or Modify Cloud Logs, Supply Chain Compromise Anomaly
GitHub Enterprise Modify Audit Log Event Stream Disable or Modify Cloud Logs, Supply Chain Compromise Anomaly
GitHub Enterprise Pause Audit Log Event Stream Disable or Modify Cloud Logs, Supply Chain Compromise Anomaly
GitHub Enterprise Register Self Hosted Runner Disable or Modify Tools, Supply Chain Compromise Anomaly
GitHub Enterprise Repository Archived Data Destruction, Supply Chain Compromise Anomaly
GitHub Enterprise Repository Deleted Data Destruction, Supply Chain Compromise Anomaly
GitHub Organizations Delete Branch Ruleset Disable or Modify Tools, Supply Chain Compromise Anomaly
GitHub Organizations Repository Archived Data Destruction, Supply Chain Compromise Anomaly
GitHub Organizations Repository Deleted Data Destruction, Supply Chain Compromise Anomaly
File Download or Read to Pipe Execution Ingress Tool Transfer TTP
GitHub Workflow File Creation or Modification Dynamic Linker Hijacking, Compromise Host Software Binary, Supply Chain Compromise Hunting
Linux Curl Upload File Ingress Tool Transfer TTP
Linux Ingress Tool Transfer Hunting Ingress Tool Transfer Hunting
Linux Ingress Tool Transfer with Curl Ingress Tool Transfer Anomaly
Shai-Hulud 2 Exfiltration Artifact Files Local Data Staging, Credentials In Files, Compromise Software Supply Chain TTP
Shai-Hulud Workflow File Creation or Modification Dynamic Linker Hijacking, Compromise Host Software Binary, Supply Chain Compromise TTP
Windows Curl Download to Suspicious Path Ingress Tool Transfer TTP
Windows Curl Upload to Remote Destination Ingress Tool Transfer TTP
Windows File Download Via PowerShell PowerShell, Ingress Tool Transfer Anomaly

Data Sources

Name ▲▼ Platform ▲▼ Sourcetype ▲▼ Source ▲▼
Cisco Network Visibility Module Flow Data Network icon Network cisco:nvm:flowdata not_applicable
CrowdStrike ProcessRollup2 Other crowdstrike:events:sensor crowdstrike
GitHub Enterprise Audit Logs Other httpevent http:github
GitHub Organizations Audit Logs Other github:cloud:audit github
Sysmon EventID 1 Windows icon Windows XmlWinEventLog XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
Sysmon EventID 11 Windows icon Windows XmlWinEventLog XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
Sysmon for Linux EventID 1 Linux icon Linux sysmon:linux Syslog:Linux-Sysmon/Operational
Sysmon for Linux EventID 11 Linux icon Linux sysmon:linux Syslog:Linux-Sysmon/Operational
Windows Event Log Security 4688 Windows icon Windows XmlWinEventLog XmlWinEventLog:Security

References


Source: GitHub | Version: 2