T08 · Insecure Dependencies
Error
- Location
- SKILL.md:52
- Finding
- Unpinned Third-Party Packages Are Installed and Executed<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 52-54, 75, and 96-99 **Vulnerability Type**: Uncontrolled third-party dependency installation and execution **Risk Level**: High ### Relevant Code ```bash npm i -g @iqinghu/qhkit ``` ```text If global installation fails because of permissions and privilege elevation is unavailable, use: npx @iqinghu/qhkit <command> ... ``` ```bash npm i -g @iqinghu/qhkit@latest ``` ```bash pip install pillow -i https://pypi.tuna.tsinghua.edu.cn/simple ``` ```bash npx --yes sharp-cli -i original-image -o compressed.jpg resize 2048 ``` ### Technical Analysis The Skill directs the Agent to install and execute npm and Python packages without pinning exact versions or cryptographic integrity values. The explicit use of `@latest` and `npx --yes` allows newly published package versions to execute without review. npm package lifecycle scripts may execute during installation, while `npx` immediately downloads and runs package code. Global npm installation also modifies the user-wide executable environment rather than using a task-scoped, isolated dependency directory. The npm and Python mirror fallbacks introduce additional supply-chain trust boundaries. This behavior is related to the declared media-generation functionality because the Skill depends on `qhkit`, but it exceeds minimum privilege and change scope by globally installing packages and automatically executing unreviewed versions. Image compression helpers should likewise be installed in an isolated, version-pinned environment rather than fetched dynamically. ### Attack Path 1. An attacker compromises a referenced package, one of its transitive dependencies, a maintainer account, or a configured package registry or mirror. 2. The attacker publishes a malicious version or adds a malicious installation lifecycle script. 3. The Agent follows the Skill's environment-bootstrap instructions and runs an unversioned installation, `@latest`, or `npx --ye ...[truncated 971 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin every dependency to an exact reviewed version. Do not use `@latest` or unversioned package specifications. 2. Record and verify package integrity hashes through a lockfile or an equivalent trusted manifest. 3. Replace global npm installation with a task-scoped installation in an isolated directory or container. 4. Disable npm lifecycle scripts where they are unnecessary, for example with `--ignore-scripts`, after confirming the package still functions correctly. 5. Replace `npx --yes` with a locally installed, exact-version executable. 6. Pin Pillow and `sharp-cli` to reviewed versions and install them only in isolated virtual environments or task-specific Node projects. 7. Prefer the official package registries. If mirrors are required, document their trust model and verify downloaded artifacts against integrity values obtained from an independent trusted source. 8. Require explicit user approval before changing the local software environment. 9. Publish and audit the source and dependency tree of `@iqinghu/qhkit`, which is not included in this project and therefore could not be reviewed in this audit. ]]>
