Back to skill

Security audit

Context Memoize Cache

Security checks for vulnerabilities and agentic risk

Overview

This skill has a clear memoization purpose, but it stores and reloads conversation context in a persistent plaintext file without enough scoping, review, or retention controls.

Review this before installing if your sessions may include secrets, private files, client data, or instructions from untrusted sources. Use it only with explicit fragment selection and avoid startup auto-loading unless cached content is reviewed and treated as untrusted reference text.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:7
Finding

Untrusted Context Is Persisted and Automatically Loaded into Future Agent Sessions

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 7-10 and 19-23
Vulnerability Type: Persistent agent memory poisoning
Risk Level: High

Vulnerable Code

bash
# Save context fragment
echo "$CONTENT" >> ~/.openclaw/context-cache/fragments.md
bash
if [ -f ~/.openclaw/context-cache/fragments.md ]; then
  cat ~/.openclaw/context-cache/fragments.md
fi

Technical Analysis

The skill permits arbitrary conversation content to be appended to a persistent cache without validation, provenance tracking, trust labeling, or separation between executable instructions and inert reference data. The integration then recommends loading that content during Agent session startup.

Because the restored text may be incorporated into the Agent's context, instruction-like content supplied by an attacker can persist across sessions and be interpreted as authoritative guidance. No review or confirmation step is required before the cached content is loaded.

Attack Path

  1. An attacker supplies text containing hostile instructions, such as directions to ignore later requests, disclose information, or invoke tools in an unsafe manner.
  2. The attacker or user invokes the skill using the memoization trigger.
  3. The hostile text is appended verbatim to ~/.openclaw/context-cache/fragments.md.
  4. A future session executes the documented startup integration.
  5. The stored text is inserted into that session's context.
  6. If the Agent treats the restored text as instructions rather than untrusted data, the attacker can influence future Agent behavior.

Impact Assessment

Successful exploitation can contaminate future sessions for the same user account and manipulate the Agent's decisions, tool calls, or handling of later information. The vulnerability does not independently grant additional operating-system privileges; any resulting actions remain constrained by the tools and permissions already a ...[truncated 179 chars]

Remediation
View remediation

Remediation Suggestions

  • Do not automatically merge cached content into system, developer, startup, or other trusted instruction contexts.
  • Treat all restored fragments as untrusted quoted data and clearly delimit them from executable instructions.
  • Require an explicit user review and confirmation before loading cached content into a new session.
  • Reject or quarantine fragments containing instruction-like content, tool directives, role changes, or attempts to override higher-priority policies.
  • Store structured records containing provenance, creation time, originating user, trust status, and a content hash.
  • Allow users to inspect, approve, edit, and delete individual fragments instead of loading the entire cache.
  • Apply expiration policies so unreviewed content cannot persist indefinitely.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:5
Finding

Sensitive Conversation Content May Be Retained Indefinitely in a Plaintext File

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 5-10
Vulnerability Type: Insecure plaintext storage of potentially sensitive context
Risk Level: Medium

Vulnerable Code

markdown
## Trigger
When user says "缓存这个上下文" or "memoize this context" - save the current context for reuse.

## Implementation
Use a simple file-based cache:

```bash
# Save context fragment
echo "$CONTENT" >> ~/.openclaw/context-cache/fragments.md
text

### Technical Analysis

The skill describes saving the “current context” verbatim to a persistent plaintext file. Conversation context may contain credentials, API tokens, personal information, proprietary data, file contents, or other sensitive material.

The implementation does not define secret detection, data minimization, retention limits, encryption, restrictive directory and file permissions, or a preview showing precisely what will be stored. Appending content also causes previously saved information to remain until the entire cache is explicitly cleared.

Actual access by other local users or processes depends on the account's effective permissions and `umask`; the skill does not enforce secure permissions itself.

### Attack Path

1. Sensitive information is introduced into the active conversation context.
2. A memoization request causes that context or a fragment containing the information to be assigned to `CONTENT`.
3. The content is appended in plaintext to `~/.openclaw/context-cache/fragments.md`.
4. The information remains on disk without an expiration policy.
5. A local process or user with sufficient filesystem access, or a later Agent session that loads the cache, reads the retained information.

### Impact Assessment

Exploitation can expose any secrets or private data included in the cached fragment. The scope is limited to information written to the cache and to principals capable of reading the file through existing account or filesystem p
...[truncated 169 chars]
Remediation
View remediation

Remediation Suggestions

  • Display the exact fragment to be stored and obtain explicit user confirmation before writing it.
  • Store only a specifically selected fragment rather than an ambiguous “current context.”
  • Detect and redact common secrets, including access tokens, private keys, passwords, session cookies, and connection strings.
  • Create the cache directory with mode 0700 and the cache file with mode 0600, independently of the user's default umask.
  • Use a structured storage format with per-entry expiration, deletion, sensitivity, and provenance metadata.
  • Define a short default retention period and automatically purge expired entries.
  • Consider authenticated encryption where cached context must remain confidential at rest.
  • Avoid automatically printing or loading sensitive entries; require confirmation for each retrieval.
Vulnerability Patterns
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (4)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
93% confidence
Finding

The skill includes a powerful recursive deletion command against a filesystem path, creating a tool-parameter abuse risk in agent-driven execution. Even though the target is narrower than the user's home directory, an agent that executes shell snippets or mishandles path expansion could delete persisted data without authorization or safety checks.

Content

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

ls ~/.openclaw/context-cache/

Clear cache

rm -rf ~/.openclaw/context-cache/

text

## Integration

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
93% confidence
Finding

The skill includes a powerful recursive deletion command against a filesystem path, creating a tool-parameter abuse risk in agent-driven execution. Even though the target is narrower than the user's home directory, an agent that executes shell snippets or mishandles path expansion could delete persisted data without authorization or safety checks.

Content

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

ls ~/.openclaw/context-cache/

Clear cache

rm -rf ~/.openclaw/context-cache/

text

## Integration

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill instructs the agent to persist 'context fragments' to a file in the user's home directory but gives no privacy, retention, or sensitivity guidance. Because context may contain secrets, personal data, or prior conversation content, silently writing it to disk can create unintended disclosure and long-lived sensitive-data storage.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill documents a destructive cache-clearing command that recursively deletes a directory without any confirmation, scope validation, or user warning. In an agent setting, this increases the chance of accidental data loss if the command is invoked automatically, incorrectly parameterized, or copied without understanding its effect.

Content

No source excerpt is available for this finding.