T09 · Insecure Skill Coding Practices
- Location
package.json:14- Finding
Recursive npm Install Lifecycle Can Cause Resource Exhaustion
- Content
View full analysis
Vulnerability Details
File Location:
package.json:14-16
Vulnerability Type: Recursive package-manager lifecycle execution
Risk Level: MediumVulnerable Code:
json "scripts": { "install": "npm install" },Technical Analysis
npm automatically executes the
installlifecycle script during package installation. This project defines that lifecycle script as another invocation ofnpm install.Consequently, the initial installation can start a child npm process, which processes the same package and can invoke the same lifecycle script again. This creates an unbounded recursive installation chain rather than performing a finite setup operation.
The behavior is especially hazardous in automated environments where installation is performed without interactive supervision and where process, memory, or execution-time limits are not tightly configured.
Attack Path
- A user or CI job follows the documented installation process and runs
npm install. - npm resolves the dependencies and reaches the package's
installlifecycle stage. - The lifecycle script launches another
npm installprocess. - The child npm process processes the same lifecycle configuration.
- Additional npm processes may continue to be created until the installation fails or the operating system, container, or CI runner exhausts a resource limit.
No external attacker input is required. Triggering the documented installation operation is sufficient.
Impact Assessment
This issue does not grant additional privileges. Every child process runs with the same operating-system privileges as the user or service account that initiated npm.
Potential consequences include:
- CPU, memory, process-table, or disk exhaustion.
- Denial of service on developer workstations or shared CI runners.
- Installation timeouts and failed deployments.
- Creation of orphaned or lingering npm processes.
- Consumption ...[truncated 142 chars]
- A user or CI job follows the documented installation process and runs
- Remediation
View remediation
Remediation Suggestions
-
Remove the recursive lifecycle script entirely:
json "scripts": {} -
If explicit setup is required, implement it as a finite script under a non-lifecycle command:
json "scripts": { "setup": "node scripts/setup.js" } -
Ensure setup scripts perform only bounded, idempotent operations and never invoke
npm installrecursively. -
Update
SKILL.mdto document the corrected installation process. -
Add a CI installation test with process and execution-time limits to detect recursive lifecycle behavior.
-
