Back to skill

Security audit

OpenClaw Security Handbook (CN)

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent OpenClaw security-audit helper, but it handles secrets, memory contents, and fix guidance in ways that could expose sensitive data or lead users to run unsafe commands.

Install only if you are comfortable letting the agent inspect sensitive OpenClaw configuration, logs, sessions, credentials metadata, and memory files. Before running its diagnostic commands, prefer redacted or metadata-only checks, do not paste raw secret output into chat or reports, review every generated remediation before executing it, and treat workspace deletion, token rotation, sudo/chattr, Docker/network changes, and cron scheduling as manual high-impact actions.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
references/checklist.md:55
Finding

Diagnostic Commands Expose Plaintext Credentials and Secrets

Content
View full analysis
/dev/null | grep -v ".jsonl:" | head -20 grep -rEn "sk-|password|secret|token" ~/.openclaw/logs/ 2>/dev/null | head -20 ``` `references/checklist.md:55`: ```bash # Check token length (expected: 64 hexadecimal characters / 256 bits) grep -E "gateway.*token|OPENCLAW_GATEWAY_TOKEN" ~/.openclaw/.env ``` `references/checklist.md:66-67`: ```bash # Scan for plaintext secrets grep -rEn "sk-|AKIA-|password|secret|token|private.key" ~/.openclaw/sessions/ 2>/dev/null grep -rEn "sk-|password|secret|token" ~/.openclaw/logs/ 2>/dev/null ``` `references/checklist.md:153`: ```bash echo "=== Log exposure ===" && grep -rEn "sk-|password|secret" ~/.openclaw/sessions/ 2>/dev/null | head -5 ``` ### Technical Analysis The diagnostic commands use recursive `grep` without redacting matched values or limiting output to filenames. Standard `grep -n` output contains the complete matching line, including any API key, gateway token, password, private-key material, or session secret found on that line. Accessing credential-related files can be justified for a security audit, but reading and displaying their plaintext values exceeds the minimum privilege and data access required to determine whether insecure secrets exist. Token strength can be checked without printing the token, and log scanning can report filenames, line numbers, counts, or redacted fingerprints. The output can enter the Agent conversation context, terminal scrollback, command-capture logs, generated reports, monitoring systems, or other records with weaker access controls than the original files. ### Attack Path 1 ...[truncated 1100 chars]
Remediation
View remediation
/dev/null ``` - If line-level diagnostics are necessary, perform redaction before output and disclose only a short fingerprint, never the complete value. - Check token length in a local process that emits only a Boolean result or character count. - Require explicit user consent before inspecting secret-bearing file contents. - Prevent findings containing matched secret text from being copied into reports or Agent conversation context. - Add regression tests using synthetic credentials and verify that no complete test credential appears in stdout or stderr. ]]>

other

Warning
Location
SKILL.md:82
Finding

Security Audit Reads Agent Memory Contents Without Performing Integrity Verification

Content
View full analysis
/dev/null | head -50 ls -lt ~/.openclaw/workspace/memory/ 2>/dev/null | head -10 ``` `references/checklist.md:103-104`: ```bash # Check whether memory has been tampered with cat ~/.openclaw/workspace/MEMORY.md | head -30 ls -la ~/.openclaw/workspace/memory/ ``` ### Technical Analysis The commands are described as memory-integrity checks, but printing the first 30 or 50 lines of `MEMORY.md` does not establish integrity. It merely discloses memory contents to the audit session. Persistent Agent memory may contain private conversation context, user preferences, operational details, identifiers, or long-lived instructions. Reading it into an Agent-driven audit also introduces an instruction-boundary risk: attacker-controlled text stored in memory may be interpreted as instructions rather than inert data if the surrounding system does not reliably isolate tool output. The listing commands are less invasive and can be appropriate for examining metadata. The `cat` commands exceed the minimum access needed for an integrity check because integrity should be established using trusted hashes, signatures, ownership, permissions, timestamps, or comparison against a known-good baseline. ### Attack Path 1. Sensitive information or attacker-controlled text is written into `~/.openclaw/workspace/MEMORY.md`. 2. The security audit follows the documented memory check. 3. The first portion of the memory file is emitted into the terminal or Agent context. 4. Sensitive memory content becomes available in audit output or associated logs. 5. If the surrounding Agent treats file output as actionable instructions, hostile text may influence subsequent audit behavior. 6. Even without instructio ...[truncated 647 chars]
Remediation
View remediation

T01 · Skill Instruction Hijacking

Error
Location
scripts/security-report.py:133
Finding

Untrusted Remediation Text Is Presented as Safe Automatic Fix Guidance

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
Findings (48)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

代码的实际功能是“发布/分发技能”,而不是声明中的“安全审计与加固”。这属于主要目的明显不一致:声明描述的是终端用户使用该技能后的安全检查能力,但给出的代码块仅是维护者使用的发布脚本。虽然脚本中的元数据文本复述了该安全技能的描述,但自身并未实现任何审计、报告、修复引导或定时调度逻辑。因此应判定为描述与代码行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

