ShieldPack SHIELD PACK
From 1401 onwards.

Where would you like to start?

Services, updates, and ways to contact us, all in one place

Pricing and orders →

Use the bot or chat with us—whichever you prefer

ShieldPack posts

8 Malicious PyPI Packages Use Python Dependencies as Keys to Unlock Hidden Malware

About 6 min read

Researchers have uncovered an active and evolving supply‑chain attack that targets the Python Package Index (PyPI) by using a novel technique called DevGating. The method relies on the victim’s own loaded Python dependencies to act as a decryption key, allowing malicious code to remain hidden until it is executed in a real development environment.
The campaign began on 25 September 2026 and has progressed through four distinct waves, delivering eight malicious packages in total. Each wave shows increasingly sophisticated evasion tactics. A version released earlier this month added legitimate functionality to the front‑end package while preserving the hidden malicious payload, demonstrating the attackers’ ability to blend benign features with covert behavior.
DevGating’s core innovation is the use of a module name from the victim’s environment as the source of the decryption key. Specifically, the malware looks for a module that is loaded alongside the popular requests library—namely requests.packages.urllib3.util.connection—and uses that name to derive the key needed to unlock the payload. While keying a payload to the environment is not new, using the victim’s own dependencies in this way has not been documented before.
The payload is split across two separate PyPI packages that are published from different accounts, a design that defeats scanners that analyze each package in isolation. The front‑end package, named mailreader, provides a functional mail‑parsing library that passes code‑review and typosquat checks. Inside mailreader a pickle file masquerading as a configuration file called default.config contains the malicious data. The companion package, confext, contains the code that unpickles the data when it is imported. Only when both packages are present does the full malicious chain become active.
Because each package appears benign on its own, static analysis tools that examine mailreader alone see only a harmless configuration call, while tools that examine confext alone see a generic configuration parser. Neither package, in isolation, reveals the complete attack. Removing one package does not neutralize the threat, as the remaining package can later pair with a new front‑end component to reconstitute the malicious behavior.
The malware remains dormant until it detects that the Python process has already loaded a specific dependency associated with requests. In a typical developer workflow, a backend application may import requests first and then import mailreader. This sequence triggers the decryption routine, causing the hidden payload to be unlocked and executed. Scanners that test mailreader in isolation never load requests, so they incorrectly conclude the package is safe.
Once activated, the malware establishes persistence by creating a .pth file that is automatically executed every time the Python interpreter starts. This persistence mechanism works even if the original package is uninstalled, because the .pth file remains on the system. The malicious code then fetches additional instructions from npoint.io, a one‑way JSON store that the attacker can modify at any time, and runs the retrieved code directly from memory on Linux systems. An earlier wave of the campaign delivered a remote‑access trojan, indicating that the attackers can adapt the payload to different objectives.
The four waves of the campaign are identified as follows: the first wave used the package pair webreader and pafer; the second wave employed resion and pafex; the third wave introduced colook and basic‑crypt; and the latest wave consists of mailreader and confext. Notably, the colook package implements DevGating by checking for a different module— requests.packages.urllib3.util.request—demonstrating the attackers’ willingness to vary the key‑derivation logic to evade detection.
8 Malicious PyPI Packages Use Python Dependencies as Keys to Unlock Hidden Malware
Security researchers at Island describe DevGating as exposing a gap between how automated security tools analyze packages and how developers actually use them. A package can pass static analysis, sandbox detonation, and functional testing, yet still execute malicious code when imported alongside other legitimate dependencies in a real project. This gap underscores the need for supply‑chain defenses that consider runtime interactions rather than isolated package inspection.
The attackers’ lure strategy relies on small, generic developer utilities such as web readers, mail parsers, or terminal‑color libraries. None of the malicious packages imitate well‑known projects, which means they are likely to be selected by developers searching PyPI for a quick helper. The low profile of these utilities increases the chance of accidental installation and subsequent compromise.
In parallel, Aqua security has disclosed a Linux eBPF rootkit named GhostMap that is being distributed via an evolved variant of the Shai‑Hulud worm, dubbed IronWorm. GhostMap shares implementation overlap with another rootkit used in a June 2026 campaign called Atomic Arch, which compromised hundreds of orphaned packages in the Arch User Repository (AUR) to deliver a stealer and wallet‑draining malware. GhostMap operates by manipulating kernel data on the fly, effectively blinding user‑space applications to malicious processes, files, and network sockets.
Recent weeks have also seen unknown threat actors exploiting stolen GitHub tokens to inject a credential stealer into tens of thousands of repositories. The campaign began on 10 November 2026 and aims to exfiltrate GitHub Actions secrets and cloud credentials. At least 1,806 repositories have been assessed as impacted, and more than 8,000 repositories received malicious commits between 10 November at 12:46 p.m. and 12 November at 4:35 a.m. UTC. The malicious activity has spread beyond GitHub to at least one Packagist repository and one Golang package through automated publishing triggers.
The stealer is designed to run a single time, either via a GitHub Actions workflow or during an npm install using a post‑install hook. It captures repository secrets and cloud credentials, then transmits the data to external servers. Attackers open pull requests titled “docs: dependency audit notes” from a branch named wfx‑docs. According to Aikido, 4,837 compromised accounts have opened probe pull requests across 61,764 repositories. The pull request first tests whether the token can write to the repository; if successful, the stealer is dropped in one of three possible ways. In most cases the attacker reverts the commit after the drop, leaving the branch looking clean.
Exfiltrated data is sent to the IP addresses 194.150.166.244 or 18.143.168.96 via HTTP POST requests. The stolen credentials are then used to obtain deeper access to cloud platforms such as AWS, Google Cloud, and Microsoft Azure by minting new access keys and federated credentials that can outlast the initial run. While the identity of the threat actors remains unknown, the modus operandi shares overlap with a campaign known as GhostAction, which injects rogue secret‑scanning workflows disguised as security audits and also deploys a stealer.
These coordinated supply‑chain attacks illustrate the expanding attack surface of open‑source ecosystems. Developers and security teams should treat package provenance as a critical factor, monitor for unexpected .pth files, and employ runtime monitoring that can detect abnormal dependency loading patterns. Enhanced scanning that simulates realistic import sequences, combined with vigilant credential management and rapid revocation of compromised tokens, will be essential to mitigate the risk posed by techniques such as DevGating and the associated credential‑stealing campaigns.

Source: The Hacker News · Cybersecurity

ShieldPack media