T08 · Insecure Dependencies
Error
- Location
- SKILL.md:46
- Finding
- Unpinned Global Installation of a Third-Party npm Package<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:46` **Vulnerability Type**: Unpinned third-party dependency installed globally **Risk Level**: High ### Vulnerable Code ```bash npm i -g @iqinghu/qhkit ``` ### Technical Analysis The Skill directs the agent to install `@iqinghu/qhkit` without specifying an exact version or integrity value. Consequently, the package content executed during a future invocation may differ from the content available when the Skill was audited. npm installations can execute package lifecycle scripts. The global `-g` installation also places the package and its executable in a shared user or system-level npm location rather than isolating it to the current task. This exceeds the minimum privilege and persistence scope needed to invoke an image-generation client. The risk depends on a compromise of the package, publisher account, npm infrastructure, or configured registry. The repository itself does not establish that the package is malicious. ### Attack Path 1. An attacker compromises the package publisher, a registry account, registry infrastructure, or a package dependency. 2. The attacker publishes a malicious version under the same package name. 3. The agent follows the Skill and runs the unpinned global installation. 4. npm retrieves the current package version and may execute attacker-controlled lifecycle scripts during installation. 5. The installed CLI subsequently runs with the privileges of the account executing the agent. 6. Malicious code can access files, environment variables, network resources, and credentials available to that account. ### Impact Assessment Successful exploitation can provide arbitrary code execution with the agent process's operating-system privileges. Accessible scope may include the user's files, environment variables, API tokens, shell configuration, and network-accessible services. If the installation is run with elevated privileges, the impact could extend to system-wide fi ...[truncated 112 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Pin `@iqinghu/qhkit` to a reviewed, exact version rather than resolving the current release. - Verify package integrity using a lockfile and registry integrity metadata. - Prefer a project-local installation in a dedicated, unprivileged environment over `npm -g`. - Require explicit user authorization before installing software. - Avoid elevated installation privileges. - Disable lifecycle scripts with `--ignore-scripts` where compatible, or separately review every required lifecycle script. - Allow only trusted registries and avoid silently switching to a mirror. - Consider shipping a reviewed client or using a sandboxed invocation with restricted filesystem, credential, and network access. ]]>