描述将该技能定位为一个较完整的安全审计与加固系统,而提供的代码只是一个审计结果格式化器/包装器。它确实会触发一次 openclaw security audit --json,并生成结构化报告,也会在 --fix 时列出修复建议,因此与“生成结构化报告”部分相符。但关键声明能力缺失:没有看到任何基于安全手册的额外检查逻辑,没有交互式修复流程,没有定时调度,也没有实际执行加固或修复。因此描述明显夸大了代码实际能力,属于实质性不匹配。

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

The skill explicitly instructs inspection of ~/.openclaw/.env and ~/.openclaw/credentials, and it also greps logs and sessions for tokens, passwords, and secrets. Even in an audit context, this is highly sensitive credential-access behavior that can expose secrets in the model context, terminal output, logs, or generated reports if not carefully minimized and redacted.

Content

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

检查关键文件和目录权限

ls -la ~/.openclaw/ stat -c "%a %n" ~/.openclaw/openclaw.json stat -c "%a %n" ~/.openclaw/.env stat -c "%a %n" ~/.openclaw/credentials/

text

Credential Access

High
Category
Privilege Escalation
Confidence
85% confidence
Finding

The checklist instructs users to grep ~/.openclaw/.env for gateway token material. Even though the intent is defensive, this directly exposes credential values in terminal output and shell history, which can leak secrets through screenshots, logs, scrollback, or support transcripts.

Content

Scanner excerpt · references/checklist.md (reported line 55)May include surrounding context.

令牌强度

bash
# 检查令牌长度(应为 64 字符 hex = 256 位)
grep -E "gateway.*token|OPENCLAW_GATEWAY_TOKEN" ~/.openclaw/.env

文件权限

YARA rule 'offensive_tool_references': References to well-known offensive security tools [hacktools]

High
Category
YARA Match
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · references/checklist.md (reported line 117)May include surrounding context.

grep NetworkMode

text

