T08 · Insecure Dependencies
Error
- Location
- SKILL.md:42
- Finding
- Unpinned Third-Party CLI Installation and Execution<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 42-45 and 63-66 **Vulnerability Type**: Unpinned dependency installation and unsafe supply-chain execution **Risk Level**: High ### Vulnerable Code ```bash npm i -g @iqinghu/qhkit ``` ```bash npx @iqinghu/qhkit <command> ... ``` ```bash npm i -g @iqinghu/qhkit@latest ``` The instructions also permit using an alternate registry: ```bash --registry=https://registry.npmmirror.com ``` ### Technical Analysis The Skill directs the Agent to install and execute `@iqinghu/qhkit` without pinning an exact, reviewed package version or validating package integrity. The explicit use of `@latest` makes the effective executable payload mutable after the Skill has been audited. The `npx` fallback can similarly retrieve and immediately execute the current package version. An npm package can execute code through lifecycle scripts during installation and through its CLI entry point when invoked. Consequently, compromise of the package publisher, npm account, package release, official registry, or permitted mirror could result in attacker-controlled code running under the Agent user's account. Global installation is also broader than necessary for isolated Skill execution. It changes the user's shared Node.js environment and can expose the package to unrelated sessions. Although the instructions avoid mandatory privilege escalation, a global installation may encourage elevated execution when the normal user lacks write permission. ### Attack Path 1. An attacker compromises the package publisher, registry account, distribution infrastructure, or permitted mirror. 2. The attacker publishes a malicious version under the legitimate `@iqinghu/qhkit` package name. 3. The Agent follows the Skill instructions and runs an unpinned global installation, `npx`, or the explicit `@latest` upgrade. 4. npm retrieves the attacker-controlled release. 5. Malicious lifecycle scripts execute during installation, or malic ...[truncated 1024 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin `@iqinghu/qhkit` to an exact version that has been reviewed: ```bash npm install --no-save --ignore-scripts @iqinghu/qhkit@<reviewed-version> ``` 2. Record and verify the package integrity value from a trusted source before execution. 3. Replace global installation with a project-local installation in an isolated temporary directory or container. 4. Avoid `npx` without an exact version. If it remains necessary, specify the reviewed version and prevent implicit package substitution. 5. Remove instructions to automatically install `@latest` or to obey upgrade commands returned by the dependency. New versions should undergo review before deployment. 6. Disable npm lifecycle scripts with `--ignore-scripts` where the package can function without them. If scripts are required, inspect them before installation. 7. Run the CLI as a dedicated, unprivileged user with access limited to the specific input files required for the operation. 8. Restrict outbound network access to documented service endpoints and obtain user approval before uploading local media. 9. Treat registry mirrors as separate trust boundaries. Permit only explicitly approved registries and retain integrity verification regardless of the selected registry. ]]>
