T07 · Tool Hijacking and Spoofing
- Location
install.sh:38- Finding
System-Wide Command Hijacking Through a User-Writable Symbolic Link
- Content
View full analysis
Vulnerability Details
File Location:
install.sh, lines 38-42
Vulnerability Type: System-wide tool replacement using a symbolic link to user-writable code
Risk Level: MediumVulnerable Code
bash # 创建系统链接 if command -v sudo &> /dev/null; then sudo ln -sf "$SKILL_DIR/scripts/api-rate-limiter.sh" /usr/local/bin/api-rate-limiter else ln -sf "$SKILL_DIR/scripts/api-rate-limiter.sh" /usr/local/bin/api-rate-limiter fiTechnical Analysis
The installer uses
ln -sfto create or forcibly replace the system-wide command/usr/local/bin/api-rate-limiter. The symbolic link points to a script under$HOME/.openclaw/workspace/skills, which ordinarily remains writable by the account that installed the skill.Although creating the link under
/usr/local/binmay require elevated privileges, subsequent changes to the linked script do not require another privileged operation. Any process or account able to modify the workspace script can change the behavior of a command that appears to be a trusted system-wide utility.The force option also replaces an existing
/usr/local/bin/api-rate-limiterentry without checking its ownership, type, or origin and without requesting explicit confirmation. This can unexpectedly supersede a legitimate tool with the same name.Attack Path
- A user runs
install.shand authorizes thesudooperation. - The installer creates
/usr/local/bin/api-rate-limiteras a symbolic link to the script in the user's OpenClaw workspace. - An attacker compromises the installing account, exploits another process with write access to that workspace, or otherwise modifies
scripts/api-rate-limiter.sh. - Another user, administrator, or privileged automation invokes
api-rate-limiterthrough the normal command search path. - The modified script executes with the privileges and environment of that caller.
Exploitation requires write access to the linked ...[truncated 680 chars]
- A user runs
- Remediation
View remediation
Remediation Suggestions
-
Do not point a system-wide executable at a user-writable workspace. For system-wide installation, copy the script to a root-owned location such as
/usr/local/libexec/api-rate-limiter/and set restrictive ownership and permissions:bash sudo install -d -o root -g root -m 0755 /usr/local/libexec/api-rate-limiter sudo install -o root -g root -m 0755 \ "$SKILL_DIR/scripts/api-rate-limiter.sh" \ /usr/local/libexec/api-rate-limiter/api-rate-limiter sudo ln -s \ /usr/local/libexec/api-rate-limiter/api-rate-limiter \ /usr/local/bin/api-rate-limiter -
Prefer a per-user installation under
~/.local/binwhen system-wide availability is unnecessary. This avoids elevation and confines trust to the installing user. -
Do not use
ln -sfblindly. Before installation, check whether the destination already exists, inspect its ownership and type, and refuse to replace it unless the user explicitly approves the replacement. -
Make installation scope explicit through options such as
--userand--system. Requestsudoonly after the user deliberately selects system-wide installation. -
For a system-wide installation, verify after installation that the executable and every directory in its resolution path are not writable by unprivileged users.
-
Resolve installation paths relative to the script location rather than relying on the caller's current directory, and avoid the inconsistent hard-coded
/root/.openclaw/...paths present in the runtime scripts.
-
