T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:38
- Finding
- Unpinned Third-Party Package Installation and Execution## Vulnerability Details **File Location**: `SKILL.md:38-45, 60-66` **Vulnerability Type**: Unpinned and mutable npm dependency execution **Risk Level**: Medium ### Vulnerable Code ```bash npm i -g @iqinghu/qhkit ``` ```text Only when global installation fails because of permissions and privilege elevation is unavailable, fall back to `npx @iqinghu/qhkit <command> ...`. ``` ```bash npm i -g @iqinghu/qhkit@latest ``` The instructions also permit switching npm downloads to the third-party mirror `https://registry.npmmirror.com`. ### Technical Analysis The Skill directs the agent to install or execute `@iqinghu/qhkit` without pinning it to a reviewed version or verifying package integrity. Both the unversioned npm installation and the explicit `@latest` upgrade resolve to mutable package content at execution time. The `npx` fallback can likewise download and immediately execute the currently published package. npm installation may execute package lifecycle scripts such as `preinstall`, `install`, and `postinstall`. Those scripts and the installed CLI run with the permissions of the invoking user. A compromised package release, maintainer account, registry response, or mirror could therefore introduce executable behavior that was not present when this Skill was audited. A global installation is broader than necessary for invoking a single image-generation command. It modifies the user's shared command environment and makes the unreviewed executable available to subsequent sessions. The mirror fallback introduces an additional supply-chain trust boundary. This finding does not establish that `@iqinghu/qhkit` or the named mirror is currently malicious. The vulnerability is the mutable, unverified dependency retrieval and immediate execution model. ### Attack Path 1. An attacker compromises the npm package maintainer account, package publication process, registry delivery path, or permitted mirror. 2. The at ...[truncated 1396 chars]
- Remediation
- ## Remediation Suggestions 1. Pin the dependency to a specific reviewed version, for example `@iqinghu/qhkit@X.Y.Z`, rather than using an unversioned package or `@latest`. 2. Record and verify npm integrity metadata through a committed lockfile or an equivalent trusted checksum mechanism. 3. Replace global installation with a project-local, locked installation so the package does not modify the user's shared command environment. 4. Avoid automatic upgrades in response to remote CLI messages. Require explicit user approval and security review before changing versions. 5. Do not use `npx` to retrieve and immediately execute an unpinned package. If `npx` is necessary, specify an exact reviewed version and prevent unintended package substitution. 6. Evaluate installation with lifecycle scripts disabled using `--ignore-scripts`. If lifecycle scripts are required, review and document them before execution. 7. Use only explicitly trusted registries. If a mirror is supported, document its trust implications and apply the same version and integrity verification used for the primary registry. 8. Run installation and CLI operations as a non-privileged user in a restricted environment with access limited to the required input images and output directory.
