T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:15
- Finding
- Unpinned Global Installation of a Third-Party CLI## Vulnerability Details **File Location**: `SKILL.md`, lines 15–18 **Vulnerability Type**: Unpinned globally installed third-party dependency **Risk Level**: Medium ### Vulnerable Code Snippet ```markdown 1. 安装 CLI 工具(需要 Node.js 20+): ```bash npm install -g dmxapi-cli ``` ``` ### Technical Analysis The skill instructs users or agents to globally install `dmxapi-cli` from the npm registry without specifying an exact version or verifying package integrity. As a result, the code installed at execution time may differ from the code that existed when the skill was reviewed. npm packages can define lifecycle scripts that run during installation with the privileges of the invoking user. Global installation also makes the package broadly available in the user's environment. The project provides no lockfile, integrity hash, vendored source, or other mechanism for reviewing and reproducing the installed dependency. This creates a supply-chain exposure: a compromised maintainer account, malicious package release, registry compromise, or unexpected future update could cause attacker-controlled code to execute during installation or subsequent CLI use. The API-key configuration instruction immediately following installation increases the potential consequence, although the reviewed file does not itself demonstrate credential exfiltration. ### Attack Path 1. An attacker compromises the `dmxapi-cli` package, its publisher account, or its distribution channel and publishes a malicious release. 2. A user or agent follows the skill instruction and runs `npm install -g dmxapi-cli`. 3. Because no exact version or integrity value is specified, npm resolves and installs the attacker-controlled release. 4. Malicious npm lifecycle code may execute during installation with the invoking user's privileges, or malicious logic may execute when the CLI is used. 5. The user subsequently configures a DMXAPI key through the installed CLI, giving a malicious package an oppor ...[truncated 766 chars]
- Remediation
- ## Remediation Suggestions 1. Pin `dmxapi-cli` to an exact, reviewed version rather than installing the latest available release: ```bash npm install --save-exact dmxapi-cli@<reviewed-version> ``` 2. Prefer a project-local installation over `npm install -g` to reduce system-wide exposure and support reproducible dependency management. 3. Commit an npm lockfile and require integrity verification during installation, such as through `npm ci`. 4. Verify the package's official name, publisher, provenance, signatures, and release history before recommending it. 5. Audit package contents and lifecycle scripts for each approved update. 6. Disable lifecycle scripts during installation where compatible: ```bash npm ci --ignore-scripts ``` 7. Document how the CLI stores and protects API keys. Use restricted, revocable keys with minimal quota and permissions, and avoid exposing keys through command history, logs, or plaintext project files. 8. Consider distributing reviewed source or a verified artifact with a checksum so that installed behavior can be tied to the audited version.
