Malicious code in py-1requests (PyPI)
Description
The py-1requests package is a malicious typosquat of the popular Python requests library. On import, it collects environment variables with names starting with SECRET, API, TOKEN, or KEY and exfiltrates them via a TCP connection to a configurable host and port, defaulting to localhost:9999. It also establishes a reverse-shell staging connection. These actions occur unconditionally upon import with no legitimate purpose. The exfiltration target being localhost suggests this may be a test or pentest tool rather than widespread malicious use.
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
py-1requests is a typosquatting package on PyPI designed to mimic the legitimate requests library but contains malicious code. Its __init__.py script iterates over environment variables to collect sensitive data (variables starting with SECRET, API, TOKEN, or KEY) and sends this data serialized over a TCP socket to a host and port defined by environment variables or defaulting to 127.0.0.1:9999. Additionally, it spawns a subprocess that connects to the same host and port, sending a 'SHELL' marker to hold the connection open, effectively creating a reverse-shell staging path. These behaviors trigger immediately upon import without user interaction. The package prints messages admitting its typosquatting and exfiltration purpose. Analysis indicates the exfiltration target is localhost, implying this is likely a pentest or research tool with low harm potential rather than an active widespread threat.
Potential Impact
If imported in an environment containing sensitive environment variables, py-1requests would exfiltrate those variables to a TCP endpoint, potentially exposing secrets such as API keys or tokens. The reverse-shell staging connection could allow remote command execution if the attacker controls the listening endpoint. However, the default exfiltration target is localhost, limiting the impact unless the environment variables TS_HOST and TS_PORT are set to external hosts. There are no known exploits in the wild and the package appears to be designed for pentesting or research purposes.
Mitigation Recommendations
Avoid installing or importing the py-1requests package. Remove it if found in your environment. Since this is a malicious typosquat package, ensure package names are carefully verified before installation. No official patch or fix exists because this is a malicious package rather than a vulnerability in legitimate software. Monitor for and block connections to unexpected localhost ports if suspicious. No further action is required if the package is not present.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-15861
- Osv Schema Version
- 1.7.4
- Ecosystems
- ["PyPI"]
Threat ID: 6a9ad4f4acd9273b49b6798b
Added to database: 09/04/2026, 14:25:56 UTC
Last enriched: 09/07/2026, 16:08:45 UTC
Last updated: 10/03/2026, 12:36:06 UTC
Views: 29
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.