T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:27
- Finding
- Unpinned Global Installation of a Third-Party CLI## Vulnerability Details **File Location**: `SKILL.md`, lines 27-31 **Vulnerability Type**: Unpinned third-party dependency installed globally **Risk Level**: Medium ### Vulnerable Code ```markdown If the CLI is not installed, install it: ```bash npm install -g x-analytics-cli ``` ``` ### Technical Analysis The Skill instructs the agent to install the latest available version of `x-analytics-cli` globally from the npm registry. It does not pin a reviewed version, verify an integrity hash or package provenance, use a lockfile, or isolate the dependency within the project. Consequently, the code executed by this instruction may differ from the code that existed when the Skill was reviewed. npm installation can also execute package lifecycle scripts. Global installation increases exposure because those scripts and the resulting executable run with the installing user's privileges and become available outside the current project. This risk is especially relevant because the installed CLI is subsequently entrusted with four OAuth credentials and is expected to read them from environment variables, an explicit path, or `~/.config/x-analytics-cli/credentials.json`. The actual CLI implementation is not included in the audited project, so its network destinations and secret-handling behavior cannot be verified here. ### Attack Path 1. An attacker compromises the npm publisher account, package release process, or another component of the package's dependency chain. 2. The attacker publishes a malicious release under the existing `x-analytics-cli` package name. 3. A user or agent follows the Skill instruction and runs `npm install -g x-analytics-cli`. 4. npm downloads the mutable latest release and may execute attacker-controlled lifecycle scripts during installation. 5. The installed executable is then invoked through commands such as `x-analytics-cli me`. 6. The malicious package reads the OAuth credentials supplied thro ...[truncated 1234 chars]
- Remediation
- ## Remediation Suggestions 1. Pin `x-analytics-cli` to an exact version that has been reviewed instead of installing the latest release. 2. Verify the package with an expected registry integrity hash and package provenance or signed release metadata. 3. Confirm that the npm artifact corresponds to the reviewed source repository and expected publisher. 4. Prefer a project-local dependency with a committed lockfile over a global installation. 5. Avoid executing dependency lifecycle scripts where compatible, such as by using npm's script-disabling controls. 6. Run the CLI with a minimally privileged operating-system account and restrict filesystem access where sandboxing is available. 7. Store `credentials.json` with owner-only filesystem permissions and grant the X credentials only the scopes required for read-only analytics. 8. Avoid passing credential values directly on command lines, where they could be exposed through shell history or process listings. 9. Document the CLI's permitted network destination and restrict outbound traffic to the official X API endpoints when practical. 10. Re-review the dependency before changing the pinned version.
