T08 · Insecure Dependencies
Error
- Location
- SKILL.md:38
- Finding
- Mutable Third-Party CLI Installation and Execution<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 38–65 **Vulnerability Type**: Unsafe third-party dependency installation **Risk Level**: High ### Vulnerable Code ```bash npm i -g @iqinghu/qhkit ``` ```bash npm i -g @iqinghu/qhkit@latest ``` The instructions also permit execution through: ```bash npx @iqinghu/qhkit <command> ... ``` ### Technical Analysis The Skill requires installation and execution of the external npm package `@iqinghu/qhkit`, but its implementation is not included in the reviewed project. Consequently, the behavior of the executable package—including npm lifecycle scripts—cannot be verified from the Skill contents. The upgrade instruction explicitly selects the mutable `latest` release. The instructions also permit package retrieval through an alternative registry. Neither approach pins the dependency to a reviewed version and integrity value. Global installation is broader than necessary because the declared image-generation functionality can be implemented with a project-local, isolated dependency. This creates a supply-chain execution boundary: control of the package publisher account, a package release, or a configured registry could permit attacker-controlled JavaScript or lifecycle scripts to execute during installation or later CLI invocation. ### Attack Path 1. An attacker compromises the npm publisher account, package distribution channel, release process, or permitted package mirror. 2. The attacker publishes a malicious release under the legitimate package name or causes the mutable `latest` tag to resolve to a compromised release. 3. A user or Agent follows the Skill instructions and runs the global installation, automatic upgrade, or `npx` command. 4. npm downloads the compromised package and may run its lifecycle scripts during installation. 5. The installed `qhkit` executable subsequently runs with the privileges and environment of the invoking user. 6. The malicious package can access files, e ...[truncated 728 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin `@iqinghu/qhkit` to a specifically reviewed version rather than using `@latest`. 2. Record and verify the package integrity hash through a lockfile or equivalent trusted manifest. 3. Prefer a project-local installation over `npm i -g` to reduce installation scope and prevent modification of global tool state. 4. Execute the dependency in a restricted environment with access only to the required image files and API endpoint. 5. Avoid automatic upgrades based solely on remote CLI messages; require an explicit review and approval step. 6. Use one explicitly trusted registry and document its trust assumptions. Do not silently switch registries. 7. Where compatible with the package, disable npm lifecycle scripts during installation and separately review any required scripts before execution. 8. Run installation and CLI operations without administrator or root privileges. ]]>
