Static scanning becomes unreliable because the package can appear empty or low risk while still executing commands during installation. Security teams need to treat package manifests as executable surfaces and inspect lifecycle hooks, not just source files, or malicious dependencies will slip past controls that assume code is the only thing that matters.
Why package.json Is Part of the Attack Surface
When payloads move into package.json, the trust model changes: the manifest is no longer just metadata, it can influence installation behaviour, dependency resolution, and lifecycle execution. That matters because many controls still assume executable risk lives in JavaScript source, while package managers can run preinstall, install, and postinstall hooks before a human ever inspects the code.
The practical consequence is that a benign-looking package can carry operational behaviour that only appears during install time. Security review has to include the manifest, script fields, and dependency graph together, because a package can look small, sparse, or empty and still trigger commands that fetch content, drop files, or call out to external infrastructure.
That shift also changes what “static scanning” means. A scanner that only parses JavaScript will miss payloads encoded as lifecycle actions, nested metadata, or indirection through scripts and dependencies. For defenders, the real object under review is the whole installable artifact, not just the source tree.
What Breaks in Static Analysis and Allowlisting
Manifest-hiding breaks assumptions in software composition analysis, malware scanning, and package allowlisting. If a control judges risk by source-file inspection alone, it can under-classify a malicious dependency as low risk because the visible application logic is minimal or absent.
It also weakens rules that rely on path-based review, file-type filters, or “no suspicious code found” verdicts. In a package ecosystem, the important behaviour may be expressed as install hooks, scripts, or metadata-driven actions that execute before the application’s own JavaScript is loaded. That means reviewers need to evaluate the package lifecycle, not just the runtime code path.
This is why supply-chain attacks keep succeeding through package registries: the attacker is not always trying to hide complex malware, only enough automation to make the package useful once installed. Once that happens, the initial trust decision has already been made.
How Defenders Should Reframe Package Review
Teams should treat package manifests as executable surfaces and inspect them with the same suspicion they apply to code that runs at build or install time. That includes reviewing script fields, installation hooks, unusual dependency changes, and packages that declare very little logic but still demand broad access during setup.
In practice, the question is not “does this package contain obvious JavaScript malware?” but “what will execute when this package is installed, built, or updated?” That distinction matters because the malicious behaviour may never exist in a source file that a standard code review is likely to open first.
Reviewing manifests also helps defenders catch patterns such as dependency confusion, typosquatting, and repackaged legitimate libraries with altered install behaviour. Those cases often evade shallow controls because the package name, README, or visible code looks credible while the install path does the damage.
Risk and Threat Considerations
This technique is attractive because it exploits a blind spot in review workflows: teams often inspect application code more carefully than they inspect package metadata and lifecycle scripts. That creates a reliable path for credential theft, data exfiltration, and secondary malware delivery during installation.
Failure mechanism: The attacker places malicious behaviour in manifest-driven hooks or metadata so it executes before source-level controls, sandbox assumptions, or human review notice that anything dangerous is present.
Impact: The package can gain execution on developer endpoints or build systems, steal secrets, poison downstream builds, or persist through trusted dependency updates while appearing low risk to controls that only score visible code.
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 and MITRE ATT&CK address the attack and risk surface, while CIS Controls v8, OWASP ASVS and SLSA set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | Manifest-hiding package attacks often aim to exfiltrate secrets during install. |
| NHI-07 — Long-Lived Secrets | Malicious install scripts frequently target stored tokens and keys in developer environments. | |
| NHI-05 — Overprivileged NHI | Packages that execute during install can abuse excessive token or build permissions. | |
| Recommendation — Inspect package install paths for secret-exfiltration behaviour and rotate exposed credentials quickly. Reduce the lifetime and reuse of developer and build secrets to limit package compromise blast radius. Constrain package and build identities to least privilege so install-time code cannot reach broad resources. | ||
| MITRE ATT&CK | T1195 — Supply Chain Compromise | Hiding payloads in package metadata is a supply-chain compromise pattern. |
| T1059 — Command and Scripting Interpreter | Package scripts execute commands during installation through interpreter paths. | |
| Recommendation — Map package metadata abuse to supply-chain compromise and hunt for trojanised dependency updates. Monitor package install events for unexpected interpreter use and command execution. | ||
| CIS Controls v8 | CIS-16 — Application Software Security | Package manifest review and dependency vetting are core application security safeguards. |
| Recommendation — Extend application security review to package manifests, hooks, and dependency provenance. | ||
| OWASP ASVS | V15 — Secure Architecture | The issue is architectural: executable behaviour exists outside source files in package metadata. |
| Recommendation — Design build and install workflows to treat package metadata as executable input. | ||
| SLSA | Supply Chain Levels for Software Artifacts | The attack depends on weakening artifact and dependency trust in the software supply chain. |
| Recommendation — Apply provenance and dependency controls that verify what was published, not just what the package name suggests. | ||
Practitioner Guidance
What to verify: Confirm that package review includes package.json script fields, install-time hooks, and dependency diffs, not just source scanning. If a package declares little or no application logic but still runs commands during install, treat that as a review trigger rather than a convenience feature.
Decision rule: If the manifest can cause execution, classify it as part of the trusted computing base for that package. If your pipeline cannot inspect or constrain that behaviour, reduce trust in the package or gate it behind stronger sandboxing and approval.
Practitioner takeaway: The main mistake is assuming executable risk only lives in visible JavaScript; in npm ecosystems, the manifest itself can be the delivery mechanism, so defenders need lifecycle-aware controls, not source-only inspection.
Related resources from NHI Mgmt Group
- What breaks when npm packages execute code through binding.gyp instead of package.json scripts?
- How should teams reduce risk from malicious npm package installs?
- What breaks when malicious npm packages execute on import instead of install?
- What breaks when npm packages hide malicious logic until runtime?
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 October 13, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org