T08 · Insecure Dependencies
Error
- Location
- SKILL.md:42
- Finding
- Mutable Third-Party Package Is Installed and Executed Globally## Vulnerability Details **File Location**: `SKILL.md`, lines 42-45 and 63-66 **Vulnerability Type**: Mutable and globally installed third-party dependency **Risk Level**: High ### Vulnerable Code ```bash npm i -g @iqinghu/qhkit ``` The instructions permit execution through `npx` and fallback to the `registry.npmmirror.com` mirror. They also prescribe an unpinned upgrade: ```bash npm i -g @iqinghu/qhkit@latest ``` ### Technical Analysis The Skill installs and executes `@iqinghu/qhkit` without pinning an audited version or validating the package against a known integrity digest. The `@latest` selector explicitly allows the effective executable code to change after this Skill has been reviewed. A global npm installation may run package lifecycle scripts and place executable files in a shared command path. This grants the package the privileges of the user running npm and exposes other sessions to the installed executable. Global installation is broader than necessary because a project-local, version-pinned installation could provide the declared image-processing functionality. The mirror fallback introduces another distribution endpoint into the trust chain. Although the named mirror is not inherently malicious, automatically changing registries expands the supply-chain attack surface unless the package artifact is independently authenticated. ### Attack Path 1. An attacker compromises the package publisher account, npm release process, package dependency tree, or permitted mirror. 2. The attacker publishes or serves a malicious release under the expected package name or mutable `latest` tag. 3. The agent follows `SKILL.md` and runs the global installation or invokes the package through `npx`. 4. Malicious lifecycle scripts or CLI code execute with the permissions of the current user. 5. The malicious package can access files, environment variables, network resources, and credentials available to that user and ca ...[truncated 705 chars]
- Remediation
- ## Remediation Suggestions 1. Pin `@iqinghu/qhkit` to a specifically reviewed version rather than using an unversioned package or `@latest`. 2. Record and verify the package integrity digest from a trusted lockfile before execution. 3. Prefer a project-local installation in an isolated directory instead of a global installation. 4. Use `npm ci` with a committed lockfile where possible. 5. Disable npm lifecycle scripts during installation when the package can function without them, then invoke only the explicitly reviewed executable. 6. Do not use `npx` in a way that implicitly downloads a mutable package at execution time. 7. Require explicit user approval before changing registries, and independently verify artifacts retrieved through a mirror. 8. Run the CLI in a sandbox with access limited to the selected input image, its output directory, and the minimum required network destinations.
