Back to skill

Security audit

openclaw-stable-running

Security checks for vulnerabilities and agentic risk

Overview

This skill is an OpenClaw operations guide, but it includes persistent service setup and a network monitor that can change system routing without enough safeguards.

Review this before installing on a real host. Only run the systemd, PM2, cron, and network-monitor pieces after confirming they match your deployment, use a dedicated low-privilege openclaw user where possible, protect the .env file, add rollback steps, and fix the network route and cleanup scripts before unattended use.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/network_monitor.sh:3
Finding

Unvalidated Environment Parameters Reach Privileged Network Routing Commands

Content
View full analysis
> "$LOG_FILE"; } check_iface() { ping -c $CHECK_COUNT -I $1 $CHECK_TARGET > /dev/null 2>&1; } log "Network monitoring started, backup: $MAIN_IFACE -> $BACKUP_IFACE" while true; do if ! check_iface $MAIN_IFACE; then log "Primary network failed, switching to $BACKUP_IFACE" ip route replace default dev $BACKUP_IFACE 2>> "$LOG_FILE" ``` ### Technical Analysis `MAIN_IFACE`, `BACKUP_IFACE`, and `CHECK_TARGET` can be supplied through the process environment. Their values are used in `ping` and `ip` invocations without validation or quoting. Unquoted shell expansions undergo word splitting and pathname expansion. Consequently, one environment value can become multiple command-line arguments. Values beginning with option-like characters may also be interpreted as options rather than interface names or connectivity targets. This does not directly cause shell metacharacters embedded inside a variable to be parsed as new shell syntax. However, it does permit argument and option injection into security-sensitive system utilities. The risk is especially significant because `ip route replace default` requires elevated network-administration privileges, normally root or `CAP_NET_ADMIN`. The script also automatically changes the system default route whenever the connectivity test fails. It does not verify that the backup interface exists, is operational, belongs to an approved interface set, or provides the intended gateway. ### Attack Path 1. An attacker or less-privileged deployment component obtains control over the environment used to launch the monitor. 2. The attacker supplies mal ...[truncated 1189 chars]
Remediation
View remediation
/dev/null 2>&1 } ip route replace default dev "$BACKUP_IFACE" ``` 2. Validate interface names against interfaces that actually exist: ```bash validate_iface() { local iface="$1" [[ "$iface" =~ ^[A-Za-z0-9_.:-]+$ ]] && ip link show dev "$iface" >/dev/null 2>&1 } ``` 3. Reject values beginning with `-` and enforce an explicit allowlist when the expected interfaces are known. 4. Validate `CHECK_TARGET` as an approved IP address or hostname. Prefer a fixed configuration file owned by root over an untrusted process environment. 5. Verify that the backup interface is operational and has an approved gateway before changing the default route. 6. Run the monitor in a dedicated network namespace where possible. Otherwise, grant only the specific capability required, such as `CAP_NET_ADMIN`, rather than running it with unrestricted root privileges. 7. Add a rollback mechanism and rate limiting so a failed backup route does not leave the host disconnected or cause repeated route changes. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/cleanup.sh:43
Finding

Unsafe Log Cleanup Pipeline Can Delete Unintended Files

