Shai-Hulud Malware Variant Targets Python Developers via PyPI

๐กCritical supply chain threat: malicious PyPI packages are using .pth files to execute code silently at install time.
โก 30-Second TL;DR
What Changed
Five malicious PyPI packages identified, including typosquats for Flask, Requests, and NumPy.
Why It Matters
This attack poses a significant risk to CI/CD environments, as the worm is designed to steal credentials across major cloud providers. Developers must be vigilant against typosquatted packages that mimic popular libraries.
What To Do Next
Audit your project's requirements.txt or pyproject.toml files to ensure no typosquatted dependencies are present and implement strict dependency pinning.
Key Points
- โขFive malicious PyPI packages identified, including typosquats for Flask, Requests, and NumPy.
- โขAttackers use .pth files to execute malicious code at install time without requiring explicit imports.
- โขThe payload downloads the Bun JavaScript runtime to execute an obfuscated credential-stealing worm.
- โขThe campaign is a copycat of the open-sourced Shai-Hulud malware toolkit.
๐ง Deep Insight
Web-grounded analysis with 24 cited sources.
๐ Enhanced Key Takeaways
- โขThe malware targets a broad range of developer secrets, including GitHub tokens, npm, PyPI, RubyGems, JFrog publishing tokens, AWS, GCP, Azure, Kubernetes, Vault credentials, SSH keys, Docker configurations, .env files, .npmrc files, .pypirc files, Claude/MCP configurations, and shell histories.
- โขThe "Hades" variant, a new branch of the Mini Shai-Hulud/Miasma campaign, specifically targeted 37 malicious wheel artifacts across 19 packages in the PyPI registry, many of which are popular bioinformatics and deep-learning toolkits.
- โขThe malware employs evasion techniques, such as checking for Russian locales/environments and security tools like StepSecurity Harden-Runner, and can even use adversarial prompt injection to mislead AI security scanners.
- โขThe Shai-Hulud campaign is attributed to the TeamPCP threat group, known for its deep technical expertise in CI/CD exploitation, credential harvesting, and malware obfuscation, and has been observed using valid SLSA Build Level 3 provenance to sign malicious packages.
- โขA destructive "dead-man switch" or "wiper process" is a core component of the Hades design, which attempts to erase the user's local files if a security team detects and revokes stolen GitHub tokens, creating a high-stakes situation for incident responders.
๐ ๏ธ Technical Deep Dive
- .pth file exploitation: The
*-setup.pthfile is designed to execute automatically during Python startup, downloading the Bun JavaScript runtime and running an obfuscated JavaScript payload named_index.js. This exploits Python's native execution of lines starting with an import statement during initialization, turning a passive dependency into an active weapon. - Bun JavaScript runtime usage: Bun is downloaded as a standalone ZIP file from GitHub Releases, allowing the malware to run complex JavaScript tasks in environments lacking a Node.js installation, bypassing traditional package manager controls and network proxy logs. It's chosen for its speed, all-in-one nature, and relative newness in malware campaigns, making it less easily detected.
- Payload execution: The Bun runtime executes an obfuscated JavaScript payload (e.g.,
_index.js,execution.js,router_runtime.js) which performs anti-virtual machine checks, communicates with C2 infrastructure, decrypts follow-on payloads (often NWHStealer), and injects them into memory using Windows APIs likeVirtualAllocandLoadLibraryA. - Credential harvesting: The malware scrapes process memory (e.g.,
/proc/{pid}/memon Linux, tailored scrapers for macOS/Windows) of GitHub Actions runner processes to extract secrets, including those masked by CI systems. It targets over 100 file paths for credentials and uses tools like TruffleHog for secret discovery. - Propagation and persistence: The worm actively searches for publishing access (e.g., npm, PyPI tokens), modifies package tarballs, injects malicious metadata, and republishes infected artifacts. It also establishes persistence via scheduled tasks, GitHub Actions workflows (e.g.,
discussion.yamlto register self-hosted runners), and monitors stolen tokens. - Exfiltration: Stolen data is compressed, encrypted (e.g., AES-256-GCM), and exfiltrated to attacker-controlled C2 servers or new public GitHub repositories created under the victim's account, often with descriptions like "Hades โ The End for the Damned" or "Shai-hulud Migration".
๐ฎ Future ImplicationsAI analysis grounded in cited sources
โณ Timeline
๐ Sources (24)
Factual claims are grounded in the sources below. Forward-looking analysis is AI-generated interpretation.
- thehackernews.com
- dev.to
- bleepingcomputer.com
- snyk.io
- rescana.com
- securityonline.info
- securityweek.com
- stepsecurity.io
- rescana.com
- jfrog.com
- datadoghq.com
- arcticwolf.com
- beeble.com
- ox.security
- malwarebytes.com
- socprime.com
- snyk.io
- endorlabs.com
- trendmicro.com
- reversinglabs.com
- amazon.com
- paloaltonetworks.com
- securelist.com
- rapid7.com
Weekly AI Recap
Read this week's curated digest of top AI events โ
๐Related Updates
AI-curated news aggregator. All content rights belong to original publishers.
Original source: GitLab Blog โ


