T08 · Insecure Dependencies
Error
- Location
- SKILL.md:52
- Finding
- Unpinned Third-Party Packages Are Installed and Executed at Runtime<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:52-55`, `SKILL.md:78-81`, and `SKILL.md:91` **Vulnerability Type**: Unsafe runtime dependency installation **Risk Level**: High ### Vulnerable Code Snippets From `SKILL.md:52-55`: ```bash npm i -g @iqinghu/qhkit ``` The same section permits execution through npx: ```bash npx @iqinghu/qhkit <command> ... ``` From `SKILL.md:78-81`: ```bash npm i -g @iqinghu/qhkit@latest ``` From `SKILL.md:91`: ```bash pip install pillow -i https://pypi.tuna.tsinghua.edu.cn/simple npx --yes sharp-cli -i original-image -o compressed-image.jpg resize 2048 ``` ### Technical Analysis The Skill directs the Agent to download, install, and execute mutable third-party packages at runtime. Exact package versions and integrity hashes are not pinned. The explicit use of `@latest` makes the effective code dependent on whichever release the registry serves at execution time. Global npm installation increases the affected scope because package files and executable entry points are placed in shared user-level or system-level locations. npm packages may also execute lifecycle scripts during installation. The npx commands download and execute packages on demand, while the pip command uses a third-party package mirror without package hash verification. No evidence establishes that the named packages or registries are currently malicious. The vulnerability is the unverified, mutable supply-chain execution path: the reviewed Skill does not fully determine which code will run later. The Node.js checksum command at `SKILL.md:61` is not a `curl | bash` operation. It pipes a checksum manifest through `grep` and `sha256sum`, and extraction is conditioned on successful verification. That particular command is therefore not classified as remote shell payload execution. ### Attack Path 1. An attacker compromises a package maintainer account, package release, dependency, or configured registry. 2. The attacker publishes a malicious ...[truncated 1472 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin every dependency to a reviewed exact version instead of using unqualified package names or `@latest`. 2. Commit and enforce lockfiles where possible. 3. Validate package integrity using trusted hashes or signed provenance before installation. 4. Remove automatic global installation. Install dependencies in an isolated, least-privileged project directory, container, or disposable virtual environment. 5. Disable npm lifecycle scripts where they are unnecessary, for example with `--ignore-scripts`, after confirming that the package functions correctly without them. 6. Replace transient npx execution with a pre-reviewed, pinned dependency installed in the isolated environment. 7. Pin Pillow and other Python dependencies by exact version and hash using a requirements file with hash checking. 8. Restrict installation to a single trusted registry. Do not silently switch registries without explicit user approval and equivalent integrity verification. 9. Replace automatic upgrade-on-error behavior with a controlled update process that reviews and verifies the new release before execution. 10. Run media processing with restricted filesystem access, a minimal environment, and no unnecessary credentials. ]]>
