T08 · Insecure Dependencies
Error
- Location
- SKILL.md:43
- Finding
- Unpinned Third-Party Package Installation and Automatic Latest-Version Upgrade<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 43–64 **Vulnerability Type**: Insecure third-party dependency installation **Risk Level**: High ```bash npm i -g @iqinghu/qhkit ``` ```bash npm i -g @iqinghu/qhkit@latest ``` ### Technical Analysis The Skill directs the Agent to install `@iqinghu/qhkit` globally without pinning an exact audited version. It later explicitly installs the mutable `latest` release. The dependency's implementation is not included in the audited project, so its installation hooks, runtime behavior, credential handling, and future releases cannot be verified from this repository. A global npm installation may execute package lifecycle scripts and places an executable in the user's global command environment. The optional use of a mirror registry also expands the set of infrastructure trusted to deliver executable content. This behavior exceeds the minimum privileges needed where an isolated, locally pinned dependency would suffice. It does not inherently grant root privileges, but it executes package-controlled code with all permissions of the account running npm. If a user manually adds `sudo`, the resulting impact would increase to system-level compromise, although the Skill itself does not instruct the use of `sudo`. ### Attack Path 1. An attacker compromises the npm package, its maintainer account, a future release, or trusted package-delivery infrastructure. 2. A malicious version is published under the expected package name or exposed through the mutable `latest` tag. 3. The Agent follows the Skill and executes the global installation or upgrade command. 4. Package lifecycle scripts or subsequently invoked CLI code run with the Agent account's privileges. 5. Malicious code reads accessible files or environment variables, steals the configured API token, modifies user-level executables, or exfiltrates submitted images and other accessible data. ### Impact Assessment Successful exploitation permits ar ...[truncated 581 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin the package to an exact, reviewed version rather than using an implicit current version or `@latest`. 2. Record and verify package integrity using a lockfile and trusted integrity hashes. 3. Remove automatic upgrade behavior. Review each new release before changing the approved version. 4. Install the dependency locally in a dedicated project or isolated container instead of globally. 5. Run installation and image processing under a restricted, non-administrative account. 6. Disable npm lifecycle scripts with `--ignore-scripts` when the package can operate without them; otherwise, separately audit every required script. 7. Use an explicit allowlist of approved registries and avoid changing registries automatically after a timeout. 8. Restrict filesystem and environment access so the CLI receives only the required image and token. ]]>
