Back to skill

Security audit

Incident Response

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed incident-response workflow, but it gives agents broad operational authority and persistent follow-up actions without clear approval gates.

Review before installing. Use only with trusted OpenClaw operators and require explicit confirmation before reading session histories, restoring configuration, restarting services, changing chmod, committing to git, creating cron jobs, or writing SOUL.md/rules.md/MEMORY.md. Scope each run to a named host and incident, redact session-log evidence, avoid git add -A, and give any monitoring job a fixed expiry and read-only default.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (4)

T06 · System Persistence

Error
Location
SKILL.md:155
Finding
Mandatory Recurring Monitoring Creates Cross-Session System Persistence<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:155-165`; `references/cron-template.md:3-5, 27-39, 54-60` **Vulnerability Type**: Mandatory scheduled-task persistence with autonomous system modification **Risk Level**: Critical ### Vulnerable Code From `SKILL.md:155-165`: ```markdown ## Phase 5: Monitor Set a recurring cron job that runs until user confirms "good enough" (minimum 7 days, 30 days for recurring incidents). ``` Cron job structure: - Schedule: every 24h (or every N hours for high-severity) - Task: check specific metric → compare to baseline → if degraded: restore + 5-why → report - Report channel: sessions_send to your preferred channel (Signal, Telegram, Discord) - Auto-escalate: if same fix needed 3+ days in a row → upgrade prevention measure - Termination: user explicitly says "stop monitoring" or N days without incident ``` ``` From `references/cron-template.md:27-39`: ```markdown ## Decision Tree - If [METRIC] == [BASELINE]: report OK - If [METRIC] < [BASELINE]: a. Run 5 Whys: find what's missing, check git log for who, check session logs for which tool call b. Restore: [RESTORE_COMMAND] c. Check if guard failed: [GUARD_CHECK] d. If guard failed, strengthen it: [HOW_TO_STRENGTHEN] e. Commit prevention update to git ## Auto-escalate Rule If same fix is needed 3+ days in a row: upgrade prevention measure from SOUL.md rule → config-validate.sh hard guard. ``` From `references/cron-template.md:54-60`: ```markdown ## Stopping Monitoring Only stop when: 1. User explicitly says "stop monitoring" or "it's good enough" 2. OR: N consecutive clean checks with no incidents (N = 7 for minor, 30 for systemic) Never self-terminate monitoring. The cron job should report its own run count and ask user for confirmation when approaching the suggested stop date. ``` ### Technical Analysis The skill requires a recurring cron job after every incident rather than presenting monitoring as an optional, separately authorized actio ...[truncated 1761 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Make monitoring explicitly opt-in rather than a mandatory incident-response phase. 2. Before scheduling, show the user the exact schedule, expiration time, commands, accessed files, report destination, and retained privileges. 3. Require explicit informed confirmation before creating the scheduled task. 4. Apply a fixed automatic expiration using the scheduler itself; do not rely on a future conversational instruction to stop. 5. Make recurring checks read-only by default. 6. Require a new approval before any cron run restores configuration, modifies guards or memory, commits files, or restarts services. 7. Restrict the task to an allowlisted host, commands, paths, and metrics. 8. Record the job identifier and provide an immediate removal command. 9. Avoid embedding credentials or private session keys directly in the scheduled prompt. 10. Add tests confirming that no recurring task is created without explicit consent and that every task expires automatically. ]]>

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:141
Finding
Incident Workflow Persistently Modifies Agent Rules and Long-Term Memory<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:141-145, 170-176`; `references/prevention-patterns.md:19-53` **Vulnerability Type**: Persistent modification of agent behavior and memory **Risk Level**: High ### Vulnerable Code From `SKILL.md:141-145`: ```markdown **For agent behavior rules:** Add to `~/.openclaw/agents/<id>/agent/SOUL.md` as a Hard Rule (HR-NNN) **For recurring mistakes:** Add to `~/.openclaw/learnings/rules.md` with category and date ``` From `SKILL.md:170-176`: ```markdown ## Phase 6: Document Write to `~/.openclaw/learnings/rules.md` if a Hard Rule should be added: - Category: HR (Hard Rule, recurring) or SR (Soft Rule, first offense) - Include: what triggered, what the rule is, date learned, why it matters Update `MEMORY.md` with incident summary if it's systemic. ``` From `references/prevention-patterns.md:19-53`: ```markdown ## Pattern 2: SOUL.md Hard Rule Use when an agent repeatedly makes the same mistake autonomously. ```markdown ## [Area] — Hard Restriction (HR-NNN) **NEVER [do X].** This causes [Y consequence]. - Correct approach: [what to do instead] - Why: [root cause context] - Learned: [date] — [brief incident description] ``` **Real examples:** - HR-008: Validate schema before writing any config key - HR-009: Config change process — always use config-validate.sh --merge - HR-010: No self-restart or self-config (revoked after 3 incidents) ## Pattern 3: rules.md Hard Rule Use when the agent needs a persistent system-wide rule. File: `~/.openclaw/learnings/rules.md` ```markdown ### HR-NNN: [Title] [What happened] — [date] **Rule:** [Imperative statement of what to always/never do] - **Trigger:** [When this applies] - **Action:** [What to do] - **Learned:** [date + incident summary] ``` ``` ### Technical Analysis The skill directs the agent to write incident-derived content into `SOUL.md`, `rules.md`, and `MEMORY.md`. These files are persistent state that can affect subsequent sessions and, in the ...[truncated 1663 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Never modify `SOUL.md`, shared rules, or long-term memory automatically. 2. Produce a proposed patch and require explicit user review and confirmation before applying it. 3. Separate factual incident records from executable behavioral instructions. 4. Store evidence as structured, non-instructional data with source citations and integrity metadata. 5. Treat all text originating from users, logs, sessions, configuration, and remote hosts as untrusted. 6. Reject or neutralize imperative instructions and prompt-like content before generating a rule. 7. Scope approved rules to the affected agent and incident instead of writing system-wide directives. 8. Add provenance, author, timestamp, expiration, and rollback information to every persistent entry. 9. Provide a review mechanism for enumerating and removing incident-created rules. 10. Require separate authorization when a proposed change affects multiple agents or shared memory. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:58
Finding
Unredacted Session Tool Inputs Can Disclose Credentials and Sensitive Data<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:58-72` **Vulnerability Type**: Plaintext disclosure from private session histories **Risk Level**: Medium ### Vulnerable Code ```markdown ### 1c. Session logs (who did what) ```bash # Find sessions that touched the broken config key ssh "<remote-host>" "rg -rl 'keyword' ~/.openclaw/agents/*/sessions/*.jsonl | head -5" # Extract tool calls from a session ssh "<remote-host>" "python3 << 'EOF' import json for line in open('SESSION.jsonl'): obj = json.loads(line) if obj.get('type') != 'message': continue for block in obj.get('message',{}).get('content',[]): if block.get('type') == 'toolCall' and block.get('name') in ['Write','Edit','gateway','exec']: print(obj['timestamp'], block['name'], str(block.get('input',''))[:200]) EOF" ``` ``` ### Technical Analysis The evidence-collection procedure searches agent session histories and prints the first 200 characters of raw tool-call input. Tool inputs for `Write`, `Edit`, `gateway`, and especially `exec` may contain access tokens, passwords, private keys, API credentials, personally identifiable information, private paths, configuration values, or command-line secrets. The fixed 200-character truncation is not a security control because credentials commonly occur near the start of command arguments or serialized input. No key-based filtering, credential-pattern redaction, output minimization, authorization check, or secure output channel is provided. Printed values can consequently enter the active transcript, terminal history, audit logs, or later incident reports. ### Attack Path 1. A previous session invokes a tool with a secret in its arguments or file content. 2. An incident involving a related keyword triggers the session-log search. 3. The investigator selects the matching JSONL session. 4. The extraction script serializes and prints raw tool-call input. 5. A credential located in the first 200 characters appears i ...[truncated 576 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not print raw tool-call inputs by default. 2. Extract only the minimum metadata required for attribution, such as timestamp, tool name, operation type, and a cryptographic digest. 3. Apply recursive redaction to fields named `token`, `password`, `secret`, `authorization`, `cookie`, `api_key`, `private_key`, and equivalent variants. 4. Redact common credential formats and environment-variable assignments from command strings. 5. Require explicit authorization before reading private agent session histories. 6. Keep extracted evidence in a restricted local file rather than emitting it into conversational output. 7. Mark evidence artifacts as sensitive and apply restrictive filesystem permissions. 8. Add tests containing representative credentials to ensure no secret reaches standard output or monitoring reports. 9. Document retention and deletion requirements for extracted session evidence. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:150
Finding
Overbroad Git Staging Can Commit Unrelated Sensitive Files<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:150-153` **Vulnerability Type**: Unsafe repository-wide staging of files under a sensitive state directory **Risk Level**: Medium ### Vulnerable Code ```markdown Always commit prevention changes to git: ```bash ssh "<remote-host>" "cd ~/.openclaw && git add -A && git commit -m 'prevention: <what was added> after <incident>'" ``` ``` ### Technical Analysis The command executes `git add -A` from `~/.openclaw`, staging all modified, deleted, and untracked files in that repository. The same project documentation identifies this directory as containing configuration, agent files, learning rules, backups, session JSONL data, and other operational state. Repository-wide staging is unnecessary for committing a specific prevention change. It can capture unrelated files created before or during the incident, including sensitive configuration, session records, memory files, backup data, or credentials. Once committed, deleting the working-tree file does not remove it from Git history. The workflow also omits a review of the staged diff before committing. ### Attack Path 1. A sensitive modified or untracked file exists under the `~/.openclaw` Git worktree. 2. The incident workflow creates or edits a prevention rule. 3. The mandatory commit command runs `git add -A`. 4. Git stages both the intended prevention file and the unrelated sensitive file. 5. The commit records all staged content in durable repository history. 6. If the repository is backed up, shared, or pushed, the sensitive content is propagated to additional locations. ### Impact Assessment The issue can expose any readable file located within the Git worktree and not excluded effectively by repository configuration. Committed secrets may grant the privileges associated with those credentials. Session histories and memory files can expose private conversations or operational details. Git history makes remediation more difficult because ordin ...[truncated 66 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace `git add -A` with explicit, allowlisted paths for the reviewed prevention files. 2. Reject path traversal and ensure every staged path resolves within the expected configuration directory. 3. Run and inspect `git diff --cached --name-status` and `git diff --cached` before committing. 4. Abort if any staged path is not on the operation-specific allowlist. 5. Scan staged content for credentials, private keys, tokens, session data, and high-entropy secrets. 6. Maintain a restrictive `.gitignore` for sessions, backups, logs, databases, secrets, and transient state, while recognizing that ignore rules do not replace explicit staging. 7. Require explicit confirmation of the exact staged file list before creating a commit. 8. If sensitive content was previously committed, rotate affected credentials and rewrite repository history using an appropriate secret-removal procedure. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (18)

Tool Parameter Abuse

High
Category
Tool Misuse
Content
1. `openclaw memory status` — check indexed count vs total files
2. If indexed << total: `openclaw memory index --force --agent AGENT_ID`
3. If stuck: delete sqlite → `rm ~/.openclaw/memory/AGENT.sqlite` → restart gateway
4. Check config: `python3 -c "import json; d=json.load(open('openclaw.json')); print(d['agents']['defaults'].get('memorySearch',{}))"`
5. Verify `sources: ["memory","sessions"]` and `extraPaths` are present
Confidence
87% confidence
Finding
The command uses a destructive filesystem operation directly on a path containing a variable-like agent placeholder, which can be misapplied if an agent, wrapper, or user substitutes the wrong value or broadens the target. Although the troubleshooting context is legitimate, documenting raw deletion as a normal fix increases the chance of parameter abuse and avoidable data loss.

Self-Modification

High
Category
Rogue Agent
Content
```

