T08 · Insecure Dependencies
Error
- Location
- SKILL.md:42
- Finding
- Unpinned npm Dependency Installation and Automatic Upgrade<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:42-45, 60-63` **Vulnerability Type**: Untrusted and unpinned third-party executable dependency **Risk Level**: High ### Complete Code Snippet ```bash npm i -g @iqinghu/qhkit ``` The documented fallback uses: ```bash npx @iqinghu/qhkit <command> ... ``` The upgrade procedure uses: ```bash npm i -g @iqinghu/qhkit@latest ``` ### Technical Analysis The Skill installs and executes the `@iqinghu/qhkit` npm package without pinning it to a reviewed version or integrity digest. The fallback through `npx` can also download and execute the package dynamically. The upgrade procedure explicitly requests the mutable `latest` release. Consequently, the code executed by this Skill can change after the Skill itself has been audited. npm package lifecycle hooks and the installed CLI execute with the permissions of the account running npm. A malicious package release, compromised maintainer account, registry compromise, or upstream dependency compromise could therefore result in arbitrary local code execution. Global installation unnecessarily increases the package's reach within the user environment compared with a project-local, pinned installation. The instructions do not explicitly require root access, so this issue does not independently establish privilege escalation; its normal scope is the current user's privileges. ### Attack Path 1. An attacker compromises the package publisher, npm account, package distribution channel, or a transitive dependency. 2. The attacker publishes a malicious version under the legitimate `@iqinghu/qhkit` package name. 3. The Agent encounters a missing CLI, permission-related fallback, or upgrade condition. 4. The Agent runs the unpinned `npm`, `npx`, or `@latest` command. 5. npm downloads the attacker-controlled release. 6. Malicious lifecycle hooks or CLI code execute with the invoking user's permissions. 7. The payload can access files, credentials, environment varia ...[truncated 875 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin the package to an exact, reviewed version rather than using an implicit current version or `@latest`: ```bash npm install --global @iqinghu/qhkit@EXACT_REVIEWED_VERSION ``` 2. Verify the package archive against an independently recorded integrity digest before execution. 3. Remove instructions that automatically install `@latest`. 4. Do not use `npx` in a way that implicitly downloads unreviewed code. If `npx` is retained, require an exact version and disable installation when the package is absent. 5. Prefer a project-local or isolated installation over a global installation. 6. Require explicit user approval before installing or upgrading executable dependencies. 7. Review the package, its lifecycle scripts, and its transitive dependency lockfile before approving a new version. 8. Run the CLI in a restricted environment with access limited to the intended input image and required network endpoints. 9. Document the approved package version and update it only through a controlled review process. ]]>
