T08 · Insecure Dependencies
- Location
SKILL.md:34- Finding
Unpinned Third-Party Package Is Downloaded and Executed Automatically
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 34
Vulnerability Type: Supply-chain risk caused by runtime execution of a mutable dependency
Risk Level: HighComplete Code Snippet:
bash export PATH="$HOME/.homebrew/bin:$PATH" && npx -y md-to-pdf@latest <输入文件.md> --pdf-options '{"format":"A4","margin":{"top":"20mm","bottom":"20mm","left":"15mm","right":"15mm"}}'Technical Analysis
The skill instructs the agent to run
npx -y md-to-pdf@latest. The-yoption suppresses the installation confirmation, while@latestresolves to a mutable package release at execution time. Consequently, the code executed in a future invocation may differ from the code available when this skill was audited.No exact package version, lockfile, package integrity hash, trusted internal registry, or prior review requirement is specified. Because npm package lifecycle and runtime code execute with the invoking user's permissions, compromise of the package, its publisher account, or its dependency chain could turn the documented conversion command into an arbitrary-code execution mechanism.
This finding concerns unsafe dependency acquisition rather than confirmed malicious behavior by the currently published package.
Attack Path
- An attacker compromises the
md-to-pdfpublisher account, package, or transitive dependency chain. - The attacker publishes a malicious release that becomes the version selected by the
latestdistribution tag. - An agent follows the skill while processing a Markdown report.
npx -yretrieves and executes the attacker-controlled package without interactive approval.- The malicious package runs with the permissions of the agent process and can access resources available to that operating-system user.
Impact Assessment
Successful exploitation permits arbitrary code execution under the invoking user's account. Potentially exposed resources include the Markdown re ...[truncated 419 chars]
- An attacker compromises the
- Remediation
View remediation
Remediation Suggestions
- Replace
@latestwith an exact, reviewed package version. - Declare the dependency in a project manifest and commit a lockfile that records exact transitive versions and integrity values.
- Install dependencies during a controlled setup or build phase rather than downloading and executing them during report conversion.
- Avoid
npx -yfor runtime acquisition. Execute a previously installed, verified local binary instead. - Configure npm to use an approved registry and verify package provenance and integrity before installation.
- Review package updates before changing the pinned version, including changes to transitive dependencies.
- Run PDF conversion in a sandbox with restricted filesystem access, minimal environment variables, no unnecessary credentials, and constrained network access.
- Add failure handling that refuses conversion if the verified dependency is unavailable rather than silently fetching an unreviewed release.
- Replace
