T08 · Insecure Dependencies
- Location
commands.md:33- Finding
Unpinned npx Package Execution Exposes the Host to Supply-Chain Compromise
- Content
View full analysis
Vulnerability Details
File Location:
commands.md, lines 33 and 110-111; related warning at line 144
Vulnerability Type: Execution of unpinned third-party packages throughnpx
Risk Level: MediumVulnerable Code
bash npx svgo input.svg -o output.svgbash npx sharp input.jpg --resize 1600 --webp quality=80 -o output.webp npx sharp input.png --flatten background=white --jpeg quality=85 -o output.jpgThe document itself acknowledges the execution risk at line 144:
markdown - Treat `npx` examples as remote-code execution from the package registry and use them only in trusted environments.Technical Analysis
The documented commands invoke
svgoandsharpthroughnpxwithout pinning package versions or verifying package integrity. If an appropriate package is not already installed locally,npxmay retrieve executable package content from the configured npm registry.This makes the effective code dependent on mutable external registry state rather than solely on the reviewed Skill package. Package lifecycle scripts, transitive dependencies, or the requested package executable can run with the privileges of the user invoking
npx. Potential compromise scenarios include a malicious package release, maintainer account takeover, registry or network configuration compromise, dependency confusion, and unexpected package-name resolution.The warning at line 144 accurately identifies this concern, but it does not technically prevent an agent or user from running the examples. The affected commands therefore remain unsafe defaults for automated execution.
Attack Path
- A user asks the agent to optimize an SVG or process an image.
- The agent loads
commands.mdand selects one of the documentednpxexamples. - The requested package is unavailable in the trusted local dependency set.
npxresolves and downloads package content from the configured registry without a version pin or project lockfile.
...[truncated 941 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace on-demand registry execution with dependencies installed from a reviewed project manifest and lockfile.
- Pin exact package versions rather than resolving mutable latest releases.
- Run locally installed binaries, such as
./node_modules/.bin/svgoand./node_modules/.bin/sharp, after verifying the lockfile and package integrity. - If
npxmust be retained, usenpx --no-installso execution fails instead of downloading an absent package. - Require explicit user confirmation before any package retrieval or installation.
- Verify package identity, publisher, provenance, integrity hashes, and transitive dependencies before use.
- Execute image-processing tools in a sandbox with restricted filesystem access, minimal environment variables, no unnecessary credentials, and constrained network access.
- Convert the existing advisory warning into an enforceable instruction that prohibits automated retrieval and execution of unreviewed packages.
