T08 · Insecure Dependencies
Error
- Location
- SKILL.md:43
- Finding
- Unpinned Global Installation of a Security-Sensitive Trading Dependency## Vulnerability Details **File Location**: `SKILL.md`, line 43 **Vulnerability Type**: Unpinned third-party executable dependency **Risk Level**: High ### Vulnerable Code ```bash npm install -g phemex-trade-mcp@latest ``` ### Technical Analysis The skill instructs users to install the mutable `latest` release of `phemex-trade-mcp` globally. No exact version, lockfile, package integrity hash, or other reproducible verification mechanism is specified. The installed package is especially security-sensitive because `phemex-cli` subsequently receives Phemex API credentials and is authorized to place orders, change leverage, cancel orders, and transfer funds. A Node.js package may also execute package-controlled lifecycle scripts during installation. Because the dependency's source code is not included in the audited project, its installation behavior and credential handling cannot be verified here. This creates a supply-chain trust boundary in which a compromised maintainer account, registry compromise, malicious future release, or transferred package ownership could cause newly installed copies of the skill dependency to execute attacker-controlled code. ### Attack Path 1. An attacker compromises the npm package, its maintainer account, or its publication process. 2. The attacker publishes a malicious release under the mutable `latest` tag. 3. A user follows the documented command and globally installs that release. 4. Malicious code executes through an npm lifecycle script or when `phemex-cli` is invoked. 5. The package reads Phemex credentials from environment variables or `~/.phemexrc`. 6. The attacker exfiltrates the credentials, performs unauthorized trades, or executes code with the privileges of the installing user. ### Impact Assessment Successful exploitation could provide code execution under the account running npm, access to environment variables and user-readable files, and theft of Phemex API credentia ...[truncated 341 chars]
- Remediation
- ## Remediation Suggestions 1. Replace `@latest` with an exact, reviewed version, such as `phemex-trade-mcp@1.2.0`. 2. Record and verify package integrity using a lockfile and registry-provided integrity hashes. 3. Prefer a project-local installation over a global installation to reduce exposure and improve reproducibility. 4. Audit and vendor the dependency implementation where practical, particularly installation scripts, credential access, network destinations, and order-validation logic. 5. Disable lifecycle scripts during installation when they are unnecessary, for example with `npm install --ignore-scripts`, after verifying that the package remains functional. 6. Establish a controlled upgrade process that reviews release diffs before changing the pinned version. 7. Run the CLI with a dedicated, least-privileged API key that cannot withdraw funds and has only the permissions required for the requested operation.
