Back to skill

Security audit

openclaw-reflect

Security checks for vulnerabilities and agentic risk

Overview

This skill is transparent about trying to improve agent behavior, but its automatic logging, evaluator, and write pipeline can expose sensitive context and be manipulated into persistent or out-of-scope file changes.

Install only after reviewing the auto-apply behavior. Use it in trusted workspaces, prefer the local rules evaluator, avoid enabling API keys on sensitive repositories, inspect or clear .reflect state regularly, and require manual review for MEMORY.md and CLAUDE.md changes. Do not allow autonomous x402 payments without an explicit operator-controlled payment policy.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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
Findings (6)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/evaluate.js:51
Finding

Unredacted Tool Inputs and Persistent Memory Are Automatically Transmitted to Evaluator Endpoints

Content
View full analysis
({ key: g.key, tool: g.tool, error_pattern: g.error_pattern, recurrence: g.occurrences.length, session_count: g.sessions.size, first_seen: g.occurrences[0].ts, last_seen: g.occurrences[g.occurrences.length - 1].ts, sample_inputs: g.occurrences.slice(-3).ma ...[truncated 4133 chars]
Remediation
View remediation

T01 · Skill Instruction Hijacking

Error
Location
scripts/evaluate.js:57
Finding

Prompt-Injection-Prone Evaluation Can Persist Attacker-Influenced Instructions in Agent Memory

Content
View full analysis
`${i + 1}. ${s}`).join('\n') || '(none recorded)'} `.trim(); } ``` ```js // scripts/evaluate.js:274-287 function parseResponse(text, backend) { const decision = (text.match(/DECISION:\s*(APPROVE|REJECT|DEFER)/i) || [])[1]?.toUpperCase() || 'DEFER'; const confidence = parseFloat((text.match(/CONFIDENCE:\s*([\d.]+)/i) || [])[1] || '0.5'); const reasoning = (text.match(/REASONING:\s*(.+?)(?=\nMODIFICATION:|$)/si) || [])[1]?.trim() || text.slice(0, 300); const modification = (text.match(/MODIFICATION:\s*(.+?)$/si) || [])[1]?.trim() || null; return { decision, confidence: isNaN(confidence) ? 0.5 : Math.min(1, Math.max(0, confidence)), reasoning: reasoning || '(no reasoning)', modification, evaluator: backend, }; } ``` ```js // scripts/apply.js:76-86 function applyProposal(proposal) { const targetFile = path.join(process.cwd(), proposal.blast_target); co ...[truncated 3789 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/apply.js:76
Finding

Mutable Proposal State Enables Path Traversal and Automatic Arbitrary File Modification

Content
View full analysis
`, `**Pattern:** \`${proposal.tool}\` → ${proposal.error_pattern}`, `**Learning:** ${proposal.evaluation?.modification || proposal.hypothesis.proposed_change}`, `**Success criteria:** ${proposal.hypothesis.success_criteria}`, ].join('\n'); appendToFile(targetFile, entry); const record = { ts: new Date().toISOString(), change_id: crypto.randomBytes(6).toString('hex'), proposal_id: proposal.id, pattern_key: proposal.pattern_key, target: proposal.blast_target, snapshot: snapshotPath, content: entry, }; fs.appendFileSync(APPLIED_FILE, JSON.stringify(record) + '\n', 'utf8'); return record.change_id; } ``` ```js // scripts/apply.js:144-169 const approved = proposals.filter(p => p.status === 'approved'); const newPending = loadPending(); for (const proposal of approved) { const threshold = AUTO_APPLY_THRESHOLD ...[truncated 2452 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/rollback.js:72
Finding

Rollback Ledger Permits State-Controlled Arbitrary File Copy and Overwrite

