Malicious packages can run before review, harvest tokens from the local environment, and create persistence through repositories or automation paths. The break point is not just endpoint compromise. It is the collapse of trust between dependency installation and identity governance, because secrets become reachable during package acceptance rather than after deployment.
Why This Matters for Security Teams
When a package manager executes installation-time code by default, dependency intake stops being a passive software supply chain step and becomes an identity event. That matters because install scripts can read environment variables, touch local credentials stores, and reach cloud metadata or developer tooling before any review process begins. The risk is not limited to malware in the package itself. It is the speed at which a trusted workflow becomes an untrusted execution path.
NIST SP 800-53 Rev. 5 treats software and access governance as linked concerns, but many build systems still separate them operationally. In practice, that gap is where secrets leak. Recent NHIMG research on the LiteLLM PyPI package breach and the Shai Hulud npm malware campaign shows how quickly dependency installation can become secret harvesting and downstream persistence.
In practice, many security teams discover the problem only after a package install has already read tokens, written backdoor logic, or triggered an automated publish path.
How It Works in Practice
The failure mode is straightforward: a package with a malicious install script runs with the same privileges as the build agent, developer shell, or automation runner that invoked it. If that environment contains cloud credentials, signing keys, CI tokens, or repository secrets, the package can exfiltrate them immediately. If it can reach adjacent tooling, it may also modify pipeline config, implant persistence, or tamper with release artifacts.
From an NHI governance perspective, this is a boundary collapse. Secrets are no longer protected by a deployment stage or a human review gate because they are reachable during package acceptance. Current guidance suggests treating package installation as a privileged execution event, not a file download. That means combining controls such as allowlisted registries, script execution restrictions, ephemeral build identities, and per-job secret injection. NIST SP 800-53 Rev. 5 and NIST SP 800-53 Rev. 5 Security and Privacy Controls both support least privilege and controlled execution, but the implementation must be adapted for dependency workflows.
- Disable or review install scripts for untrusted packages wherever the platform permits.
- Use short-lived, job-scoped tokens instead of long-lived developer secrets.
- Expose only the minimum secrets required for the task, and inject them after provenance checks.
- Separate package resolution, build, and publish permissions so one compromise cannot chain into release access.
NHIMG guidance on NHI exposure shows why this matters at scale: secrets and non-human identities are frequently overexposed, and package install time is exactly when that exposure becomes exploitable. These controls tend to break down in high-churn CI/CD environments where teams rely on broad ambient credentials and cannot safely distinguish trusted from untrusted install steps.
Common Variations and Edge Cases
Tighter install-time controls often increase build friction, requiring organisations to balance developer velocity against attack containment. That tradeoff is real, and best practice is still evolving for ecosystems that rely heavily on lifecycle scripts or native build hooks.
One common edge case is internal packages that are treated as trusted by policy but are actually maintained by mixed-trust teams or mirrored from external sources. Another is language ecosystems where disabling scripts breaks legitimate compilation or packaging behavior. In those environments, the safer pattern is not blanket trust, but context-aware gating: verify publisher provenance, pin digests, run untrusted builds in isolated sandboxes, and keep secrets out of the install context entirely.
There is no universal standard for this yet, but OWASP and NIST-aligned guidance points in the same direction: assume package installation can execute adversarial code unless the control plane proves otherwise. That is especially important in multi-agent or automated developer environments, where one compromised install can feed credentials into later workflow steps with no human noticing. The practical rule is simple: if code can run during install, it can also reach anything the installer can reach, unless identity and secret scope are deliberately constrained.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10, OWASP Agentic AI Top 10 and CSA MAESTRO address the attack and risk surface, while NIST AI RMF and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-01 | Install-time code can reach exposed non-human identities and secrets. |
| OWASP Agentic AI Top 10 | A-03 | Autonomous execution paths can chain install scripts into broader compromise. |
| CSA MAESTRO | R1 | MAESTRO addresses trust boundaries for agentic and automated execution paths. |
| NIST AI RMF | AI RMF helps govern autonomous workflow risk and accountability. | |
| NIST CSF 2.0 | PR.AC-6 | Least privilege is central when installers can run arbitrary code. |
Apply AI RMF governance to constrain automated runners and document control ownership for install-time execution.
Related resources from NHI Mgmt Group
- What breaks when npm package installs are allowed to execute code before inspection?
- How should teams reduce risk from malicious npm package installs?
- What breaks when a malicious package can use a GitHub token to exfiltrate files?
- What breaks when malicious npm packages execute during CI/CD installs?
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on August 2, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org