T08 · Insecure Dependencies
Warning
- Location
- scripts/install-gate-mcp.sh:29
- Finding
- Unpinned Global Installation of a Third-Party npm Package## Vulnerability Details **File Location**: `scripts/install-gate-mcp.sh`, lines 29-43 **Vulnerability Type**: Unpinned third-party dependency installation **Risk Level**: Medium ### Vulnerable Code ```bash # Step 2: Install mcporter echo "[Step 2/4] Installing mcporter CLI..." if command -v mcporter &> /dev/null; then echo -e "${YELLOW}⚠ mcporter is already installed ($(mcporter --version))${NC}" read -p "Do you want to reinstall/update? (y/N): " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then echo "Updating mcporter..." npm i -g mcporter fi else echo "Installing mcporter globally..." npm i -g mcporter fi ``` The same unsafe installation pattern is recommended in `SKILL.md` lines 32-36, `README.md` lines 84-86, and `references/scenarios.md` lines 66-70. `SKILL.md` also recommends `npx mcporter --version` at line 36, which can download and execute the package when it is not already available locally. ### Technical Analysis The installer requests `mcporter` by package name without an exact version, lockfile, or integrity verification. Consequently, each installation resolves whatever package release the configured npm registry currently identifies as current. The installed artifact can therefore change after this skill has been audited. npm package installation may execute package lifecycle scripts. A compromised package publisher account, malicious future release, registry compromise, dependency compromise, or unsafe registry configuration could therefore result in arbitrary code execution during installation. Global installation also places the package in a shared executable location and exposes future invocations of `mcporter` to the selected package implementation. The documentation's `npx mcporter --version` recommendation creates a related execution path: depending on the local npm/npx version and configuration, `npx` may retrieve and run a missing package rather than merely inspect an already verified instal ...[truncated 1704 chars]
- Remediation
- ## Remediation Suggestions 1. Pin `mcporter` to a reviewed exact version, for example: ```bash MCPORTER_VERSION="X.Y.Z" npm install --global --save-exact "mcporter@${MCPORTER_VERSION}" ``` 2. Verify the expected registry before installation and reject untrusted registry overrides: ```bash EXPECTED_REGISTRY="https://registry.npmjs.org/" test "$(npm config get registry)" = "$EXPECTED_REGISTRY" || { echo "Unexpected npm registry" exit 1 } ``` 3. Validate the downloaded package using a reviewed integrity digest or a controlled lockfile. Where practical, download the package artifact first, verify its cryptographic digest, and install only the verified artifact. 4. Prefer a project-local dependency governed by `package-lock.json` and installed with `npm ci` instead of modifying the global tool environment. 5. Review package lifecycle scripts and use `--ignore-scripts` if `mcporter` does not legitimately require them. Test functionality before making this the default because some packages rely on installation scripts. 6. Replace `npx mcporter --version` with a check of a previously installed, version-pinned binary. If `npx` must be used for validation, use `npx --no-install mcporter --version` so that the check fails rather than downloading code. 7. Update `SKILL.md`, `README.md`, and `references/scenarios.md` to use the same pinned and verified installation procedure. 8. Advise users not to execute the installer as root or through `sudo`; use the least-privileged account and a user-owned npm installation directory.
