T08 · Insecure Dependencies
- Location
SKILL.md:10- Finding
Unpinned Third-Party Package Execution Through npx
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 10–17
Vulnerability Type: Unpinned and automatically executed third-party dependency
Risk Level: MediumVulnerable Code
markdown ## Command policy Prefer `yapi` command. If missing, fallback to one-shot npx without forcing global install: ```bash yapi -h # fallback: npx -y @leeguoo/yapi-mcp -hIn command examples below,
yapican be replaced bynpx -y @leeguoo/yapi-mcp.text ### Technical Analysis The documented fallback invokes `@leeguoo/yapi-mcp` through `npx -y` without specifying an exact package version or verifying package integrity. Consequently, npm resolves the package to whatever version is current under the applicable registry and configuration when the command runs. The `-y` option suppresses installation confirmation, enabling newly downloaded package code to execute without an explicit user approval step. npm package lifecycle behavior and the invoked CLI entry point can execute code with the permissions of the account running the agent. The effective code may therefore change after the skill has been reviewed. This creates a supply-chain exposure rather than evidence that the named package is currently malicious. Exploitation would require compromise or malicious alteration of the package, its publisher account, its dependency chain, or the package registry/resolution environment. ### Attack Path 1. The agent attempts to use the preferred local `yapi` executable, but it is unavailable. 2. Following the skill instructions, the agent runs: ```bash npx -y @leeguoo/yapi-mcp -h- npm resolves an unpinned version from the configured registry and downloads it and any required dependencies.
- A compromised package version, dependency, publisher account, or registry response supplies attacker-controlled code.
- Package lifecycle code or the CLI entry point executes under the agent user's identity.
- The malicious code accesses resources available ...[truncated 654 chars]
- Remediation
View remediation
Remediation Suggestions
- Pin the package to a reviewed exact version rather than allowing mutable registry resolution:
bash npx -y @leeguoo/yapi-mcp@X.Y.Z -h - Prefer installing the dependency through a committed lockfile with verified integrity metadata, followed by execution without downloading:
bash npx --no-install @leeguoo/yapi-mcp -h - Remove
-ywhere practical so that an unexpected installation requires explicit approval. - Document a trusted registry and enforce npm configuration that prevents dependency-confusion resolution through untrusted registries.
- Review the pinned package, transitive dependencies, lifecycle scripts, and published provenance before approval.
- Run the CLI with least privilege in a sandbox or container, limiting filesystem and network access to the resources necessary for YApi operations.
- Restrict access to YApi authentication caches and avoid exposing unrelated credentials or sensitive environment variables to the CLI process.
- Pin the package to a reviewed exact version rather than allowing mutable registry resolution:
