T08 · Insecure Dependencies
Warning
- Location
- references/初始化工作流.md:32
- Finding
- Unpinned Global npm Package Installation Through a Third-Party Registry## Vulnerability Details **File Location**: `references/初始化工作流.md`, line 32 **Vulnerability Type**: Supply-chain risk from an unpinned dependency and external registry mirror **Risk Level**: Medium **Complete Code Snippet**: ```bash npm install -g qieman-mcp-cli --registry=https://registry.npmmirror.com ``` ### Technical Analysis The initialization workflow recommends globally installing `qieman-mcp-cli` without pinning an exact version and explicitly retrieves it through a third-party npm registry mirror. The reviewed project provides no lockfile, integrity hash, signature verification, or other mechanism that binds installation to audited package contents. npm installation can execute package lifecycle scripts. Consequently, compromise of the package publisher, package release, registry mirror, or dependency chain could cause attacker-controlled code to execute during installation. Because the installation is global, the affected package is also placed outside the project workspace and may remain available to later sessions. This finding concerns the installation mechanism. The audit found no evidence that the package or registry is currently malicious. ### Attack Path 1. An attacker compromises the package publisher account, a transitive dependency, or the configured registry mirror. 2. The attacker publishes or serves a malicious package version containing an npm lifecycle script or modified CLI implementation. 3. A user follows the documented initialization workflow and runs the unpinned global installation command. 4. npm resolves the mutable package version from the specified mirror and executes applicable lifecycle scripts. 5. The malicious code runs with the permissions of the user executing npm and may replace the expected CLI with attacker-controlled behavior. 6. Subsequent CLI configuration or MCP calls could expose data handled by that process, including the API key or financial information supplied to the ...[truncated 558 chars]
- Remediation
- ## Remediation Suggestions 1. Pin `qieman-mcp-cli` to a reviewed exact version rather than resolving the latest mutable release. 2. Prefer the official npm registry unless the mirror is explicitly trusted and independently verified. 3. Publish and verify package provenance, signatures, or integrity hashes before installation. 4. Prefer a project-local dependency managed by a lockfile over a global installation. 5. Disable npm lifecycle scripts during installation where functionality permits, then explicitly run only reviewed setup operations. 6. Document the expected package publisher, version, and verification procedure so users can detect substitution. 7. Run the CLI with least privilege and ensure API keys and other sensitive values are stored with restrictive filesystem permissions and masked in command output.
