T08 · Insecure Dependencies
- Location
SKILL.md:47- Finding
Unpinned npm Package Execution Through npx
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 47
Vulnerability Type: Unpinned third-party dependency execution
Risk Level: MediumVulnerable Code
powershell cd <product-images-dir>; npx http-server -p 8765 --cors -c-1Technical Analysis
The documented workflow instructs the agent to execute
http-serverthroughnpxwithout specifying an exact package version or requiring an existing reviewed local installation. When the package is unavailable locally,npxmay retrieve and execute the registry's currently resolved version.Consequently, the code that runs is not fully determined by the reviewed project. A compromised npm package, maintainer account, registry response, or transitive dependency could introduce executable code after the Skill itself has been audited.
The
--corsoption also makes resources served by this process readable by arbitrary web origins. This can unnecessarily expose files under the selected document root while the server is active. The server is described as local, but the command does not explicitly bind it to the loopback interface.Attack Path
- An agent follows the workflow in
SKILL.md. - The agent runs the documented
npx http-servercommand. - If no suitable local package is present,
npxresolves the package through the configured npm registry. - An attacker who has compromised the package, its maintainer, the registry configuration, or a dependency causes malicious installation or runtime code to be delivered.
- The downloaded code executes with the privileges and environment access of the user running the agent.
- The malicious process can access resources available to that user, including project files and potentially environment variables or credentials.
- Separately, broad CORS and failure to specify a loopback bind address may expose locally served files beyond what screenshot generation requires, depending on
http-serverdefaults and host firewall/net ...[truncated 625 chars]
- An agent follows the workflow in
- Remediation
View remediation
Remediation Suggestions
- Add an audited dependency manifest and lockfile to the project, pinning
http-serverand all transitive dependencies to reviewed versions. - Perform dependency installation as an explicit, reviewable setup operation rather than allowing runtime retrieval.
- During normal operation, use
npx --no-install http-server ...so execution fails instead of downloading an unavailable package. - If runtime invocation is unavoidable, specify an exact version rather than a floating package name, although a committed lockfile and reviewed installation remain preferable.
- Verify package integrity and provenance, retain the lockfile in version control, and use dependency vulnerability and integrity scanning.
- Prefer a built-in or already trusted local HTTP server that does not require downloading executable code.
- Explicitly bind the server to
127.0.0.1. - Remove
--corsunless cross-origin access is demonstrably necessary. If it is necessary, restrict allowed origins rather than permitting all origins. - Serve a dedicated directory containing only generated image assets, not a broader project or user directory.
- Terminate the server immediately after screenshots are generated.
A hardened invocation, after a reviewed installation, would follow this pattern:
powershell cd <product-images-dir> npx --no-install http-server -a 127.0.0.1 -p 8765 -c-1- Add an audited dependency manifest and lockfile to the project, pinning
