T08 · Insecure Dependencies
Error
- Location
- scripts/configure_mcporter.sh:121
- Finding
- Unpinned npm Package Execution with Access to the Xiaodu Credential<![CDATA[ ## Vulnerability Details **File Location**: `scripts/configure_mcporter.sh`, lines 121-134 **Vulnerability Type**: Unpinned runtime dependency execution with sensitive environment access **Risk Level**: High ### Vulnerable Code ```bash echo "[xiaodu-control] 正在写入 mcporter home 配置: xiaodu-iot" mcporter config add xiaodu-iot \ --command npx \ --arg -y \ --arg dueros-iot-mcp \ --env "ACCESS_TOKEN=$TOKEN" \ --scope home if [[ "$VERIFY" -eq 1 ]]; then echo "[xiaodu-control] 正在验证 xiaodu schema" mcporter list xiaodu --schema echo "[xiaodu-control] 正在验证 xiaodu-iot schema" mcporter list xiaodu-iot --schema fi ``` ### Technical Analysis The configuration registers `npx -y dueros-iot-mcp` without an exact package version, package-lock integrity information, or another immutable dependency reference. Consequently, each resolution can retrieve the version currently selected by the npm registry. The configured process is explicitly given `ACCESS_TOKEN` through its environment. The default verification operation can immediately launch the package through `mcporter list xiaodu-iot --schema`. Subsequent IoT operations can launch it again. This creates a supply-chain trust boundary in which mutable third-party code executes with the current user's operating-system privileges and receives a credential capable of accessing the user's Xiaodu environment. Although the audited project does not itself contain a malicious implementation of `dueros-iot-mcp`, its runtime dependency handling does not protect against a compromised maintainer account, malicious package release, registry compromise, or unexpected dependency resolution. ### Attack Path 1. An attacker compromises the npm package, its publisher account, or a transitive dependency and publishes a malicious version. 2. A user runs `scripts/configure_mcporter.sh` using the documented configuration workflow. 3. The script stores an unversioned `npx -y dueros-iot-mcp` command in the home-scope `m ...[truncated 917 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin `dueros-iot-mcp` to a reviewed exact version rather than resolving an unversioned package: ```bash --arg dueros-iot-mcp@X.Y.Z ``` 2. Prefer a project-local installation governed by a committed lockfile and npm integrity hashes instead of runtime `npx -y` downloads. 3. Install dependencies during a controlled installation phase, audit them, and invoke the fixed local binary afterward. 4. Configure npm to use an explicitly trusted registry and retain package provenance or signature verification where supported. 5. Pass only the minimum required environment to the child process. Avoid exposing unrelated user environment variables. 6. Document that schema verification executes third-party code, and require explicit user confirmation before the first package download and execution. 7. Establish an update process in which dependency versions are reviewed and intentionally upgraded rather than automatically tracking registry changes. ]]>
