T07 · Tool Hijacking and Spoofing
Error
- Location
- config.json:4
- Finding
- Relative MCP Server Path May Execute an Attacker-Controlled Script<![CDATA[ ## Vulnerability Details **File Location**: `config.json`, lines 4–7 **Vulnerability Type**: Untrusted executable resolution through a relative path **Risk Level**: High ### Vulnerable Code ```json "command": "python3", "args": [ "./mcp-server.py" ] ``` ### Technical Analysis The MCP configuration invokes `./mcp-server.py` using a path relative to the MCP client's current working directory. It does not resolve the script relative to the installed Skill directory or another trusted, fixed location. If `mcporter` is started from an attacker-controlled directory containing a malicious file named `mcp-server.py`, Python may execute that file instead of the legitimate server. The malicious file does not need to modify the Skill package or configuration because executable resolution depends on the launch directory. ### Attack Path 1. A user copies the supplied configuration into their global mcporter configuration. 2. An attacker places a malicious `mcp-server.py` in a repository or directory controlled by the attacker. 3. The user starts mcporter while that directory is the current working directory. 4. The configured command runs `python3 ./mcp-server.py`. 5. Python executes the attacker-controlled script with the privileges of the mcporter user. ### Impact Assessment Successful exploitation permits arbitrary Python code execution under the account running mcporter. The attacker could access files available to that user, read inherited environment variables, invoke local programs, communicate over the network, or alter user-owned data. The vulnerability does not independently grant elevated operating-system privileges. Its scope is bounded by the permissions of the affected user and any credentials or environment variables inherited by the MCP process. ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions - Install `mcp-server.py` in a trusted, administrator- or user-owned directory and reference it with an absolute path. - Ensure the script and its containing directory are not writable by untrusted users. - Generate installation-specific configuration rather than distributing a working-directory-relative command. - If portability is required, use a trusted launcher that securely derives the Skill installation directory and validates the target before execution. - Document that users should verify ownership and permissions of the configured executable. Example hardened configuration: ```json "command": "python3", "args": [ "/home/user/.local/share/clawhub/searxng-search/mcp-server.py" ] ``` ]]>
