T07 · Tool Hijacking and Spoofing
Error
- Location
- start_monitor.sh:1
- Finding
- Execution of an Unbundled Mutable Monitor Script and Broad Process Termination<![CDATA[ ## Vulnerability Details **File Location**: `start_monitor.sh`, lines 1–5 **Vulnerability Type**: Tool hijacking through execution of an external mutable script, combined with overly broad process termination **Risk Level**: High ### Vulnerable Code ```bash #!/bin/bash pkill -f monitor_web.py 2>/dev/null sleep 1 cd /home/fangjinan/.openclaw/workspace/skills/video-note-maker python3 monitor_web.py ``` ### Technical Analysis The launcher executes `monitor_web.py` from a hard-coded external workspace instead of resolving and executing a script bundled with the audited project. The referenced file is absent from the reviewed package, so its contents, provenance, and integrity cannot be established during the Skill audit. An actor who can modify the external `monitor_web.py` file can replace it with arbitrary Python code. The substituted code will execute with the privileges of the user who invokes `start_monitor.sh`. The command `pkill -f monitor_web.py` is also overly broad. The `-f` option matches against complete process command lines, so it may terminate unrelated processes merely because their command line contains `monitor_web.py`. The script does not verify process ownership, executable identity, or a Skill-specific PID before termination. ### Attack Path 1. An attacker obtains write access to `/home/fangjinan/.openclaw/workspace/skills/video-note-maker/monitor_web.py`, such as through another vulnerable local component, shared workspace permissions, or a compromised update process. 2. The attacker replaces or modifies `monitor_web.py` with an arbitrary Python payload. 3. The user invokes `start_monitor.sh`, believing it starts the legitimate monitoring component. 4. The launcher changes to the external directory and executes the attacker-modified file with the invoking user's privileges. 5. Before execution, `pkill -f monitor_web.py` may also terminate legitimate or unrelated processes whose command lines match that string. A denial-of-ser ...[truncated 774 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Bundle `monitor_web.py` inside the reviewed project so its contents are included in security review and release integrity checks. 2. Resolve the script relative to the launcher rather than through a user-specific absolute path: ```bash SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)" exec python3 "$SCRIPT_DIR/monitor_web.py" ``` 3. Verify the target is a regular file, is not a symbolic link, has an expected owner, and matches a release-provided cryptographic checksum before execution. 4. Replace `pkill -f` with a Skill-specific PID file stored in a permission-restricted runtime directory. 5. Before terminating a recorded PID, verify that it belongs to the current user and that `/proc/<pid>/exe` and its command line correspond to the expected bundled monitor. 6. Run the monitor with the minimum required filesystem and network permissions. 7. Fail closed when the expected bundled script or its integrity metadata is missing. ]]>