Content
View full analysis
/dev/null 2>&1; then TOTAL_SIZE=$(du -sm "$LOGDIR" 2>/dev/null | awk '{print $1}') if [ "$TOTAL_SIZE" -gt 500 ]; then log "Log directory exceeds 500MB, currently ${TOTAL_SIZE}MB; starting cleanup..." find "$LOGDIR" -name "*.log" -type f -exec ls -lt {} + 2>/dev/null \ | tail -n +20 | awk '{print $NF}' | xargs rm -f 2>/dev/null log "Cleanup completed" ``` ### Technical Analysis The cleanup process obtains filenames from `find`, formats them with `ls -lt`, extracts the final whitespace-delimited field using `awk`, and passes the result through `xargs` to `rm`. Filenames on Unix can contain spaces, tabs, quotes, backslashes, and newlines. Neither `ls` output nor whitespace-delimited `awk` and `xargs` processing safely preserves those filenames. A single filename may therefore be divided into multiple deletion arguments, while the value extracted by `awk` may not be the original path returned by `find`. The command also does not use `rm --`, so a malformed parsed value beginning with `-` may be interpreted as an option. Errors are suppressed, making unexpected deletion behavior difficult to detect. The vulnerable path is activated only when `/var/log/openclaw` exceeds 500 MB, but it may also run automatically through the documented cron configuration. ### Attack Path 1. An attacker gains permission to create or rename a `*.log` file beneath `/var/log/openclaw`. 2. The attacker gives the file a name containing whitespace, newline characters, or other delimiters that the `ls | awk | xargs` pipeline does not preserve. 3. The log directory grows beyond the 500 MB threshold, either naturally or through attacker-created data. 4. The scheduled or manually invoked cleanup script processes the crafted filenam ...[truncated 1075 chars]
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (25)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a high-availability watchdog/auto-recovery system for OpenClaw. However, the supplied code is only a maintenance cleanup script intended for cron execution. It performs deletion of old logs and temp files and enforces a rough log size cap. While 'resource recycling' is loosely related, that is only one minor aspect of the broad claimed functionality. The core promised capabilities—process守护, 异常重启, 断连重连, 断点续跑, and active日志监控—are absent. Therefore the description materially overstates and misrepresents the actual behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

The code does implement part of the declared description: process guarding, health checking, exception-triggered restart, and logging. However, the description materially overstates the implemented functionality. There is no code for reconnecting broken sessions, resuming unfinished work from checkpoints, reclaiming resources, or monitoring/analyzing logs; it only writes to a log file. The script is specifically a periodic gateway liveness/health check plus restart mechanism, not a full 7×24 stability framework with the broader guarantees claimed. No obviously undeclared sensitive capabilities appear, but the declared purpose does not accurately match the narrower actual behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The description promises a broad high-availability runtime management solution for OpenClaw, including daemon/process supervision, abnormal restart, reconnect/retry, resumable execution, resource reclamation, and log monitoring. The provided code only implements one narrow piece: periodic network health checks and failover from a main interface to a backup interface by replacing the default route. While '断连重连' loosely relates to connectivity resilience, the primary purpose and capabilities of the code are materially narrower than described, and it performs network route modification that is not specifically disclosed. Therefore the declared description does not accurately represent this code chunk.

Content

No source excerpt is available for this finding.

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · SKILL.md (reported line 8)May include surrounding context.

md
---
AIGC:
    ContentProducer: Minimax Agent AI
    ContentPropagator: Minimax Agent AI
    Label: AIGC
    ProduceID: "00000000000000000000000000000000"
    PropagateID: "00000000000000000000000000000000"
    ReservedCode1: 30460221009cdb3097529c88f77219dcc01d64b15e5cbbf872e4424fb8e4ec052b0ab62408022100b48fe52b42cc75c315de5d1910da49b4d73e29d46bcfe8e646d112e958f6f3ef
    ReservedCode2: 3046022100b44b95cbe6aab8748be573ebe4c8899a359bfc699ea9c207542d7a5f26577a84022100bf965b7cadef1fb9fd0d983cbdd00c97246646ae056edc34959a9280414dd4ba
description: OpenClaw 7×24 小时长稳运行方案 — 进程守护、异常重启、断连重连、断点续跑、资源回收、日志监控。确保 OpenClaw 零崩溃、零断连、零漏执行。无人值守必备。
name: openclaw-stable-running
tags:
    - openclaw
    - 运维

Credential Access

High
Category
Privilege Escalation
Confidence
84% confidence
Finding

The service file loads secrets from /home/openclaw/.openclaw/.env, and the surrounding guidance also routes logs to journald. This creates a realistic risk that credentials are stored in plaintext, exposed through weak file permissions, inherited by child processes, or accidentally surfaced in diagnostics during troubleshooting.

Content

Scanner excerpt · SKILL.md (reported line 74)May include surrounding context.

md
MemoryMax=2G
TasksMax=4096
Environment="NODE_ENV=production"
EnvironmentFile=/home/openclaw/.openclaw/.env
StandardOutput=journal
StandardError=journal
SyslogIdentifier=openclaw

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · SKILL.md (reported line 320)May include surrounding context.

2 重启 } }, 60000);

text

启动时开启 GC:`node --expose-gc your-app.js`

### 文件句柄限制

```bash
# 永久提高(/etc/security/limits.conf)
* soft nofile 65535
* hard nofile 65535

