T08 · Insecure Dependencies
- Location
scripts/imiva_mcp.py:14- Finding
Automatic Execution of an Unpinned npm Package
- Content
View full analysis
Vulnerability Details
File Location:
scripts/imiva_mcp.py:14, 44-52; also documented inSKILL.md:113-126andreferences/mcp-config.example.json:4-8
Vulnerability Type: Supply-chain risk caused by mutable dependency resolution and automatic execution
Risk Level: MediumComplete Code Snippet:
python PACKAGE = "@infimind/ecom-content-cli@latest"python def invoke(method: str, params: dict | None = None) -> dict: npx, token = require_runtime() env = os.environ.copy() env["MCP_TOKEN"] = token env["API_URL"] = os.environ.get("IMIVA_API_URL", os.environ.get("API_URL", DEFAULT_API_URL)) proc = subprocess.Popen( [npx, "-y", PACKAGE], stdin=subprocess.PIPE,Corresponding example configuration:
json { "mcpServers": { "imiva-ecommerce": { "command": "npx", "args": [ "-y", "@infimind/ecom-content-cli@latest" ], "env": { "MCP_TOKEN": "your-token-here", "API_URL": "https://imiva.ecpro.com" } } } }Technical Analysis
The helper invokes
npxwith the-yoption and the mutable package identifier@infimind/ecom-content-cli@latest. Thelatestdistribution tag can resolve to different package contents over time, so the code executed during a future invocation is not necessarily the code that was available when this Skill was audited.The
-yoption suppresses the package-installation confirmation. Consequently, listing tools or calling an MCP operation may download and execute a newly published package without requiring the user to inspect or explicitly approve that particular release.This behavior establishes a remote code retrieval and execution channel through the npm registry. A compromised publisher account, malicious future package release, registry compromise, or compromised transitive dependency could cause attacker-control ...[truncated 1701 chars]
- Remediation
View remediation
Remediation Suggestions
-
Replace the mutable package reference with an audited exact version, for example:
python PACKAGE = "@infimind/ecom-content-cli@1.2.3" -
Do not rely on
npx -yto download executable code at every invocation. Install the dependency through a controlled deployment process and invoke the locally installed, verified binary. -
Use a lockfile and integrity hashes to ensure reproducible dependency resolution, including transitive dependencies.
-
Verify npm package provenance, publisher identity, signatures, and release history before approving upgrades.
-
Introduce a deliberate update process that includes source review, vulnerability scanning, and testing before changing the pinned version.
-
Where supported, use a trusted internal registry or package mirror that only contains approved package versions.
-
Run the MCP package in a sandbox or container with restricted filesystem and network access.
-
Update
SKILL.mdandreferences/mcp-config.example.jsonto use the same pinned, approved version.
-
