Malicious code in requests-middleware (npm)
Description
The npm package 'requests-middleware' version 1.0.2 is a malicious typosquat of the legacy 'request' HTTP library. It contains a dropper that silently spawns a detached child process which fetches and executes attacker-controlled JavaScript code from a remote paste hosting service. This remote code execution occurs whenever the package's default middleware function is invoked, granting full require access to the attacker-controlled code within the consumer process.
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
The 'requests-middleware' npm package (version 1.0.2) masquerades as a legitimate HTTP library by copying the original project's README, dependencies, and source files but includes a malicious dropper. Its exported middleware function detaches and silently runs a child process that fetches JavaScript payloads from 'https://www.jsonkeeper.com/b/YL7GN', extracting the payload from the HTTP response's Cookie field. This payload is evaluated with full require access, allowing arbitrary remote code execution. The remote URL is disguised as a fake environment variable to evade detection. Because the payload is hosted on an anonymous, mutable paste service, the executed code can change at any time without updating the package.
Potential Impact
Any application importing and invoking the 'requests-middleware' package's default middleware function will execute attacker-controlled JavaScript code with full require privileges. This can lead to arbitrary code execution within the application context, potentially compromising the host system and data confidentiality, integrity, and availability.
Mitigation Recommendations
No official patch or remediation is currently available for this malicious package. Users should immediately remove 'requests-middleware' version 1.0.2 from their dependencies and avoid installing similarly named typosquat packages. Verify package authenticity before installation and rely on official, well-maintained libraries. Monitor for updates from the package registry or security advisories for further guidance.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-6096
- Osv Schema Version
- 1.7.4
- Aliases
- ["GHSA-mxgq-rcpv-wrm9"]
- Ecosystems
- ["npm"]
Threat ID: 6a96f317acd9273b49e4947e
Added to database: 09/01/2026, 15:45:27 UTC
Last enriched: 09/08/2026, 12:41:01 UTC
Last updated: 10/01/2026, 22:41:09 UTC
Views: 26
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.