### OAuth 令牌
```bash
# 检查活跃的 OAuth 授权
ls -la ~/.openclaw/credentials/

记忆文件

bash
# 检查记忆是否被篡改
cat ~/.openclaw/workspace/MEMORY.md | head -30
ls -la ~/.openclaw/workspace/memory/

ℹ️ INFO — 参考项

端口暴露

bash
# 网关 + 沙盒浏览器端口
ss -ltnp | grep -E "18789|18790|9222|5900|6080"
nmap -p 18789,18790,9222,5900 127.0.0.1 2>/dev/null

Debug 模式

bash
# 检查是否开启 debug
grep -i "debug\|verbose" ~/.openclaw/openclaw.json

Telemetry

bash
# 检查是否禁用遥测
echo $DISABLE_TELEMETRY
env | grep -iE "telemetry|analytic"

Node.js 版本(Windows)

bash
# Windows 用户检查 Node.js 版本
node --version  # 应 >= v20.11.1

模型 API 用量

bash
# 检查 API 消费上限
# 访问 Anthropic Console: https://console.anthropic.com/settings/usage

快速诊断命令汇总

bash
# 一行诊断命令(复�

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/checklist.md (reported line 62)May include surrounding context.

bash
# 关键配置文件权限
chmod 600 ~/.openclaw/openclaw.json
chmod 600 ~/.openclaw/.env
chmod 700 ~/.openclaw
chmod 700 ~/.openclaw/credentials
chmod 700 ~/.openclaw/sessions

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/fix-commands.md (reported line 10)May include surrounding context.

bash
# 关键配置文件权限
chmod 600 ~/.openclaw/openclaw.json
chmod 600 ~/.openclaw/.env
chmod 700 ~/.openclaw
chmod 700 ~/.openclaw/credentials
chmod 700 ~/.openclaw/sessions

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/fix-commands.md (reported line 20)May include surrounding context.

bash
# 关键配置文件权限
chmod 600 ~/.openclaw/openclaw.json
chmod 600 ~/.openclaw/.env
chmod 700 ~/.openclaw
chmod 700 ~/.openclaw/credentials
chmod 700 ~/.openclaw/sessions

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/fix-commands.md (reported line 31)May include surrounding context.

bash
# 关键配置文件权限
chmod 600 ~/.openclaw/openclaw.json
chmod 600 ~/.openclaw/.env
chmod 700 ~/.openclaw
chmod 700 ~/.openclaw/credentials
chmod 700 ~/.openclaw/sessions

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/fix-commands.md (reported line 37)May include surrounding context.

bash
# 关键配置文件权限
chmod 600 ~/.openclaw/openclaw.json
chmod 600 ~/.openclaw/.env
chmod 700 ~/.openclaw
chmod 700 ~/.openclaw/credentials
chmod 700 ~/.openclaw/sessions

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/fix-commands.md (reported line 38)May include surrounding context.

bash
# 关键配置文件权限
chmod 600 ~/.openclaw/openclaw.json
chmod 600 ~/.openclaw/.env
chmod 700 ~/.openclaw
chmod 700 ~/.openclaw/credentials
chmod 700 ~/.openclaw/sessions

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/fix-commands.md (reported line 177)May include surrounding context.

bash
# 关键配置文件权限
chmod 600 ~/.openclaw/openclaw.json
chmod 600 ~/.openclaw/.env
chmod 700 ~/.openclaw
chmod 700 ~/.openclaw/credentials
chmod 700 ~/.openclaw/sessions

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The command appends a new gateway token directly to '~/.openclaw/.env' via shell echo, which can lead to secret exposure through shell history, clipboard reuse, terminal logging, or accidental duplication of old values. While intended as setup guidance, embedding credential-writing commands in copy/paste form increases the chance of mishandling secrets.

Content

Scanner excerpt · references/fix-commands.md (reported line 30)May include surrounding context.

openssl rand -hex 32

写入 .env(不要明文写入配置文件!)

echo "OPENCLAW_GATEWAY_TOKEN=<新令牌>" >> ~/.openclaw/.env chmod 600 ~/.openclaw/.env

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

This duplicate finding points to the same workspace-deletion command. The risk is not malicious intent but unsafe destructive guidance presented in an automation-oriented handbook.

Content

Scanner excerpt · references/fix-commands.md (reported line 164)May include surrounding context.

cp -r ~/.openclaw/workspace/ /tmp/workspace-backup-$(date +%Y%m%d)/

完全重建

rm -rf ~/.openclaw/workspace/ mkdir ~/.openclaw/workspace/

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

This duplicate finding points to the same workspace-deletion command. The risk is not malicious intent but unsafe destructive guidance presented in an automation-oriented handbook.

Content

Scanner excerpt · references/fix-commands.md (reported line 164)May include surrounding context.

cp -r ~/.openclaw/workspace/ /tmp/workspace-backup-$(date +%Y%m%d)/

完全重建

rm -rf ~/.openclaw/workspace/ mkdir ~/.openclaw/workspace/

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

This duplicate finding refers to the same incident-response workspace deletion step. The command is materially risky because it enables irreversible local data loss if copied blindly.

Content

Scanner excerpt · references/fix-commands.md (reported line 212)May include surrounding context.

md
cp ~/.openclaw/openclaw.json /tmp/incident-config-$(date +%Y%m%d)/

# 5. 清除工作区
rm -rf ~/.openclaw/workspace/

# 6. 检查持久化后门
crontab -l

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

This duplicate finding refers to the same incident-response workspace deletion step. The command is materially risky because it enables irreversible local data loss if copied blindly.

Content

Scanner excerpt · references/fix-commands.md (reported line 212)May include surrounding context.

md
cp ~/.openclaw/openclaw.json /tmp/incident-config-$(date +%Y%m%d)/

# 5. 清除工作区
rm -rf ~/.openclaw/workspace/

# 6. 检查持久化后门
crontab -l

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill instructs the agent to read sensitive local files and run shell commands, but it declares no explicit tool scope or permissions boundary. This weakens least-privilege controls and can cause the skill to be invoked with broader capabilities than users expect, especially given that it scans logs, sessions, credentials, and network state.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

L003 将触发场景写为“安全审计、安全加固、漏洞检查、security audit、hardening、暴露检查”,其中“安全加固”“漏洞检查”“hardening”等表述较宽泛,容易与一般安全讨论或其他审计/加固任务重叠。描述中也没有给出明确的触发短语列表边界、适用上下文或反例,可能导致非预期调用。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

L022 明确要求“用中文询问用户意图”,这会把交互语言固定为中文,而文档中未提供用户选择其他语言或按用户偏好切换的机制。根据语言/区域策略,这属于未获用户选择即强制特定语言的自然语言政策问题。

Content

No source excerpt is available for this finding.

File System Enumeration

Medium
Category
Data Exfiltration
Confidence
89% confidence
Finding

The skill performs filesystem enumeration of ~/.openclaw and related security-relevant paths, including sessions, logs, memory, and skills directories. In a security-audit context this is expected, but it is still sensitive because it can reveal file names, structure, and metadata that may expose secrets, usage patterns, or other private information if run without tight consent and scoping.

Content

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

B-1. 文件权限

bash
# 检查关键文件和目录权限
ls -la ~/.openclaw/
stat -c "%a %n" ~/.openclaw/openclaw.json
stat -c "%a %n" ~/.openclaw/.env
stat -c "%a %n" ~/.openclaw/credentials/

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This markdown file presents all operational guidance, headings, and safety instructions only in Chinese. Under the stated policy, forcing a specific language without user opt-in or clear justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

bash
# 关键配置文件权限
chmod 600 ~/.openclaw/openclaw.json
chmod 600 ~/.openclaw/.env
chmod 700 ~/.openclaw
chmod 700 ~/.openclaw/credentials

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/fix-commands.md (reported line 9)May include surrounding context.

bash
# 关键配置文件权限
chmod 600 ~/.openclaw/openclaw.json
chmod 600 ~/.openclaw/.env
chmod 700 ~/.openclaw
chmod 700 ~/.openclaw/credentials

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/fix-commands.md (reported line 10)May include surrounding context.

bash
# 关键配置文件权限
chmod 600 ~/.openclaw/openclaw.json
chmod 600 ~/.openclaw/.env
chmod 700 ~/.openclaw
chmod 700 ~/.openclaw/credentials