Prevents direct writes; forces all changes through config-validate.sh which has guards.
**Note:** Adapt chmod strategy to your machine setup — some setups give specific agents controlled self-modify rights.
Confidence
90% confidence
Finding
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Vague Triggers

High
Confidence
97% confidence
Finding
The trigger phrases are broad enough to match routine troubleshooting requests such as "fix {thing}" or "debug {thing}," which can invoke a powerful incident-response skill unexpectedly. Because the skill grants exec, git, python3, filesystem write, and cron-related capabilities, accidental or adversarial invocation could lead to unauthorized investigation, system changes, or persistence-oriented follow-up actions.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The README advertises recovery steps such as 'Merge from known-good backup, verify, restart' and scheduling cron-based monitoring, but does not prominently warn that these actions can modify system state or disrupt services. In an agent skill context, describing destructive or state-changing actions without an explicit approval boundary increases the risk of unsafe autonomous execution.

Session Persistence

Medium
Category
Rogue Agent
Content
| 3 | Restore | Merge from known-good backup, verify, restart |
| 4 | Prevent | Add guards proportional to severity (config guard, SOUL.md rule, chmod) |
| 5 | Monitor | Schedule a cron check (7–30 days depending on severity) |
| 6 | Document | Write to `~/.openclaw/learnings/rules.md` and MEMORY.md |

