T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:51
- Finding
- Unpinned Third-Party Packages Are Installed and Executed at Runtime<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 51, 77, and 90 **Vulnerability Type**: Unsafe runtime dependency installation and supply-chain exposure **Risk Level**: Medium ### Vulnerable Code ```bash npm i -g @iqinghu/qhkit npm i -g @iqinghu/qhkit@latest pip install pillow -i https://pypi.tuna.tsinghua.edu.cn/simple npx --yes sharp-cli -i source-image -o compressed-image.jpg resize 2048 ``` The surrounding instructions also permit npm mirror substitution: ```bash --registry=https://registry.npmmirror.com ``` ### Technical Analysis The Skill instructs the Agent to download and execute third-party packages dynamically without pinning exact versions or verifying package integrity. The use of `@latest` explicitly causes the executed package contents to vary over time. Similarly, `npx --yes sharp-cli` downloads and executes a package without interactive review. The Python fallback installs Pillow from an alternate package index without a pinned version or hash. Global installation of `@iqinghu/qhkit` broadens the potential effect beyond the immediate task. npm lifecycle scripts and installed executables run with the privileges of the Agent's operating-system account and may access files, environment variables, API credentials, and network resources available to that account. Although no malicious dependency is included directly in the audited project, this design creates a supply-chain execution channel whose payload can change after the Skill has been reviewed. ### Attack Path 1. An attacker compromises a referenced package, one of its transitive dependencies, a package maintainer account, or a permitted package registry. 2. The attacker publishes a malicious version under the expected package name or causes the registry to serve manipulated package content. 3. The Agent follows the Skill's installation or upgrade instructions. 4. `npm`, `npx`, or `pip` downloads the compromised package. 5. Package installation hooks or the down ...[truncated 983 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin every dependency to an exact, reviewed version rather than using unversioned packages or `@latest`. 2. Verify downloaded package integrity using a trusted lockfile, registry integrity metadata, or independently distributed cryptographic hashes. 3. Replace `npx --yes` with a locally installed, pinned dependency whose integrity has already been verified. 4. Avoid global installation. Install dependencies in a dedicated project directory, container, virtual environment, or other isolated runtime. 5. Do not automatically switch registries. If a mirror is necessary, require explicit user approval and document its trust implications. 6. Disable package lifecycle scripts where feasible, for example with `npm install --ignore-scripts`, after confirming that the reviewed package does not require them. 7. Run third-party tools with minimum filesystem and network permissions and without unrelated credentials in their environment. 8. Require explicit user approval before installing or upgrading executable dependencies. 9. Prefer a prebuilt, reviewed runtime image with fixed dependency versions over runtime bootstrapping. ]]>
