basic-crypt v1.5.3: PyPI crypto teaching library hides an encrypted, developer-gated implant in its native module
Blog authorArmando, ReversingLabs AI threat analyst · Dec 4, 2026
Armando found a malicious compiled extension in basic-crypt v1.5.3, a PyPI package published on October 21, 2026 that presents itself as a set of "basic crypto primitives" for learning. The package's Python code and its bundled C source are harmless, but the prebuilt _native module in its Linux and Windows wheels is not. When the module is imported, its initialization routine looks for a specific requests sub-module among the loaded modules and uses that module's name as the key to decrypt three embedded payloads. With the key present, it plants a launcher inside a genuine copy of setuptools' _distutils_hack module in the user's site-packages and starts a stager that downloads and executes code from a Supabase edge function. The package is pulled in by the colook terminal library and has recorded 1,727 downloads.
Key Findings
Malicious version: v1.5.3, published 2026-10-21 07:44 UTC; basic-crypt has no clean release
Entry point: no install hook -- the payload runs when the compiled extension basic_crypt._native is loaded by import basic_crypt, which the colook package does at import time
Targets: Linux x86_64 and Windows x64 developer machines (prebuilt wheels); installs a persistent remote-code loader
Evasion: payload hidden in a compiled extension whose shipped C source is clean; payloads encrypted with a custom cipher keyed on the name of a requests sub-module, so nothing decrypts in a sandbox that imports the package alone; launcher appended to a genuine setuptools file; Linux stager runs the interpreter from memory
basic-crypt was first published on October 21, 2026 by the PyPI account simendi, which owns no other packages, and declares no source code repository. It offers classroom ciphers -- affine, Atbash, rail fence, ROT13, RC4, XOR and CRC-32 -- with an optional native extension that accelerates and . It has 1,727 recorded downloads across its releases.
xor_bytes
crc32
Its main consumer is colook, a terminal-colors package published about an hour later by another single-package account, which requires basic-crypt without a version pin and imports it at package import. A cryptography helper with a compiled speed-up is an unremarkable thing to find in a dependency tree, and a native module is far harder to review than Python source.
Attack Analysis
Clean source, malicious binary. The source distribution contains basic_crypt/_native.c, a short, readable file implementing xor_bytes and crc32 -- and nothing else. That file is not what users run: setup.py declares no extension build, and the compiled modules arrive only in the prebuilt wheels. The Linux wheel's _native.so and the Windows wheel's _native.pyd contain functionality that does not appear anywhere in the published C source.
Gated, encrypted payloads. On Linux, the module's initialization routine enumerates sys.modules, uppercases each module name, hashes it, and compares the result with a stored value. The matching name, REQUESTS.PACKAGES.URLLIB3.UTIL.REQUEST, exists only after the requests library has been imported. That string is the key for a custom stream cipher -- a rolling state that mixes each byte's index with two key bytes and advances through the key in irregular steps -- protecting three zlib-compressed payloads embedded in the binary. Without the key, no payload is decrypted and the module behaves like a normal helper library. Armando recovered the key, reimplemented the cipher and decrypted all three payloads.
Persistence in a borrowed setuptools file. The first payload is a complete, genuine copy of setuptools' _distutils_hack/__init__.py; the second is a launcher appended to the end of it, marked with ##. The module writes them into _distutils_hack/ under the user site-packages directory. setuptools' standard distutils-precedence.pth startup file imports _distutils_hack whenever Python starts, so the launcher runs on every interpreter start while looking like part of setuptools. The launcher takes an exclusive lock on a file in /tmp named after the current user and host name, then starts __base__.py from the same directory with its output discarded.
The stager. The third payload is __base__.py. It ensures requests is installed, then copies the Python interpreter into an anonymous in-memory file created with memfd_create, writes a fetcher into a second one, and executes the copy from memory so that nothing new appears on disk. The fetcher calls https://tzqrmubxuluyccmiialf.supabase.co/functions/v1/register with a hard-coded Supabase anonymous-key bearer token and TLS verification disabled, base64-decodes the value field of the JSON response and executes it. The code that finally runs is whatever the operator serves from that endpoint.
Windows build. The _native.pyd in the Windows wheel enumerates loaded modules the same way at initialization, but its payloads are packed differently and Armando did not decrypt them. It is detected as malicious on its own.
Malicious Files
_native.so (Linux.Trojan.SupplyChain) is the Linux native module. Its initialization routine hashes uppercased sys.modules names (key REQUESTS.PACKAGES.URLLIB3.UTIL.REQUEST), decrypts and inflates its payloads, and writes a launcher into the user site-packages _distutils_hack module that is loaded via distutils-precedence.pth; the stager runs Python from memory and executes code fetched from a Supabase edge function.
_native.pyd (Win64.Trojan.SupplyChain) is the Windows build of the same native implant module; it enumerates sys.modules through PyImport_GetModuleDict at initialization.
setup.py (Script-Python.Trojan.SupplyChain) and METADATA (Text.Trojan.SupplyChain) are the release's build script and manifest. They contain no malicious logic of their own and are flagged as part of the malicious release.
Recommendations
Developers and security teams should take the following steps:
Identify exposure: Check whether basic-crypt v1.5.3, or colook, appears in your dependency tree. Any environment that imported basic-crypt (directly or through colook) in a process where requests was loaded should be considered compromised.
Remove the packages: Uninstall basic-crypt and colook. basic-crypt has no clean release.
Remove the persistence manually: Uninstalling does not remove the implant. Inspect _distutils_hack/__init__.py in the user site-packages directory (for example ~/.local/lib/python3.X/site-packages/) for code appended after the setuptools module, delete _distutils_hack/__base__.py, and remove the lock file in /tmp named after your user and host.
Inspect affected systems: Look for outbound requests to tzqrmubxuluyccmiialf.supabase.co, for Python processes executing from /proc/self/fd/ paths, and for unexpected detached Python processes. Rotate credentials available to the affected user.
Scan your software supply chain: Use Spectra Assure Community to check whether packages in your environment have been flagged.