T08 · Insecure Dependencies
Error
- Location
- SKILL.md:40
- Finding
- Execution of Unpinned Third-Party npm Packages<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 40–43 and 58–61 **Vulnerability Type**: Unpinned dependency installation and execution **Risk Level**: High ### Vulnerable Code Snippet ```bash npm i -g @iqinghu/qhkit ``` The surrounding instructions also permit direct execution through an unpinned package name: ```bash npx @iqinghu/qhkit <command> ... ``` The upgrade procedure explicitly installs the mutable latest release: ```bash npm i -g @iqinghu/qhkit@latest ``` ### Technical Analysis The Skill installs or executes `@iqinghu/qhkit` without pinning it to a reviewed version or verifying package integrity. Both the unversioned package reference and the `@latest` tag are mutable: the code retrieved during a future invocation can differ from the code that existed when this Skill was audited. npm installation can execute package lifecycle scripts, while `npx` can download and immediately run package code. Consequently, compromise of the publisher account, npm package, registry infrastructure, or configured mirror could introduce arbitrary executable code. The mirror fallback further expands the supply-chain trust boundary. No lockfile, integrity digest, package signature, or isolated execution environment is specified. ### Attack Path 1. An attacker compromises the package publisher, an authorized release process, or a trusted registry endpoint. 2. The attacker publishes a malicious version of `@iqinghu/qhkit` or causes the mutable package reference to resolve to malicious content. 3. The Agent follows the Skill instructions and runs `npm i -g`, `npm i -g ...@latest`, or `npx`. 4. npm downloads the altered package and potentially runs its lifecycle scripts. 5. The malicious package executes with the privileges of the Agent process. 6. It can access files, environment variables, network resources, and credentials available to that account. ### Impact Assessment Successful exploitation provides arbitrary code execution under the ...[truncated 552 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin `@iqinghu/qhkit` to a specifically reviewed version rather than using an unversioned reference or `@latest`. 2. Verify the package against a trusted integrity digest before installation. 3. Remove the instruction to execute the package directly through unpinned `npx`. 4. Use a lockfile and a project-local installation rather than a global installation. 5. Disable unnecessary lifecycle scripts during installation, for example with `npm install --ignore-scripts`, if the package functions without them. 6. Run the CLI in a restricted container or sandbox with access only to explicitly selected media files. 7. Require explicit user approval before installing or upgrading third-party software. 8. Pin and authenticate the registry source; do not silently switch to a mirror. 9. Review each new package version before updating the pinned version. ]]>
