news Semgrep

Shai-Hulud Themed Malware Found in the PyTorch Lightning AI Training Library | Semgrep

Semgrep reports that the PyPI package **lightning**—a widely used deep learning framework for training and inference—was compromised in versions **2.6.2** and **2.6.3** in a supply chain attack published on **April 30, 2026**. The malicious code activates simply when the package is imported, meaning `pip install lightning` could expose developers and CI systems to infection. The payload hides in a `_runtime` directory and runs an obfuscated JavaScript malware component that **steals credentials, authentication tokens, environment variables, and cloud secrets**. It also attempts to **poison GitHub repositories** by planting persistence mechanisms and spreading to other packages. Semgrep says the campaign appears tied to the same actor behind the **Mini Shai-Hulud** malware family, using similar Dune-themed naming and commit-message patterns such as **EveryBoiWeBuildIsAWormyBoi**. Unlike the earlier npm-focused campaign, this attack starts in **PyPI** but uses **npm** for propagation. If it finds npm publish credentials, it injects malicious files into packages the token can publish, adds a `preinstall` script, bumps the patch version, and republishes the package so downstream users are infected too. The malware exfiltrates data through multiple channels: HTTPS to attacker infrastructure, GitHub commit-search dead drops, attacker-controlled public repos, and direct pushes to victim repositories when possible. It targets local files, shell environment variables, GitHub Actions secrets, and major cloud providers including **AWS, Azure, and GCP**. Semgrep advises affected users to audit repos for injected files, rotate exposed credentials, and check whether their projects installed the compromised versions.

Build this article’s timeline

Extract dated events, key actors, and open questions using the same timeline analysis available in Signal.

Log in to build

Timeline generation is available to signed-in community members.

Five Ws 🤖 4 AI prefills · 1 still unanswered
Who
Semgrep, PyTorch, and Lightning AI
🤖 AI prefill
What
Semgrep reports that the PyPI package **lightning**—a widely used deep learning framework for training and inference—was compromised in versions **2.6.2** and **2.6.3** in a supply chain attack published on **April 30, 2026**.
🤖 AI prefill
When When did this happen, or what is the timeframe?
Where
RSA, Linux, and macOS
🤖 AI prefill
Why
Centers on PyPI package lightning, supply chain attack, and credential-stealing malware
🤖 AI prefill

Login to answer and earn XP for each gap you fill.

Supply Chain Malware PyPI, lightning, compromised, malicious code, import Credential Exfiltration credentials, tokens, secrets, environment variables, AWS Worm Propagation npm, publish credentials, setup.mjs, preinstall, republish Developer Tool Persistence Claude Code, VS Code, hooks, tasks.json, settings.json Detection and Remediation Semgrep, advisory, IOC, scan, rotate tokens
PyPI package lightning98% supply chain attack97% credential-stealing malware96% Mini Shai-Hulud campaign95% JavaScript payload92% module import90% GitHub commit search dead-drop89% cloud secrets88% Claude Code hook system87% VS Code tasks.json86%
41
Manipulation Score: Medium How much this article uses emotional framing vs. straight reporting
Loaded Language 2825%
Absolutist 3415%
Threat/Panic 7225%
Us vs Them 1815%
Engagement Bait 4620%
Manipulation score look right?

Factual Claims (10)

high technology
The PyPI package 'lightning' was compromised in versions 2.6.2 and 2.6.3.
high technology
The malicious code executes credential-stealing malware on import.
high technology
The attack steals credentials, authentication tokens, environment variables, and cloud secrets.
high technology
The malware also attempts to poison GitHub repositories.
high technology
Running 'pip install lightning' is enough to activate the malicious package.
high technology
The payload contains a hidden _runtime directory with obfuscated JavaScript that runs on module import.
high technology
The malware propagates through npm by injecting files and republishing packages if it finds npm publish credentials.
high technology
It targets AWS, Azure, and GCP secrets from local files, environment variables, CI/CD, and cloud metadata services.
high technology
The malware plants persistence hooks in Claude Code and VS Code settings inside infected repositories.
high technology
If the malware has a GitHub token with write access, it can push a malicious workflow that exfiltrates repository secrets.

Comments

Login to view and post comments.

🏠Portal 📰Links ❓Q&A 📅Events 💼Jobs