T09 · Insecure Skill Coding Practices
- Location
scripts/safe-config-modify.sh:72- Finding
Arbitrary Shell Command Execution Through the Configuration Modification Interface
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This OpenClaw rescue toolkit is mostly purpose-aligned, but it installs persistent automation with several under-scoped operations that can kill processes, rewrite agent state, delete files, or execute writable configuration as shell code.
Install only if you are comfortable with persistent local automation that can restart OpenClaw, kill processes on the gateway port, send configured alerts externally, and clean or rewrite OpenClaw logs, sessions, memory, and configuration history. Review the scripts first, avoid running --auto-schedule until tested, keep notify.conf private, and do not rely on log-cleaner.sh --dry-run as a safe preview in this version.
scripts/safe-config-modify.sh:72Arbitrary Shell Command Execution Through the Configuration Modification Interface
scripts/core.sh:25Executable Notification Configuration Loaded by Persistent Jobs
scripts/gateway-start.sh:20Indiscriminate Termination of Processes Based Only on Port Ownership
scripts/log-cleaner.sh:341Documented Dry-Run Mode Still Performs Destructive Operations
scripts/log-cleaner.sh:174Scheduled Cleaner Destructively Rewrites Session and Memory Data
scripts/log-cleaner.sh:323Recursive Temporary-File Deletion Is Not Restricted to Skill-Owned Paths
scripts/install-rescue-kit.sh:274Installer Rewrites an Existing Gateway LaunchAgent Before Scheduling Consent
scripts/git-tag.sh:82Overbroad Git Snapshots Can Permanently Retain Plaintext Secrets
The skill includes setup for Feishu/Telegram/WeChat/DingTalk alert delivery and local storage of failed alerts, but this outbound messaging capability is not clearly highlighted in the core purpose statement. In a system-management skill, undeclared external communications materially change the trust boundary because logs, host state, or incident details may leave the machine.
The skill includes setup for Feishu/Telegram/WeChat/DingTalk alert delivery and local storage of failed alerts, but this outbound messaging capability is not clearly highlighted in the core purpose statement. In a system-management skill, undeclared external communications materially change the trust boundary because logs, host state, or incident details may leave the machine.
The skill includes setup for Feishu/Telegram/WeChat/DingTalk alert delivery and local storage of failed alerts, but this outbound messaging capability is not clearly highlighted in the core purpose statement. In a system-management skill, undeclared external communications materially change the trust boundary because logs, host state, or incident details may leave the machine.
The skill includes setup for Feishu/Telegram/WeChat/DingTalk alert delivery and local storage of failed alerts, but this outbound messaging capability is not clearly highlighted in the core purpose statement. In a system-management skill, undeclared external communications materially change the trust boundary because logs, host state, or incident details may leave the machine.
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
) | 手动/被其他脚本调用 |
# 查看所有配置快照
bash ~/.openclaw/scripts/git-tag.sh list
# 快速回滚到上一个安全版本
bash ~/.openclaw/scripts/git-tag.sh quick-rollback
# 回滚到指定版本
bash ~/.openclaw/scripts/git-tag.sh rollback <tag-name>
macOS 上 crontab 受 SIP 限制,推荐使用 LaunchAgent。
安装脚本会自动生成 plist 到 ~/.openclaw/launchagents-ready/(路径已正确替换)。
如果安装脚本因沙箱权限无法自动复制,请手动执行:
# 复制已准备好的 plist(路径已替换,无需手动修改)
cp ~/.openclaw/launchagents-ready/*.plist ~/Library/LaunchAgents/
# 加载所有服务
launchctl load ~/Library/LaunchAgents/ai.openclaw.watchdog.plist
launchctl load ~/Library/LaunchAgents/ai.openclaw.healthcheck.plist
launchctl load ~/Library/LaunchAgents/ai.openclaw.logcleaner.plist
l
The script uses 'source' on notify.conf, which executes arbitrary shell code in the script's context rather than safely parsing configuration values. If an attacker can modify that file, or if it is populated from an untrusted source, they gain arbitrary code execution with the privileges of whoever runs the diagnostic script.
Blindly deleting a fixed lock file under /tmp is dangerous because /tmp is attacker-writable and vulnerable to symlink and file-replacement attacks. If this script runs with elevated privileges, an attacker may be able to pre-create /tmp/openclaw-gateway.lock as a symlink or manipulate the path so the watchdog deletes an unintended file, causing denial of service or clobbering state.
fi
# 清理过期锁文件
rm -f /tmp/openclaw-gateway.lock 2>/dev/null || true
}
# ==================== 重启网关 ====================
The script advertises a global --dry-run mode, but only clean_rollback_backups receives and respects that flag. Other cleanup routines still execute destructive actions such as rm, mv, gzip-and-delete, and find -delete, which can mislead operators into believing no changes will occur and cause unintended data loss. In a recovery/maintenance skill that users may run during outages, this mismatch is especially dangerous because it encourages use under stress and against valuable logs, sessions, backups, and temp files.
The script uses source "$NOTIFY_CONF", which executes the configuration file as shell code rather than parsing it as data. If an attacker can modify ~/.openclaw/notify.conf, they can achieve arbitrary command execution whenever the notification script runs, which exceeds the script's stated notification purpose and is especially dangerous for a watchdog/rescue kit likely to run automatically.
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
echo ""
echo "删除多余服务命令 mac:"
echo "OS: launchctl remove <service-name>"
echo " Linux: sudo systemctl stop <service-name> && sudo systemctl disable <service-name>"
fi
return 1
The README advertises automatic rollback, restart, port cleanup, and log cleaning, but it does not clearly warn users that these actions can modify configuration, terminate processes, or delete operational data without interactive confirmation. In a resilience/ops skill, unattended state-changing behavior is expected, but omitting explicit impact warnings increases the risk of accidental disruption or data loss during deployment.
The manual installation instructions copy executable scripts into a persistent user directory and then run an installer from that location, establishing durable local execution artifacts. Persistence is expected for an ops toolkit, but this still creates long-lived code on disk and should be disclosed clearly because it changes the user's environment beyond a one-time command.
mkdir -p ~/.openclaw/scripts ~/.openclaw/logs ~/.openclaw/backups
cp ~/.openclaw/skills/openclaw-rescue-kit/scripts/*.sh ~/.openclaw/scripts/
chmod +x ~/.openclaw/scripts/*.sh
bash ~/.openclaw/scripts/install-rescue-kit.sh
The webhook setup directs users to send alerts to external services, but it does not warn that logs, hostnames, error details, or other operational metadata may leave the local environment. This can create unintended data disclosure, especially if alerts contain sensitive configuration or incident details.
The LaunchAgent and cron examples enable unattended recurring execution of watchdog, health check, log cleanup, and Git tagging tasks, but the README does not clearly warn that these jobs will continue running automatically and may repeatedly modify system state. This raises the chance of persistent unexpected behavior, repeated restarts, or ongoing file changes after installation.
Copying plist files into ~/Library/LaunchAgents installs persistent per-user background job definitions that survive beyond the current session. In context this is intentional watchdog automation, but it still creates durable background execution and should be treated as a state-changing action requiring explicit consent and removal instructions.
# plist 已生成到 ~/.openclaw/launchagents-ready/
cp ~/.openclaw/launchagents-ready/*.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/ai.openclaw.*.plist
The launchctl load command actively enables the LaunchAgents so they begin running automatically in future sessions and possibly immediately. This is legitimate for a watchdog skill, but without a strong warning and disable instructions it can surprise users with persistent background behavior and recurring process execution.
# plist 已生成到 ~/.openclaw/launchagents-ready/
cp ~/.openclaw/launchagents-ready/*.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/ai.openclaw.*.plist
The launchctl load command actively enables the LaunchAgents so they begin running automatically in future sessions and possibly immediately. This is legitimate for a watchdog skill, but without a strong warning and disable instructions it can surprise users with persistent background behavior and recurring process execution.
# plist 已生成到 ~/.openclaw/launchagents-ready/
cp ~/.openclaw/launchagents-ready/*.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/ai.openclaw.*.plist
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.
cat ~/.openclaw/logs/unsent_alerts.log
ls -la ~/.openclaw/backups/ bash ~/.openclaw/scripts/git-tag.sh list
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.
cat ~/.openclaw/logs/unsent_alerts.log
ls -la ~/.openclaw/backups/ bash ~/.openclaw/scripts/git-tag.sh list
The skill advertises and instructs shell execution, file copying, service installation, and scheduler setup, but it does not declare any explicit tool scope or allowed-tools/permissions boundary. That omission weakens reviewability and can cause the skill to be invoked or trusted without clear disclosure that it drives persistent system-level shell actions.
The activation text is broad enough to match many ordinary support situations such as crashes, rollback, cleanup, or deployment help. In context, that increases the chance this skill is invoked inappropriately and then suggests persistent shell-based system modifications that may exceed what the user intended.
The installation instructions direct users to create directories, copy executable scripts, chmod them, and run an installer, all without a strong warning that these commands change the local system and may establish persistent background behavior. In a skill context, this is risky because users may treat the commands as routine troubleshooting steps and not appreciate the level of access or persistence being introduced.
The manual installation sequence writes executables into a persistent user directory and prepares them for later automated use. While not persistence by itself to the same degree as cron or LaunchAgents, it lays the groundwork for long-lived system modification and should be treated as a security-relevant behavior in a skill.
mkdir -p ~/.openclaw/scripts ~/.openclaw/logs ~/.openclaw/backups
cp ~/.openclaw/skills/openclaw-rescue-kit/scripts/*.sh ~/.openclaw/scripts/
chmod +x ~/.openclaw/scripts/*.sh
bash ~/.openclaw/scripts/install-rescue-kit.sh
The LaunchAgent guidance explicitly recommends a persistence mechanism for macOS background execution. Persistent agents can continue running independently of user intent, and in this skill they are meant to monitor, restart, and modify application state over time.
macOS 上 crontab 受 SIP 限制,推荐使用 LaunchAgent。
安装脚本会自动生成 plist 到 `~/.openclaw/launchagents-ready/`(路径已正确替换)。
如果安装脚本因沙箱权限无法自动复制,请手动执行:
Copying plists into ~/Library/LaunchAgents installs per-user startup jobs, a classic persistence method. This is not inherently malicious in an admin toolkit, but it is security-sensitive and dangerous when presented without strong disclosure because it causes commands to run automatically on future sessions.
如果安装脚本因沙箱权限无法自动复制,请手动执行:
# 复制已准备好的 plist(路径已替换,无需手动修改)
cp ~/.openclaw/launchagents-ready/*.plist ~/Library/LaunchAgents/
# 加载所有服务
No suspicious patterns detected.