T07 · Tool Hijacking and Spoofing
Error
- Location
- scripts/register_mcporter.sh:4
- Finding
- Registration Wrapper Executes an Unverified Script Outside the Audited Project<![CDATA[ ## Vulnerability Details **File Location**: `scripts/register_mcporter.sh:4-7` **Vulnerability Type**: Execution of an external, integrity-unverified workspace script **Risk Level**: High ### Complete Code Snippet ```bash SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" WORKSPACE="$(cd "$SCRIPT_DIR/../../.." && pwd)" exec "$WORKSPACE/scripts/baidudisk_mcporter.sh" register "$@" ``` ### Technical Analysis The supplied registration wrapper does not implement registration within the audited project. It derives a workspace path three levels above its own directory and transfers execution to `scripts/baidudisk_mcporter.sh` at that external location. Because the target script is outside the audited artifact, its content, ownership, and integrity are not controlled by this Skill. The use of `exec` replaces the current process with that script and passes through all additional user arguments. The documentation also references `scripts/baidudisk_mcporter.sh`, but that file is not present in the supplied project. This creates an ambiguous trust boundary in which a legitimate-looking registration action depends on unaudited local code. ### Attack Path 1. An attacker gains the ability to create or replace the workspace-level `scripts/baidudisk_mcporter.sh`. 2. The user or agent invokes `scripts/register_mcporter.sh` to register the MCP server. 3. The wrapper resolves the external workspace path without validating the target's ownership or integrity. 4. `exec` launches the attacker-controlled script under the invoking user's privileges. 5. The external script can alter MCP configuration, execute arbitrary commands, access files available to the user, or install additional malicious tooling. ### Impact Assessment Successful exploitation provides arbitrary command execution with the privileges of the user running registration. The scope includes any files, credentials, configuration, and processes accessible to that user. The external script coul ...[truncated 119 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Include the complete registration implementation inside this project rather than delegating to an external workspace script. 2. Resolve the executable relative to `SCRIPT_DIR`, for example: ```bash TARGET="$SCRIPT_DIR/baidudisk_mcporter.sh" ``` 3. Fail closed if the expected script is missing, is a symbolic link, has unexpected ownership, or is writable by untrusted users. 4. If delegation is unavoidable, verify the target against a trusted cryptographic digest before execution. 5. Avoid searching for or implicitly trusting same-named scripts elsewhere in the workspace. 6. Correct `SKILL.md` so that its registration command references the actual packaged and audited script. 7. Ensure generated MCP configuration points directly to reviewed executables and fixed project paths. ]]>
