T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:457
- Finding
- Unpinned MCP Packages Executed Automatically Through npx## Vulnerability Details **File Location**: `SKILL.md:457-466` **Vulnerability Type**: `T08: Insecure Dependencies` **Risk Level**: Medium ```python async def main(): mcp_client = MultiServerMCPClient({ "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path"], }, "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": {"GITHUB_TOKEN": os.environ["GITHUB_TOKEN"]}, }, }) ``` ### Technical Analysis The example runs two third-party packages through `npx -y` without pinning either package to an exact reviewed version. The `-y` option suppresses the installation confirmation, while the absence of a version selector permits the package resolved by the registry at execution time to differ from the package available when the Skill was reviewed. This creates a supply-chain execution boundary: package installation and execution occur dynamically, and the effective code is controlled by mutable external registry content. If a package or its publishing account is compromised, a malicious release could execute with the permissions and environment of the Agent process. The GitHub MCP subprocess receives `GITHUB_TOKEN`, and the filesystem MCP subprocess receives access to the configured path. Consequently, compromise of these dependencies could expose sensitive credentials or files. The implementation gate at `SKILL.md:487` advises validating commands, arguments, environment keys, and credential handling, but it does not require exact dependency pinning, lockfile enforcement, or integrity verification. ### Attack Path 1. An attacker compromises a referenced package, its maintainer account, or its dependency chain and publishes a malicious release. 2. A user implements the documented MCP configuration without adding an exact package version. 3. `npx -y` resolves and downloads the mutable packag ...[truncated 1091 chars]
- Remediation
- ## Remediation Suggestions 1. Pin each MCP package to an exact, reviewed version rather than relying on the registry's current resolution, for example: ```python "args": [ "-y", "@modelcontextprotocol/server-filesystem@REVIEWED_EXACT_VERSION", "/path", ] ``` 2. Prefer installing reviewed dependencies during a controlled build phase and executing the locally installed binaries with automatic runtime installation disabled. 3. Commit and enforce a lockfile, and verify package integrity and provenance in CI before deployment. 4. Run MCP servers in an isolated container or sandbox with restricted filesystem, network, and operating-system permissions. 5. Scope the filesystem server to the smallest required directory and avoid exposing home directories or filesystem roots. 6. Supply a short-lived, least-privilege GitHub token restricted to only the required repositories and operations. Do not reuse broadly privileged personal access tokens. 7. Restrict subprocess environment variables so each MCP server receives only the secrets it requires. 8. Add dependency scanning, release review, and controlled update procedures for MCP packages and their transitive dependencies.