**Rule: Never skip a phase. Never assume — follow the evidence.**
Confidence
81% confidence
Finding
The workflow explicitly instructs writing incident learnings to persistent local files, including `~/.openclaw/learnings/rules.md` and `MEMORY.md`. Persistent memory writes can retain sensitive operational details, incident artifacts, hostnames, or assumptions beyond the current session, creating confidentiality and integrity risks if the stored content is later reused without review.

Vague Triggers

Medium
Confidence
96% confidence
Finding
The trigger list includes broad, everyday phrases like 'root cause', 'audit X', and 'agent not responding' that could match routine conversation and invoke the skill unintentionally. Because this skill appears to guide operational investigation and recovery actions, accidental activation could steer an agent into sensitive diagnostic or remediation workflows without clear user intent.

Vague Triggers

Medium
Confidence
96% confidence
Finding
The trigger list includes very broad phrases such as "fix this," "investigate," and "something changed," which can cause the skill to activate in routine conversations without clear user intent for incident-response actions. In this skill, unintended activation is risky because later phases direct the agent to inspect systems, restore config, restart services, and make persistent changes.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill instructs the agent to restore configuration, restart the gateway, modify validation scripts and agent rules, commit to git, create cron jobs, and write to persistent learning files without an explicit safety checkpoint or user-approval step for system-impacting actions. Because the skill is owned by "any agent with exec access," these instructions could directly alter production state, create persistence, and institutionalize incorrect changes after a misdiagnosis or accidental invocation.

