T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:54
- Finding
- Unpinned Third-Party Packages Are Downloaded and Executed<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 54-57; additional occurrences at lines 84 and 96 **Vulnerability Type**: Unsafe third-party dependency installation and execution **Risk Level**: Medium ### Vulnerable Code ```bash npm i -g @iqinghu/qhkit ``` The same workflow also instructs the Agent to execute dynamically selected package releases: ```bash npm i -g @iqinghu/qhkit@latest ``` ```bash npx --yes sharp-cli -i source-image -o compressed-image.jpg resize 2048 ``` ### Technical Analysis The Skill installs and executes npm packages without pinning them to audited versions or verifying package integrity against a separately trusted digest. The `@latest` upgrade instruction explicitly resolves to whichever release the registry currently advertises. The unversioned `npx --yes sharp-cli` command similarly downloads and immediately executes a package without interactive review. npm installations may execute package lifecycle scripts, and the installed CLI subsequently runs with the permissions of the Agent's operating-system account. The optional use of a third-party npm mirror further expands the supply-chain trust boundary. This behavior supports the declared functionality, but it is not the minimum-risk implementation. A reviewed, pinned CLI version would be sufficient. Automatically installing the newest available executable code is unnecessary for ordinary image generation. The Node.js bootstrap command identified by the pre-scan is not a `curl | bash` pipeline. It downloads the archive separately and verifies it with `sha256sum` before extraction. The material dependency risk instead arises from the unpinned npm installation and execution instructions. ### Attack Path 1. An attacker compromises the npm publisher account, package, release pipeline, registry response, or configured package mirror. 2. The attacker publishes a malicious version of `@iqinghu/qhkit` or `sharp-cli`, or modifies a package dependency. 3. The A ...[truncated 1254 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin `@iqinghu/qhkit` and `sharp-cli` to specific versions that have been reviewed. 2. Remove the automatic `@latest` upgrade instruction. Treat upgrades as an explicit, separately reviewed maintenance operation. 3. Maintain a lockfile or verified package-integrity values from an independently trusted source. 4. Prefer a preinstalled, reviewed CLI supplied by the execution environment instead of installing code during Skill invocation. 5. Avoid global installation where possible. Use an isolated project directory, container, or restricted user account. 6. Disable npm lifecycle scripts with `--ignore-scripts` where the packages can operate without them. 7. Require explicit user approval before downloading or installing executable dependencies. 8. Allow only approved registries and mirrors, and document their trust assumptions. 9. Run downloaded tools with restricted filesystem, network, and environment-variable access. 10. For image compression, prefer an already installed image library rather than downloading and immediately executing an unversioned package through `npx`. ]]>
