T07 · Tool Hijacking and Spoofing
- Location
stock-price.sh:4- Finding
Hard-Coded External Script Path Creates Local Tool Hijacking Risk
- Content
View full analysis
Vulnerability Details
File Location:
stock-price.sh, line 4
Vulnerability Type:T07: Tool Hijacking and Spoofing
Risk Level: MediumVulnerable Code:
bash python3 /home/clawdbot/clawd/skills/stock-price-checker/stock-price.py "$@"Technical Analysis
The shell launcher does not execute the audited
stock-price.pylocated in the same project directory. Instead, it invokes a Python file at a hard-coded external filesystem path:/home/clawdbot/clawd/skills/stock-price-checker/stock-price.pyThe contents of that external file may differ from the script included in this package. This breaks the package integrity boundary and creates a local tool-hijacking opportunity: another user, process, installer, or compromised component with write access to the target file or one of its parent directories could replace the referenced script.
Argument forwarding itself is safely quoted through
"$@"; the finding is specifically the unsafe reliance on code outside the reviewed package.Attack Path
- An attacker obtains write access to the hard-coded script path, or can create the referenced path before deployment.
- The attacker places a malicious
stock-price.pyat that location. - A user invokes the bundled
stock-price.sh, expecting it to run the reviewed project script. - The launcher starts Python with the attacker-controlled external file.
- The malicious code executes with the invoking user's privileges.
Exploitation requires filesystem write access to the referenced file or a relevant parent directory. The reviewed project contains no code that grants such access and no malicious replacement payload was identified.
Impact Assessment
Successful exploitation permits arbitrary Python code execution under the account that launches
stock-price.sh. The attacker could access files and credentials available to that account, modify user-owned data, make network requests, or ex ...[truncated 146 chars]- Remediation
View remediation
Remediation Suggestions
Resolve the Python script relative to the launcher's own directory and replace the shell process with Python:
bash #!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" exec python3 "$SCRIPT_DIR/stock-price.py" "$@"Additionally:
- Package and deploy the launcher and Python script together.
- Ensure the package directory and files are not writable by untrusted users.
- If a fixed installation path is operationally required, verify ownership and permissions before execution and use deployment-time integrity verification.
- Add a test confirming that the launcher executes the adjacent audited script rather than an external copy.
