T08 · Insecure Dependencies
Error
- Location
- scripts/setup-mcp.sh:18
- Finding
- Unpinned npm Package Persisted as an MCP Executable<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup-mcp.sh:18-24` and `scripts/setup-mcp.sh:38-44` **Vulnerability Type**: Unpinned runtime dependency execution **Risk Level**: High ### Vulnerable Code ```bash # Use claude mcp add if available if command -v claude &>/dev/null; then if [ "$SCOPE" = "user" ]; then claude mcp add --scope user aegis -- npx aegis-bridge mcp --port "$PORT" else claude mcp add --scope project aegis -- npx aegis-bridge mcp --port "$PORT" fi ``` The fallback configuration creates the same unpinned command: ```bash jq --arg port "$PORT" ' .mcpServers = (.mcpServers // {}) | .mcpServers.aegis = { "command": "npx", "args": ["aegis-bridge", "mcp", "--port", $port] } ' "$CONFIG_FILE" > "$TMP" && mv "$TMP" "$CONFIG_FILE" ``` ### Technical Analysis The setup script registers the bare npm package name `aegis-bridge` as an MCP executable through `npx`. It does not specify an exact package version, integrity hash, lockfile, verified registry, or trusted local installation path. The resulting command is stored in either the user-level Claude configuration or the project-level MCP configuration. Subsequent MCP launches can therefore resolve package content that was not included in, or reviewed as part of, this project. The effective executable may change when a new package release is published or if the package registry, publisher account, or dependency chain is compromised. Because an MCP server is a locally executed process, resolved package code runs with the privileges of the user launching Claude Code. This is materially more dangerous than using an unpinned library solely for build-time development. ### Attack Path 1. A user runs `scripts/setup-mcp.sh` with either user or project scope. 2. The script stores `npx aegis-bridge mcp --port ...` in Claude’s MCP configuration. 3. An attacker compromises the `aegis-bridge` npm package, its publisher account, registry resolution, or one of its tr ...[truncated 1179 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin `aegis-bridge` to an audited exact version rather than invoking a bare package name. 2. Install dependencies from a committed lockfile using a reproducible command such as `npm ci`. 3. Configure MCP to execute a verified local binary using an absolute path, rather than resolving a package dynamically through `npx`. 4. Verify the package integrity through npm integrity metadata or an independently maintained checksum. 5. Configure an explicit trusted registry and prevent fallback to unexpected package sources. 6. Review and pin all transitive dependencies used by the MCP server. 7. Document how users can remove the MCP entry and provide an uninstall script. 8. If `npx` must be retained, use an exact package version and disable interactive or implicit installation behavior where possible. ]]>