# systemd
LimitNOFILE=65535

定期清理

bash
# cleanup.sh - 清理 7 天前日志
find /var/log/openclaw -name "*.log" -mtime +7 -delete
find /tmp/openclaw -type f -mtime +1 -delete

# crontab
0 3 * * * /home/openclaw/scripts/cleanup.sh

六、日志与监控

日志轮转(logrotate)

bash
# /etc/logrotate.d/openclaw
/var/log/openclaw/*.log {
    daily
    rotate 7
    compress
    delaycompress
    missingok
    notifempty
    create 0640 openclaw openclaw
}

检查清单

检查项命令预期结果
服务状态systemctl status openclawactive (running)
开机自启systemctl is-enabled openclawenabled
日志正常journalctl -u openclaw -n 50无 ERROR
内存使用

Chaining Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

The pipeline find ... | tail ... | awk ... | xargs rm -f is unsafe because it parses file paths through whitespace-delimited text processing and then passes them to rm. Log file names containing spaces, newlines, or shell-metacharacter-like characters can be misparsed, causing unintended files to be deleted; in unattended cleanup automation, this makes operational damage more likely.

Content

Scanner excerpt · scripts/cleanup.sh (reported line 47)May include surrounding context.

sh
if [ "$TOTAL_SIZE" -gt 500 ]; then
            log "日志目录超过 500MB,当前 ${TOTAL_SIZE}MB,开始精简..."
            find "$LOGDIR" -name "*.log" -type f -exec ls -lt {} + 2>/dev/null \
                | tail -n +20 | awk '{print $NF}' | xargs rm -f 2>/dev/null
            log "精简完成"
        else
            log "日志目录大小正常: ${TOTAL_SIZE}MB"

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill includes numerous shell commands and system-management actions but does not declare any explicit tool scope or permissions boundary. In an agent ecosystem, undocumented shell capability increases the chance that the skill will be executed with broader privileges than users expect, weakening review and consent controls.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 44)May include surrounding context.

md
| 方案 | 崩溃后自启 | 开机自启 | 日志管理 | 资源限制 |
|------|------------|----------|----------|----------|
| nohup | ❌ | ❌ | ❌ 需手动 | ❌ |
| screen | ❌ | ❌ | ❌ | ❌ |
| **systemd** | ✅ | ✅ | ✅ 内置 | ✅ cgroups |
| **PM2** | ✅ | ✅ | ✅ | ✅ |

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
88% confidence
Finding

The skill instructs use of sudo to manage system services, which is a privileged operation with host-wide effect. In agent contexts, embedding privileged commands in a skill can lead to unintended elevation, persistent service installation, or system configuration changes if executed without strong operator review.

Content

Scanner excerpt · SKILL.md (reported line 90)May include surrounding context.

启用服务:

bash
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
sudo systemctl status openclaw

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
90% confidence
Finding

sudo systemctl enable openclaw establishes persistent startup behavior at boot and requires elevated privileges. This is sensitive because it changes system state durably and may cause an agent-managed service to survive beyond the user's immediate session or intent.

Content

Scanner excerpt · SKILL.md (reported line 91)May include surrounding context.

启用服务:

bash
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
sudo systemctl status openclaw
journalctl -u openclaw -f

Session Persistence

Medium
Category
Rogue Agent
Confidence
94% confidence
Finding

systemctl enable configures the service to start automatically on boot, which is a durable persistence mechanism. In agent skills, persistence is especially sensitive because it changes machine behavior beyond the immediate task and can be abused or misunderstood by users.

Content

Scanner excerpt · SKILL.md (reported line 91)May include surrounding context.

启用服务:

bash
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
sudo systemctl status openclaw
journalctl -u openclaw -f

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
86% confidence
Finding

sudo systemctl start openclaw launches a privileged managed service and may start processing unattended workloads immediately. In the skill context, this is operationally powerful and should not be treated as harmless documentation because users may copy-paste it directly.

Content

Scanner excerpt · SKILL.md (reported line 92)May include surrounding context.

bash
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
sudo systemctl status openclaw
journalctl -u openclaw -f

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
72% confidence
Finding

sudo systemctl status openclaw is lower risk than enable/start because it is primarily observational, but it still uses privileged execution patterns and normalizes running systemd commands as root. In a skill package, repeated root-oriented guidance can encourage overprivileged operation.

Content

Scanner excerpt · SKILL.md (reported line 93)May include surrounding context.

sudo systemctl daemon-reload sudo systemctl enable openclaw sudo systemctl start openclaw sudo systemctl status openclaw journalctl -u openclaw -f

text

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

Adding a crontab healthcheck creates recurring unattended execution, which is a persistence mechanism in practical terms. In a skill context, scheduled tasks can continue running after the original session ends, repeatedly restarting services or executing scripts without ongoing user awareness.

Content

Scanner excerpt · SKILL.md (reported line 132)May include surrounding context.

每 5 分钟检查一次 Gateway 是否存活,见 scripts/healthcheck.sh:

bash
# crontab -e
*/5 * * * * /home/openclaw/scripts/healthcheck.sh

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill recommends automated deletion of logs and temporary files with broad find ... -delete patterns but does not warn about data-loss, retention, forensic, or path-safety risks. In unattended operations, an overly broad path, symlink issue, or mislocated directory could destroy operational evidence or needed files.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 348)May include surrounding context.