Content
View full analysis
{ try { return JSON.parse(l); } catch { return null; } }) .filter(Boolean); } ``` ```js // scripts/rollback.js:72-92 if (args.id) { target = applied.find(e => e.change_id === args.id && !e.reverted_at); if (!target) { process.stdout.write(`change ${args.id} not found or already reverted`); return; } } else { target = [...applied].reverse().find(e => !e.reverted_at); if (!target) { process.stdout.write('no non-reverted changes found'); return; } } if (!target.snapshot || !fs.existsSync(target.snapshot)) { process.stdout.write( `snapshot not found for change ${target.change_id}. ` + `Target was: ${target.target}. Manual recovery required.` ); return; } const targetFile = path.join(process.cwd(), target.target); fs.copyFileSync(target.snapshot, targetFile); ``` ### Technical Analysis Rollback records are read from the writable `.reflect/applied.jsonl` ledger. The code trusts both `target.snapshot` and `target.target` without validation. The source path is not required to be beneath `.reflect/snapshots`, and the destination path is not required to be one of the supported persistent files. `path.join` does not prevent traversal outside the workspace. The ledger is described as append-only but is neither authenticated nor made immutable. Unlike the automatic apply path, exploitation requires the rollback command to be invoked. However, rollback is an explicitly documented operator command, making social or workflow-triggered execution plausible. ### Attack Path 1. Modify `.reflect/applied.jsonl`. ...[truncated 1002 chars]
Remediation
View remediation

T07 · Tool Hijacking and Spoofing

Error
Location
hooks/session-end.js:15
Finding

Executable Maintenance Scripts Are Copied into Writable Runtime State and Recommended for Later Execution

Content
View full analysis
0) { lines.push( `[reflect] ${pendingCount} improvement proposal${pendingCount > 1 ? 's' : ''} ` + `awaiting your approval. Run: node .reflect/scripts/status.js --pending` ); } if (recent.length > 0) { lines.push( `[reflect] ${recent.length} learning${recent.length > 1 ? 's' : ''} applied in the ` + `last 24h. Run: node .reflect/scripts/status.js --history` ); } ``` ```bash # SKILL.md:96-113 node .reflect/scripts/status.js node .reflect/scripts/status.js --pending node .reflect/scripts/apply.js --id --approve node .reflect/scripts/apply.js --id --reject node .reflect/scripts/rollback.js node .reflect/scripts/status.js --history ``` ### Technical Analysis The Skill copies executable JavaScript into `.reflect/scripts`, even though `.reflect/` is explicitly writable runtime state. Existing destination scripts are not refreshed or checked: ```js if (fs.existsSync(src) && !fs.existsSync(dst)) ``` Therefore, once a copied script exists, any process capable of modifying workspace state can replace it. The Skill documentation and prompt hook then direct the operator or ag ...[truncated 1326 chars]
Remediation
View remediation

T07 · Tool Hijacking and Spoofing

Warning
Location
scripts/apply.js:51
Finding

Automatic Apply Executes an Unverified Workspace-Relative Warden Script

