T08 · Insecure Dependencies
Error
- Location
- scripts/courseforge.mjs:32
- Finding
- Third-Party npm Package Is Automatically Downloaded and Executed with API Credentials## Vulnerability Details **File Location**: `SKILL.md:9-16, 27`; `scripts/courseforge.mjs:32-56` **Vulnerability Type**: Supply-chain exposure through automatic dependency retrieval and execution **Risk Level**: High ### Vulnerable Code `SKILL.md:9-16`: ```yaml requires: bins: ["node"] env: ["COURSEFORGE_API_KEY"] install: - id: npm kind: npm package: courseforge-mcp-client global: true bins: ["courseforge-mcp"] label: "Install CourseForge MCP client (npm)" ``` `SKILL.md:27`: ```bash npm install -g courseforge-mcp-client ``` `scripts/courseforge.mjs:32-56`: ```js // Find the courseforge-mcp binary, fall back to npx const home = process.env.HOME || ''; const candidates = [ resolve(home, '.npm-global/bin/courseforge-mcp'), resolve(home, '.local/bin/courseforge-mcp'), '/usr/local/bin/courseforge-mcp', ]; let mcpBin = null; let mcpArgs = []; for (const c of candidates) { if (existsSync(c)) { mcpBin = c; break; } } if (!mcpBin) { // Fall back to npx with pinned version mcpBin = 'npx'; mcpArgs = ['-y', 'courseforge-mcp-client@1.3.0']; } // Only pass required env vars to the child process — avoid leaking unrelated secrets const child = spawn(mcpBin, mcpArgs, { env: { COURSEFORGE_API_KEY: process.env.COURSEFORGE_API_KEY, COURSEFORGE_API_URL: process.env.COURSEFORGE_API_URL || '', HOME: process.env.HOME || '', PATH: process.env.PATH || '', NODE_PATH: process.env.NODE_PATH || '', npm_config_prefix: process.env.npm_config_prefix || '', }, ``` ### Technical Analysis The documented installation command installs the latest published version of `courseforge-mcp-client` globally without an exact version or integrity constraint. If no existing binary is found, the wrapper automatically invokes `npx -y` to download and execute version `1.3.0`. Although the fallback uses an exact version number, ...[truncated 1954 chars]
- Remediation
- ## Remediation Suggestions - Pin the documented global installation to an exact, reviewed version rather than installing the latest release. - Commit a lockfile with npm integrity metadata or vendor the reviewed MCP client. - Remove the automatic `npx -y` fallback. Fail closed and require an administrator to install and verify the client explicitly. - Verify the selected executable and package against an approved checksum or signature before execution. - Run the client in a sandbox with restricted filesystem access and outbound network access limited to approved CourseForge endpoints. - Use a narrowly scoped and short-lived token rather than an account-wide API key. - Separate read, write, destructive, and API-key-management privileges where the service supports scoped credentials. - Require explicit confirmation before destructive operations or API-key creation and revocation.
