Armando found that mailreader v2.7.2, published to PyPI on December 1, 2026, carries the same hidden backdoor loader as the earlier v2.7.1, re-packed inside a new copy of the package's default.config file. The release adds an ordinary-looking feature -- a save_attachments() helper for writing mail attachments to disk -- while the payload continues to sit in a compressed pickle that the companion package confext unpickles as soon as mailreader is imported. The pickle decrypts its next stage only when a module from the requests library is already loaded, then installs a .pth startup hook that survives uninstallation and runs attacker-supplied code from a JSON bin on every Python start. mailreader has recorded 1,001 downloads across its two releases.
Key Findings
- Malicious version: v2.7.2, published 2026-12-01 08:26 UTC; mailreader has no clean release (v2.7.1 carries the same payload)
- Entry point: no install hook -- the payload runs when
mailreader is imported; mailreader/engine.py loads the bundled default.config through confext.config.load_config() at import time
- Targets: Linux, macOS and Windows developer machines; installs a persistent remote-code loader
- Evasion: payload stored as a binary pickle in a "config" file; next stage XOR-encrypted with a key derived at runtime from the name of a
requests sub-module; new legitimate-looking functionality added to the release; errors silently swallowed so the library keeps working
- Detection: Script-Python.Trojan.SupplyChain, Text.Trojan.SupplyChain, Archive-ZIP.Trojan.SupplyChain, Archive-GZIP.Trojan.SupplyChain, Archive-TAR.Trojan.SupplyChain
Package Background
mailreader describes itself as "sanitized HTML mail parsing built on the confext HTML parser." It was first published on November 10, 2026 by the PyPI account nigarash, which owns no other packages, and it declares no source code repository. Its only dependency is confext, a single-package project from a different account that provides the configuration loader mailreader relies on. Across both releases the package has 1,001 recorded downloads.
v2.7.2 is the package's second and latest release. For anyone who already looked at v2.7.1 and saw nothing suspicious in its Python source, an update three weeks later that adds a feature looks like normal maintenance -- and it is the version pip install mailreader resolves to today.
Attack Analysis
What changed. Compared with v2.7.1, v2.7.2 changes three files in the mailreader module. htmlmail.py gains a save_attachments() function and __init__.py exports it. The third change is default.config: a new 5,722-byte file whose pickle is re-encoded (12,047 bytes) but, once decrypted, delivers exactly the same next stage as v2.7.1. The loader path in engine.py is unchanged. In other words, the release refreshes the cover story and re-packs the payload; it does not change what the payload does.
Import-time execution through a companion loader. mailreader/engine.py calls _ensure() at module level, which calls confext.config.load_config() without a path. confext locates the caller's default.config, checks a short checksum header, zlib-decompresses it and passes it to pickle.loads, checking that the result is a dictionary only afterwards. The pickle's one meaningful instruction calls builtins.eval on a multiply base64-wrapped string that runs the malicious code and then returns a normal settings dictionary, so mailreader keeps working.
Developer gating. The evaluated code carries an XOR-encrypted blob with no key. It hashes every loaded module name (doubled) with MD5 and looks for a hard-coded digest; the matching name is requests.packages.urllib3.util.connection, which only exists once requests has been imported. That name, plus one derived byte, is the decryption key. A sandbox that imports mailreader alone never produces the key and sees nothing; an application or developer session that already uses requests does.
Persistence and remote code. The decrypted stage writes a py_log2 package (an __init__.py launcher and a __cached__.py stager) and a py_abi2-log.pth startup file into the user site-packages directory. The .pth file makes Python import py_log2 on every interpreter start, and because neither file belongs to an installed distribution, pip uninstall leaves both in place. The launcher holds an exclusive lock on /tmp/pylog.txt (%TEMP%\pylog.txt on Windows) and starts the stager detached and without a window. The stager fetches https://api.npoint.io/df37d3253fff53e2034f/login, base64-decodes the response and executes it -- from an in-memory copy of the interpreter created with memfd_create on Linux, via a short-lived ~/pip3-update.py that is overwritten with a decoy pip-upgrade script on macOS, and in-process on Windows. The second stage is whatever the operator places in that JSON bin.
Malicious Files
default.config (Script-Python.Trojan.SupplyChain) is the payload. It carries the same environment-keyed pickle loader as v2.7.1, with an identical decrypted stage: builtins.eval runs an XOR stage keyed on requests.packages.urllib3.util.connection, which writes the py_abi2-log.pth persistence that fetches and executes code from the npoint JSON bin.
engine.py (Script-Python.Trojan.SupplyChain) is the import-time trigger: imported by mailreader/__init__.py, it runs _ensure() at module level, which calls confext's load_config() and unpickles the package's malicious default.config.
METADATA (Text.Trojan.SupplyChain) and pyproject.toml (Text.Trojan.SupplyChain) are the manifests that ship the malicious content and declare the confext dependency that provides the unpickling loader.
Recommendations
Developers and security teams should take the following steps:
- Identify exposure: Check whether mailreader v2.7.2 (or v2.7.1) appears in your dependency tree, including transitive dependencies. Any environment that imported it in a process where
requests was loaded should be considered compromised.
- Remove the package and its loader: Uninstall mailreader and confext. There is no clean mailreader release.
- Remove the persistence manually: Delete
py_abi2-log.pth and the py_log2/ directory from the user site-packages directory (the interpreter's site-packages on Windows), plus ~/pip3-update.py and /tmp/pylog.txt or %TEMP%\pylog.txt if present. Uninstalling the package does not remove them.
- Inspect affected systems: Look for outbound requests to
api.npoint.io, Python processes running from /proc/self/fd/ paths on Linux, and unexpected detached Python processes. Rotate credentials available to the affected user, since the second stage is operator-controlled.
- Scan your software supply chain: Use Spectra Assure Community to check whether packages in your environment have been flagged.
Indicators of Compromise
Malicious Files
| Filename | SHA256 | Detection |
|---|
| default.config | e4b0d89ca7fd8dfdd151f418d12589eedebca4eb6ddd9438fc14629eab7065b5 | Script-Python.Trojan.SupplyChain |
| engine.py | f562f0c46a46c1009fef5ca77c7650971b2570daa75b09296e91f330ef5fcc12 | Script-Python.Trojan.SupplyChain |
| METADATA | d0c086bb12b12ff795d2593ebc4d84c5f01d870fc71caa0e719e1bec237ed39b | Text.Trojan.SupplyChain |
| pyproject.toml | ce3ea662d12ccffd44cb2c6a8bdbf8ca4fabecf974b48d9e5061b46dfae12dcb | Text.Trojan.SupplyChain |
Network IOCs
| URL / IP | Purpose |
|---|
| https://api.npoint.io/df37d3253fff53e2034f/login | Second-stage source; the persistent stager downloads base64-encoded Python from this JSON bin and executes it on every Python start |
Archive Hashes
| File | SHA256 |
|---|
| mailreader-2.7.2-py3-none-any.whl | 6ea38ee8637d3912f381b7a53b7f95eac952bba23a2228f32f4f6e6d582b7391 |
| mailreader-2.7.2.tar.gz | ec5a5c36c9b59c3a8774c72e4d64eb9cf2da4f7cdcd81453b1d6954ba3504808 |
| mailreader-2.7.2.tar | 5b78e126ce3d55c3c05049d913d1a0434cd5a68d4c7ff8f18fb3ad16ea5cc043 |