Content
View full analysis
/skills/openclaw-warden/warden.js ``` The code does not verify the file's origin, version, ownership, signature, or cryptographic hash. Because the path is workspace-relative, a planted or modified script at that location is treated as the legitimate optional dependency. `execFileSync` safely avoids shell-string injection, but it still directly executes the selected JavaScript file through Node.js. The best-effort exception handler suppresses evidence of execution failure and does not mitigate malicious execution. Because `snapshotFile` is reached during automatic proposal application, exploitation does not necessarily require the operator to invoke the component manually. ### Attack Path 1. Create or replace `skills/openclaw-warden/warden.js` in the workspace. 2. Insert attacker-controlled JavaScript into that file. 3. Cause a proposal to reach the automatic apply threshold. 4. The SessionEnd pipeline invokes `apply.js --auto`. 5. `snapshotFile` runs before the target change is appended. 6. ...[truncated 565 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (19)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This skill explicitly instructs autonomous agents to create and send a cryptocurrency payment to a local payment API, but it does not require an explicit operator confirmation or present a strong warning that real funds may be transferred. In an agent ecosystem, even 'voluntary' payment instructions can become unsafe because agents may interpret them as actionable operational steps and initiate unauthorized transfers if they have wallet capability.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README explicitly states that tool outcomes are logged automatically and that approved proposals above a threshold are auto-applied, but it does not prominently warn operators that workspace data will be persisted and files may be modified without per-change interactive confirmation. In a self-modifying agent skill, that omission increases the chance of unintended data retention or silent configuration drift, especially because the documented behavior targets persistent files like MEMORY.md and CLAUDE.md.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README says proposals are sent to a separate Claude evaluator invocation and later lists ANTHROPIC_API_KEY as a requirement, but it does not clearly warn that proposal content and possibly workspace-derived context may be transmitted to an external service. That creates a real privacy and security risk if logs, error messages, file excerpts, or other sensitive workspace content are included in evaluator requests without operator awareness.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill can automatically modify persistent files such as MEMORY.md and CLAUDE.md across sessions, but the description does not foreground this as a prominent warning. That creates a meaningful consent and integrity risk because operators may install or enable the skill without realizing it can alter long-lived behavioral instructions, potentially causing silent drift or persistence of bad changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The hook reads environment-derived values such as session identifiers, tool input, tool output, and exit metadata, then persists some of that information to disk. Environment variables in agent/tooling contexts often carry sensitive operational context, and storing them without warning or strict minimization can leak session correlation data and user activity history to anyone with filesystem access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The hook persistently logs tool input summaries and output-derived error patterns to a local file without any disclosure, consent, or filtering robust enough to prevent sensitive data capture. Even though the code attempts to minimize data, the first 150 characters of tool input and normalized error lines can still contain secrets, personal data, file paths, prompts, or proprietary content, creating a privacy and data-retention risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This hook automatically creates files in the workspace, copies executable scripts into .reflect/scripts, and later runs an apply step with '--auto' at session end without any explicit user confirmation. In a self-modifying or proposal-driven pipeline, that means code or workspace state can be changed implicitly, reducing user visibility and increasing the chance of unintended or unsafe modifications being persisted.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The script auto-applies changes from proposals.json solely based on status === 'approved' and a confidence threshold, but it does not verify who approved the proposal, whether the source file is trusted, or whether the proposal content is safe for the target path. In this skill context, that means any actor or upstream component able to write or tamper with .reflect/proposals.json can cause automatic modification of repository files, creating an integrity risk and a path for persistence or malicious instruction injection.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code auto-applies approved proposals by calling applyProposal when confidence exceeds a threshold, which results in modifying a target file. Although the header comment documents usage and behavior, there is no explicit runtime confirmation or user-facing warning before the write occurs, despite the operation changing user files automatically.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script packages MEMORY.md excerpts and proposal content into prompts and may send them to Anthropic or OpenAI over the network, but there is no evident consent gate, redaction, or documented purpose limitation in the code path itself. Because proposal samples and memory may contain sensitive operational or user-derived data, this creates a real data-exfiltration risk to third-party services.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code sends proposal data and MEMORY.md excerpts to remote model providers without any user-facing notice in this script, so operators may not realize local context is being disclosed externally. Lack of transparency increases the chance that sensitive project data is shared unintentionally and undermines informed consent and auditability.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The prompt builder broadly includes memory excerpts, proposal fields, and sample inputs, then passes that natural-language bundle to potentially external LLM backends. This significantly increases leakage risk because free-text samples often contain secrets, identifiers, internal procedures, or user content that are hard to sanitize once embedded in prompts.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script reads API credentials from environment variables and is explicitly designed to contact external model providers and a local inference service. In a test harness this is not inherently malicious, but it does create a real data-exposure and unintended-network-egress risk if users run it without realizing proposal content and environment-derived details may be transmitted off-host.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

These functions serialize constructed test proposals and send them directly to Anthropic and OpenAI over HTTPS. The payload includes local filesystem paths, platform details, sample commands, and operational context, so running the test can leak internal environment information to third parties without any inline notice or consent gate.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The built messages contain Windows usernames, local paths, localhost service details, and sample command inputs, and this script can send them to external APIs without a user-facing warning. Even though the data is synthetic test material, it embeds realistic environment identifiers that can disclose workstation structure and usage patterns.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The line states that Tier 3 changes require operator approval always, but elsewhere the manifest explicitly grants propose: SOUL.md, which implies the skill can generate change proposals for that file. This is not a direct contradiction in executable code, but it is an intent-level inconsistency in the documented handling of high-impact changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The code reads ANTHROPIC_API_KEY and OPENAI_API_KEY from the environment to enable remote evaluation, but provides no warning or disclosure that credentials are being consumed for outbound requests. Under this rule, access to sensitive environment variables should have some visible explanation when no other disclosure is present in the file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

After evaluating pending proposals, the script writes updated results back to .reflect/proposals.json. Although this is part of the program flow, there is no explicit warning, confirmation, or prior disclosure near the write operation that local proposal state will be modified.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The script probes a local Ollama endpoint for installed models and sends prompts to it over HTTP. Even though this is local-host communication, it is still an active network capability that is not justified by any available manifest purpose.

Content

No source excerpt is available for this finding.