Session Persistence

Medium
Category
Rogue Agent
Content
## Phase 6: Document

Write to `~/.openclaw/learnings/rules.md` if a Hard Rule should be added:
- Category: HR (Hard Rule, recurring) or SR (Soft Rule, first offense)
- Include: what triggered, what the rule is, date learned, why it matters
Confidence
84% confidence
Finding
The skill directs the agent to append incident-derived rules to `~/.openclaw/learnings/rules.md`, creating persistent state that can influence future behavior beyond the current task. Persistent memory writes are dangerous when they are generated from potentially incomplete incident analysis, because mistakes or adversarially induced conclusions can become durable policy and affect later sessions.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The checklist recommends deleting a SQLite file as a recovery step without any warning, scope limitation, or backup guidance. In an agent skill context, terse operational commands can be copied or automated blindly, which creates a real risk of unintended data loss or deletion of the wrong file if placeholders are substituted incorrectly.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The template uses subjective stopping criteria such as "good enough" and also instructs the cron to continue until explicit user stop, which can lead to indefinite monitoring and overreach beyond the user’s likely intent. In an agent skill, ambiguous lifecycle control is dangerous because it can normalize persistent automated actions without clear authorization boundaries or objective termination conditions.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The template includes remote shell access, git inspection, restore commands, guard modifications, and commit actions, but it does not require an explicit warning or approval gate before system-modifying behavior occurs. In this context, the skill is more dangerous because it is a reusable operational template that could be copied into autonomous workflows, causing unauthorized restoration, configuration changes, or persistence of preventive controls on production systems.

Session Persistence

Medium
Category
Rogue Agent
Content
## Pattern 5: Valid Keys Guard

Use when agents write invalid config keys (causing gateway crashes).

Add to `config-validate.sh` validate() function:
```python
Confidence
60% 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.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Use for critical config files on multi-agent machines.

```bash
chmod 444 ~/.openclaw/openclaw.json  # read-only; config-validate.sh handles unlock/relock
```

Prevents direct writes; forces all changes through config-validate.sh which has guards.
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```

Prevents direct writes; forces all changes through config-validate.sh which has guards.
**Note:** Adapt chmod strategy to your machine setup — some setups give specific agents controlled self-modify rights.
Confidence
85% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Vague Triggers

Medium
Confidence
93% confidence
Finding
Several triggers in this section are highly ambiguous, including phrases like "root cause," "audit {thing}," and "something disappeared," which are common in normal conversation and may activate the skill without clear user intent. In the context of a high-privilege operational skill, this increases the chance of unsafe activation and misuse of investigation or restoration tooling.

Session Persistence

Medium
Category
Rogue Agent
Content
- exec: git (audit trail, config backups)
  - exec: python3 (config diff and restore scripts)
  - filesystem: read config-backups/ and session JSONL logs (read-only investigation)
  - filesystem: write ~/.openclaw/learnings/rules.md (prevention rules)
  - cron: schedule monitoring jobs post-incident

skill_metadata:
Confidence
84% confidence
Finding
The skill is allowed to write to ~/.openclaw/learnings/rules.md, creating persistent state that survives the current session. Even though the stated purpose is prevention rules, session-persistent writes can be abused to influence future agent behavior, encode unsafe instructions, or create hard-to-audit long-term changes, especially when paired with broad invocation and incident-response privileges.

Vague Triggers

Medium
Confidence
94% confidence
Finding
This is a real trigger-quality issue: several positive utterances such as "settings disappeared," "my API key is missing," or "who changed my config" are broad, natural-language problem statements that may arise outside a true incident-response scenario. In a trigger-based skill, overly generic phrases can cause unintended activation, pulling the user into incident-response workflows when they may be asking about ordinary support, account, or product-usage issues.

Static analysis

No suspicious patterns detected.