Threat intel5 min read
Malicious PyPI packages stay locked until requests is loaded
Eight PyPI packages hide encrypted malware that only unlocks when the requests library is already loaded, so scanners that test them alone see nothing. Four are still listed.
4Tify Team

Eight packages published to the Python Package Index (PyPI) since 25 September 2026 carry malware that stays encrypted until it lands next to a real project. The key that unlocks it is the name of a module from the popular requests library. If requests is not already loaded, the code does nothing, which is how it gets past scanners that import a package on its own and watch what happens. The technique is called DevGating. Four of the packages were still listed on PyPI on 4 December.
What happened
The packages came out in four waves, each one a pair: a "front" package with a working feature and a helper that does the hidden work. The two halves of every pair were uploaded from different PyPI accounts, and each account published only that one project. Looked at alone, the front package only loads a config file, and the helper only contains a config parser.
The pairs, oldest first:
webreader2.3.8 withpafer0.9.7 and 0.9.8 (from 25 September)resion22.0.1 withpafex2.3 (20 October)colook1.1.3 withbasic-crypt1.5.2 and 1.5.3 (21 October)mailreader2.7.1 and 2.7.2 withconfext0.7.2 (27 October to 1 December)
The first two pairs are gone from PyPI and have malware entries in the OSV database. mailreader, confext, colook and basic-crypt were still available on 4 December. basic-crypt also has a newer version, 1.5.4, uploaded on 30 November, which no published analysis covers yet. Treat it as suspect.
Who is affected
Anyone who installed one of the eight packages, directly or as a dependency, on a developer laptop, a build runner or a server. Download counts were low, a few hundred at most per package by mid-November, and a download does not mean the malware ran. The front packages are small generic tools (a web reader, a mail parser, a terminal colour library) that someone might pick up from a quick PyPI search. None of them copies the name of a well-known project.
How it works
In the newest pair, mailreader ships a file called default.config. It is really a pickle, a Python serialisation format that can run code when it is loaded. confext provides the config loader that unpickles it. The decoded code is XOR-encrypted. To get the key, it looks through the modules Python has already loaded for requests.packages.urllib3.util.connection and builds the key from that name. The colook pair looks for requests.packages.urllib3.util.request instead.
A sandbox that installs and imports mailreader by itself never loads requests, so the payload stays locked and the package looks clean. A developer whose application imports requests first and then mailreader unlocks it without noticing.
Once it runs, the malware writes a .pth file into the Python install. Python executes .pth files at every start, so the code keeps running after pip uninstall. For mailreader the file is py_abi2-log.pth, which imports a module called py_log2. The colook variant hides its launcher in copies of setuptools' _distutils_hack package and distutils-precedence.pth. On Linux it starts Python from memory and pulls the next stage from a JSON bin on npoint.io, which the operator can change at any time. The macOS and Windows paths were read from the code but not run.
The bin currently serves a harmless placeholder, so the final payload for the latest wave is not known. An earlier wave delivered a remote access trojan. It is not confirmed whether any machine actually ran the latest chain.
What to do now
- Search lockfiles,
requirementsfiles, container images, CI caches and developer machines formailreader,confext,colook,basic-crypt,webreader,pafer,resionandpafex. Check every version ofbasic-crypt. - If you find one, removing the package is not enough. Look in each
site-packagesdirectory forpy_abi2-log.pth, apy_log2folder, the file/tmp/pylog.txt, and any_distutils_hackcopy ordistutils-precedence.pththat your setuptools install did not put there. - Treat an affected machine as compromised. Rebuild it, and rotate the tokens, SSH keys and cloud credentials it could reach, including CI secrets.
- Block build and production systems from reaching paste sites and hosted JSON stores such as npoint.io unless something there needs them.
- Pin dependencies with hashes, and check new packages before a developer or a coding agent adds them.
Import-time tests miss this kind of malware, because it waits for the right neighbours. Our AI-assisted code review reads a project's dependency tree and the code that runs at install and import time, and flags packages that load executable data from config files or drop startup hooks, before they reach a build.
