Dependency scanning usually reviews declared packages and known vulnerability data, not the code that runs during installation. Install-time malware can live in preinstall or postinstall hooks, native build steps, or bundled scripts that execute after the package is fetched. That means a clean manifest can still trigger malicious behaviour during install.
Why dependency scanning misses install-time malware
Dependency scanning is strongest at telling you what is declared, versioned, and already known to be vulnerable. It is much weaker at catching code that executes when a package is installed, because that behaviour can be hidden in lifecycle scripts, native build steps, or bundled helper code that never appears in the dependency manifest.
What scanning sees, and what it usually does not
Most dependency scanners inspect package metadata, lockfiles, and advisory databases. That works well for finding known vulnerable components, but install-time malware is a different problem: the malicious action happens when the package manager runs the package’s install path, not when the scanner reads its name and version.
This is why a package can look clean on paper and still behave maliciously during installation. The malicious code may only appear in preinstall or postinstall hooks, in build-time compilation logic, or in scripts that are fetched as part of the package and executed locally after download. Static package review alone does not prove that the install path is safe.
Why install-time behaviour is an inspection gap
The gap is partly architectural. Dependency scanning is usually a software composition analysis activity, so it focuses on dependency inventory and known advisories rather than runtime execution. If your control only answers “what package is this?” it will not answer “what does this package do when the installer runs it?”
That is also why install-time malware often survives until execution. A clean manifest, a trusted registry entry, and an apparently normal version number can all coexist with a script that steals tokens, alters build output, or stages a second payload during install. The risk is not just malicious code in the package, but malicious code in the package’s installation workflow.
For this reason, teams should treat install-time scripts as an execution boundary, not a clerical detail. The question is not whether the dependency exists, but whether the install mechanism is allowed to run code with network, filesystem, or credential access during the build or deployment process.
Risk and Threat Considerations
Install-time malware is attractive because it piggybacks on routine automation. Build agents, developer workstations, and CI jobs often install dependencies with broad filesystem and network access, so a malicious hook can steal secrets, tamper with build artefacts, or persist inside the pipeline before the package is ever used in production.
Failure mechanism: The scanner validates package identity and known vulnerability data, but does not observe the installer’s execution path, so malicious lifecycle scripts, native build steps, or bundled install logic can run unchecked.
Impact: An apparently safe dependency can become an initial foothold for secret theft, build compromise, or downstream supply-chain contamination, especially when install permissions are broader than the package truly needs.
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 addresses the attack and risk surface, while OWASP ASVS, CIS Controls v8 and SLSA set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V13 — Configuration | Install-time malware exploits build and install configuration choices. |
| Recommendation — Restrict package install scripts and harden build defaults to reduce unexpected execution. | ||
| CIS Controls v8 | CIS-7 — Continuous Vulnerability Management | Dependency scanning is a vulnerability-management activity that misses execution-stage abuse. |
| Recommendation — Pair dependency review with controls that limit untrusted code execution during install. | ||
| SLSA | Supply chain integrity | Install-time malware is a software supply-chain integrity problem in dependency pipelines. |
| Recommendation — Protect build inputs and require provenance checks before code can influence the build. | ||
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | Install-time malware can steal secrets during package installation in CI or dev environments. |
| Recommendation — Limit secrets exposure in install jobs and rotate any credentials that may have been reachable. | ||
Practitioner Guidance
What to verify: Check whether your dependency controls evaluate install scripts, not just package metadata. If the tool cannot inspect or constrain lifecycle execution, assume it will miss a class of install-time abuse even when its vulnerability coverage is strong.
Decision rule: If a package manager supports script suppression, approval lists, or install-time policy controls, enable them for untrusted or newly introduced dependencies. If the build depends on scripts, treat that dependency as higher risk and require explicit justification for the execution path.
What practitioners underestimate: The main issue is not only malicious code in third-party packages, it is the combination of package trust and install-time privilege. The safer design is to reduce the amount of code that runs during install and to review anything that must execute with the same seriousness as application code.
Practitioner takeaway: Dependency scanning is a visibility control, not an execution control, so it must be paired with install-script governance and build-time restrictions if you want to catch malicious behaviour that only appears after package fetch.
Related resources from NHI Mgmt Group
- What breaks when install-time scripts are allowed in dependency pipelines?
- Who is accountable when install-time malware exposes cloud or publishing secrets?
- What fails when install-time scanning is the only control for malicious npm packages?
- How do security teams know if secret scanning and install-time controls are actually reducing supply chain risk?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org