A malware campaign on the Python Package Index (PyPI) keeps its payload locked until it reaches a real developer environment, evading scanners and sandboxes that check packages in isolation.
Security firm Island detailed the software supply chain campaign in research published on December 2, calling the technique "DevGating".
It said the activity had run since September 25 in four waves of eight packages, four of them previously unreported.
How DevGating Slips Past Package Checks
The malicious packages were working Python utilities, one of them a mail parser. Each wave divided the harmful code between two packages from separate accounts, so neither showed the full chain when checked alone.
The payload was encrypted, and its key was a module name taken from the victim's running Python process. A sandbox importing the package by itself never had that module loaded and saw nothing, while a real project usually would.
Island said keying malware to its environment was not new, but it had not seen the key drawn from code the victim had already loaded. It counted eight evasion layers, aimed at controls ranging from code review and functional testing to sandboxing, endpoint scanning and domain reputation.
The operator published an updated version of one package on December 1, adding features but keeping the malicious chain. Each package had at most a few hundred downloads as of November 16, and Island said it did not know who installed the latest pair or whether any of those installs ran with the triggering module loaded.
Persistence Survives Package Removal
Once run, the chain planted a Python startup hook that survived uninstalling the package. On Linux it could run Python from memory, and it fetched later code from a developer web service the operator could edit at will.
The current payload was a harmless placeholder, though an earlier wave delivered a remote access trojan (RAT). The firm said the hook could reach later processes using the same Python installation, including continuous integration jobs and other services with access to source code and cloud secrets.
Island urged defenders to review new packages alongside the dependencies they pull in and to treat bundled pickle files and compiled modules in small utilities as code. It also advised watching for unexpected Python startup files and interpreters launched from memory.
The firm warned that a package passing a test in isolation proved less than it seemed, and recommended running tests with common libraries already loaded.
Island security researcher Ofek Ronen told Infosecurity on December 2 that the packages were still available on PyPI, and that Island had reported all those still listed the day before without hearing back.