T07 · Tool Hijacking and Spoofing
Warning
- Location
- scripts/gemini-on.sh:3
- Finding
- Execution of Unverified Scripts Outside the Audited Skill Boundary## Vulnerability Details **File Location**: `scripts/gemini-on.sh:3`, `scripts/gemini-off.sh:3`, and `scripts/gemini-status.sh:3-4` **Vulnerability Type**: Unverified delegation to mutable external tools **Risk Level**: Medium ### Vulnerable Code `scripts/gemini-on.sh:1-3`: ```bash #!/usr/bin/env bash set -euo pipefail /home/moltuser/clawd/scripts/gemini-on.sh ``` `scripts/gemini-off.sh:1-3`: ```bash #!/usr/bin/env bash set -euo pipefail /home/moltuser/clawd/scripts/gemini-off.sh ``` `scripts/gemini-status.sh:1-4`: ```bash #!/usr/bin/env bash set -euo pipefail cd /home/moltuser/clawd/skills/gemini-mcp ./scripts/gemini-status.sh ``` ### Technical Analysis These wrappers execute scripts located outside the audited project. The external implementations were not included in the supplied artifact, so their content, ownership, permissions, and integrity cannot be verified by this audit. This creates a trust-boundary weakness: a legitimate-looking invocation of the packaged Skill may execute different logic after review if one of the referenced external files is replaced or modified. No checksum, trusted-owner validation, restrictive-permission check, or other integrity control is performed before execution. The ON workflow is especially sensitive because `SKILL.md` states that its delegated implementation accesses Chromium through the Chrome DevTools Protocol, extracts the Google session cookies `__Secure-1PSID` and `__Secure-1PSIDTS`, and writes them to `~/.mcporter/mcporter.json`. Therefore, a compromised external implementation could operate in a credential-bearing context. The audited wrappers are not themselves evidence that the referenced scripts are currently malicious. The vulnerability is that runtime behavior depends on mutable, unaudited tools without integrity validation. ### Attack Path 1. An attacker obtains write access to one of the externally referenced scripts or to a parent di ...[truncated 1699 chars]
- Remediation
- ## Remediation Suggestions 1. Package the actual ON, OFF, and status implementations inside this Skill so that all executable behavior is included in the reviewed artifact. 2. Resolve bundled scripts relative to the wrapper's own canonical directory rather than through mutable absolute paths. For example: ```bash SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" exec "$SCRIPT_DIR/internal/gemini-on-impl.sh" ``` 3. If external delegation is operationally required: - Resolve and verify the canonical target path before execution. - Require the script and all relevant parent directories to be owned by an explicitly trusted account. - Reject files or directories writable by group members or other users. - Verify each target against a pinned cryptographic digest or authenticated manifest. - Invoke the validated absolute path with `exec` after all checks pass. 4. Apply restrictive permissions to scripts that handle authentication material, such as owner-only write permissions. 5. Separate cookie extraction from general operational scripts and grant only the minimum filesystem and browser access required. 6. Avoid delegating status checks to a sibling Skill directory unless that dependency is explicitly versioned, audited, and integrity-pinned. 7. Ensure session cookies and MCP configuration are never printed to logs or command output, and restrict `~/.mcporter/mcporter.json` to the owning user.
