T08 · Insecure Dependencies
- Location
scripts/imiva_mcp.py:14- Finding
Unpinned npm Package Is Downloaded and Executed at Runtime
- Content
View full analysis
Vulnerability Details
File Location:
scripts/imiva_mcp.py, lines 14 and 50–64
Vulnerability Type: Supply-chain risk caused by mutable dependency resolution and automatic remote execution
Risk Level: MediumVulnerable Code
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, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1, env=env, )The same unsafe invocation is prescribed in
SKILL.md, lines 85–89, andreferences/mcp-config.example.json, lines 4–8:json { "command": "npx", "args": [ "-y", "@infimind/ecom-content-cli@latest" ] }Technical Analysis
The helper invokes
npxwith-yand the mutable npm tag@latest. Consequently, the package code executed by the Skill is not fixed to the version that was available during this audit. On a system where the package is absent or outdated,npxcan retrieve the package selected by the currentlatesttag and execute its entry point without interactive confirmation.This creates a time-of-review versus time-of-use supply-chain gap. A future package release, compromised publisher account, or compromised transitive dependency could change the effective executable payload without any modification to this repository.
The subprocess receives a copy of the parent process environment and is explicitly provided with
MCP_TOKEN. A malicious package would execute with the operating-system privileges of the user running the Skill and could read that token and other inherited environment variables.No evidence was found that the currently reviewed pr ...[truncated 1476 chars]
- Remediation
View remediation
Remediation Suggestions
-
Replace the mutable
@latesttag with a specific, audited package version, for example:python PACKAGE = "@infimind/ecom-content-cli@1.2.3" -
Update
SKILL.mdandreferences/mcp-config.example.jsonto use the same pinned version so documented execution paths do not bypass the fix. -
Install dependencies through a committed lockfile with integrity hashes rather than downloading an unresolved package during every invocation.
-
Introduce a controlled dependency-upgrade process that includes source review, integrity verification, vulnerability scanning, and testing before changing the pinned version.
-
Avoid passing the complete parent environment to third-party code. Construct a minimal environment containing only required runtime variables. Treat
MCP_TOKENas an exposed secret whenever the external client executes and support prompt token revocation and rotation. -
Run the external MCP client in a restricted environment where practical, limiting filesystem access, network destinations, process creation, and operating-system privileges.
-
