Vulnerabilities

Shai-Hulud Attack Compromises 19 PyPI Packages

June 9, 2026 12:12 · 10 min read
Shai-Hulud Attack Compromises 19 PyPI Packages

Introduction to the Shai-Hulud Attack

A recent supply-chain attack, known as Shai-Hulud, has compromised 19 packages on the PyPI (Python Package Index), a repository of software for the Python programming language. The attack, discovered by application security company Socket, involves the trojanization of popular bioinformatics tools, including Dynamo, Spateo, CoolBox, U-FISH, and Napari-UFISH.

The malicious campaign includes 37 infected releases for the 19 compromised packages, which appear to be maintained by a single individual. The infected packages contain a malicious file named '*-setup.pth' and an obfuscated JavaScript payload named '_index.js'.

Technical Details of the Attack

When a user starts Python, the malicious PTH file is executed, attempting to download the Bun JavaScript runtime from GitHub to run the bundled script. This means that a compromised wheel can turn a passive dependency install into a delayed execution trigger, potentially affecting various Python-related activities, such as pip, test runs, notebook kernels, CI jobs, or package-management commands.

The JavaScript payload is designed to steal a broad range of developer secrets, including GitHub tokens, npm and PyPI publishing tokens, AWS and Azure credentials, SSH keys, and Docker credentials. The malware also targets .env, .npmrc, and .pypirc files, as well as shell histories and Claude/MCP configuration files.

Exfiltration Methods and Evasion Mechanisms

The primary method of exfiltrating stolen secrets involves automatically created GitHub repositories, which host the secrets written via GitHub Actions. A secondary exfiltration method uses direct HTTPS to send the stolen data to a legitimate but invalid Anthropic API endpoint, likely used for camouflage.

The malware features evasion mechanisms, such as checking for Russian locales and environments, and security tools like StepSecurity Harden-Runner. Persistence is established through systemd services on Linux and LaunchAgents on macOS, as well as GitHub workflow and Claude/MCP configuration files.

Recommendations for Defenders

Socket recommends that organizations that installed the compromised packages rotate all secrets and restore their environments from safe backups. Defenders should look for Python packages containing executable .pth startup hooks, unexpected downloads of the Bun JavaScript runtime from GitHub, and process chains where Python launches Bun to execute _index.js.

To detect similar attacks, security teams can use breach and attack simulation tests to evaluate their SIEM and EDR rules, ensuring that threats do not slip by undetected. This approach can help prevent attacks like Shai-Hulud, which has already compromised hundreds of thousands of downloads.

Broader Implications of the Shai-Hulud Attack

The Shai-Hulud attack is part of a broader campaign that has already compromised 453 items, according to Socket's tracking. The attack highlights the importance of supply-chain security and the need for developers to be vigilant when installing dependencies. By understanding the techniques used in this attack, defenders can better prepare themselves for similar threats in the future.

By taking these steps, organizations can reduce the risk of falling victim to the Shai-Hulud attack and similar supply-chain threats.


Source: BleepingComputer

Source: BleepingComputer

Powered by ZeroBot

Protect your website from bots, scrapers, and automated threats.

Try ZeroBot Free