md
| 检查项 | 命令 | 预期结果 |
|--------|------|----------|
| 服务状态 | `systemctl status openclaw` | `active (running)` |
| 开机自启 | `systemctl is-enabled openclaw` | `enabled` |
| 日志正常 | `journalctl -u openclaw -n 50` | 无 ERROR |
| 内存使用 | `free -h` | 有余量 |
| 文件句柄 | `ulimit -n` | ≥ 65535 |

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 353)May include surrounding context.

md
| 内存使用 | `free -h` | 有余量 |
| 文件句柄 | `ulimit -n` | ≥ 65535 |
| 健康检查 | `curl localhost:9527/health` | `200 OK` |
| 定时任务 | `crontab -l` | 有 healthcheck |

---

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This shell script’s natural-language documentation and operational log messages are written in Chinese, which imposes a specific language on operators and users without any opt-in or alternative. Under the policy, language constraints should either be optional for the user or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script automatically replaces the system default route when the main interface check fails, which can affect system connectivity and traffic flow. Although it logs to a file, there is no user-facing disclosure, prompt, comment, or inline explanation warning that the skill will modify routing state.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The skill advises automatic restart when health checks fail, but it does not warn that this can interrupt in-progress work, duplicate jobs, or worsen corruption if state persistence is incomplete. In a long-running agent workflow, forced restarts can create reliability and integrity issues.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file contains user-facing instructional content exclusively in Chinese, and nowhere indicates that the language is optional or region-specific. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The natural-language comments and usage text are entirely in Chinese, which imposes a specific language on operators reading or maintaining the skill. The file does not indicate that the script is intentionally region-specific or provide any opt-in or alternative language support.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This file’s natural-language content, including the title, usage notes, and inline comments, is exclusively in Chinese. Under the stated policy, forcing a specific language without offering choice or documenting a justified locale constraint is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script's natural-language status messages are written only in Chinese, which imposes a specific language choice on users without offering an alternative or documenting a locale-specific constraint. This can violate language or locale policy where user-facing text should be selectable or justified.

Content

No source excerpt is available for this finding.