T07 · Tool Hijacking and Spoofing
- Location
scripts/test_pose.sh:7- Finding
External Script Substitution Through a Hard-Coded Skill Directory
- Content
View full analysis
Vulnerability Details
File Location:
scripts/test_pose.sh, lines 7–9
Vulnerability Type: Tool hijacking through external script substitution
Risk Level: MediumVulnerable Code:
bash cd ~/.openclaw/workspace/skills/ros1-for-robot5/scripts python3 get_pose_tf.py "$@"Technical Analysis
The launcher does not execute the
get_pose_tf.pyfile bundled with the audited skill. Instead, it changes into the hard-coded directory of a different skill,~/.openclaw/workspace/skills/ros1-for-robot5/scripts, and executes the relative filenameget_pose_tf.pyfound there.This creates a trust-boundary violation: the apparent launcher belongs to this package, but the executed Python code is selected from an external, separately mutable directory. It also conflicts with the documented Cartographer project layout. Quoting
"$@"correctly protects the forwarded arguments from shell splitting, but it does not mitigate substitution of the Python script itself.Attack Path
- An attacker gains write access to
~/.openclaw/workspace/skills/ros1-for-robot5/scripts, or a compromised/untrusted skill installation controls that path. - The attacker creates or replaces
get_pose_tf.pyin that directory with malicious Python code. - A user invokes the audited
scripts/test_pose.shlauncher, expecting it to run this package's pose utility. - The launcher changes into the attacker-controlled or compromised external directory.
python3 get_pose_tf.py "$@"executes the substituted script with the invoking user's privileges.
Impact Assessment
Successful exploitation permits arbitrary Python code execution with the privileges and environment of the user running
test_pose.sh. The substituted script could read or modify files accessible to that user, access ROS resources exposed to the process, issue unintended robot operations, or impersonate the expected pose utility.The scope is limited to th ...[truncated 213 chars]
- An attacker gains write access to
- Remediation
View remediation
Remediation Suggestions
Resolve the launcher directory from the location of
test_pose.shand execute the bundled Python script by absolute path:bash #!/usr/bin/env bash set -euo pipefail source /opt/ros/noetic/setup.bash source "$HOME/robot5/devel/setup.bash" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" exec python3 "$SCRIPT_DIR/get_pose_tf.py" "$@"Additional hardening measures:
- Remove the hard-coded reference to the unrelated
ros1-for-robot5skill. - Avoid changing the working directory when an absolute script path is sufficient.
- Fail closed with
set -euo pipefailif ROS environment initialization or path resolution fails. - Restrict write permissions on the installed skill directory to trusted administrators or the owning user.
- Add a test that verifies the resolved Python script remains inside this package's
scriptsdirectory. - If external script execution is intentionally required, make the path explicit in configuration and verify ownership, permissions, and integrity before execution.
- Remove the hard-coded reference to the unrelated
