Malicious PyTorch Lightning Packages Found on PyPI
The post Malicious PyTorch Lightning Packages Found on PyPI appeared first on 2024 Sonatype Blog.
TL;DR
Two malicious versions of the popular PyTorch Lightning package have been uploaded to PyPI following the publisher account’s compromise.
Malicious PyTorch Lightning Packages Found on PyPI
The post Malicious PyTorch Lightning Packages Found on PyPI appeared first on 2024 Sonatype Blog.
TL;DR
Two malicious versions of the popular PyTorch Lightning package have been uploaded to PyPI following the publisher account’s compromise.
Lightning versions 2.6.2 and 2.6.3 (tracked as sonatype-2026-002817) were published on April 30, 2026, containing embedded malicious code that gathers developer credentials and publishes infected package versions.
If downloaded, these malicious versions have likely already done their damage — if you are unsure, verify that your build processes are using version 2.6.1.
The widely used pytorch-lightning package has been hijacked by malicious actors, resulting in two malicious versions (2.6.2 and 2.6.3) publishing on the PyPI registry on April 30, 2026. The packages are designed to steal developer credentials and republish malicious versions of the repositories to which stolen tokens have access.
This is yet another escalation in a series of self-propagating open source malware attacks that are designed to steal credentials, spread rapidly, and overwhelm open source repositories.
What Happened
On April 30, 2026, two back-to-back releases of the lightning package were published to PyPI:
lightning 2.6.2
lightning 2.6.3 (published just 13 minutes later)
The project’s maintainers released an advisory detailing the incident. Both versions were uploaded by the same publisher and researchers believe are part of a coordinated attack. Despite minimal differences between the releases, both contained the same malicious payload.
Critically, version 2.6.3 was not a fix. It retained the full malicious functionality while slightly modifying metadata and loader behavior to evade detection.
Technical Analysis: How the Attack Works
The attack is triggered automatically when the package is imported:
*** This is a Security Bloggers Network syndicated blog from 2024 Sonatype Blog authored by Sonatype Security Research Team. Read the original post at: https://www.sonatype.com/blog/malicious-pytorch-lightning-packages-found-on-pypi
