Back to skill

Security audit

Memory Hub

Security checks for vulnerabilities and agentic risk

Overview

This skill is a plausible shared-memory tool, but it gives mutable shared repository content persistent influence over agents and includes an unsafe installer code path.

Review this carefully before installing. Use only a private, tightly controlled repository, do not store sensitive personal or credential data, inspect every change before syncing, avoid loading RULES.md or TOOLS.md as authoritative instructions, and do not run the installer until the Python interpolation bug is fixed.

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 (2)

T01 · Skill Instruction Hijacking

Error
Location
scripts/install.sh:109
Finding

Persistent loading of mutable remote instructions enables agent memory poisoning

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:39-53, SKILL.md:58-62, SKILL.md:71-78; scripts/install.sh:109-137
Vulnerability Type: Persistent remote instruction and memory poisoning
Risk Level: High

Vulnerable Code

SKILL.md:39-53 defines remotely synchronized files as agent rules and tools, then instructs the agent to load all four files into its context:

markdown
shared-memory-repo/
├── USER.md        # Owner preferences, habits, and communication style
├── KNOWLEDGE.md   # Shared knowledge: lessons, tool usage, and best practices
├── RULES.md       # Universal rules for all agents
└── TOOLS.md       # Shared tools: scripts, commands, and configuration

### read — Read shared memory
Steps:
1. `git -C ~/.openclaw/shared-memory pull --rebase --quiet`
2. Read the contents of all four files into the context
3. Tell the user that shared memory has been loaded

SKILL.md:71-78 also directs background synchronization of this remote content into the persistent local cache:

markdown
### sync — Periodic synchronization
Steps:
1. Pull the latest content
2. Compare the local cache's last_sync timestamp
3. If updates exist, regenerate the summary in `SHARED_MEMORY_CACHE.md`
4. Update last_sync in config.json
5. Complete silently unless important new content is found

scripts/install.sh:109-137 installs an every-session instruction that loads the synchronized cache:

bash
MARKER="SHARED_MEMORY_CACHE.md"
if grep -q "$MARKER" "$AGENTS_FILE" 2>/dev/null; then
  echo "AGENTS.md already contains the shared-memory instruction; skipping"
else
  echo ""
  echo "An instruction must be added to the startup protocol in AGENTS.md:"
  echo "Add the following to the 'Every Session' section:"
  echo "'5. Read SHARED_MEMORY_CACHE.md — shared-memory summary'"
  echo ""
  echo "Allow automatic modification? (y/n)"
  read -r CONFIRM
  if [ "$CONFIRM" = "y" ] |
...[truncated 3394 chars]
Remediation
View remediation

Remediation Suggestions

  1. Treat all synchronized repository content as untrusted data, never as higher-priority agent instructions.
  2. Do not designate remote files as universal rules or automatically execute commands found in TOOLS.md.
  3. Remove the persistent AGENTS.md hook, or replace it with a narrowly scoped loader that clearly labels synchronized content as non-authoritative reference data.
  4. Require explicit review and approval whenever a synchronized revision changes, rather than obtaining one-time approval during installation.
  5. Pin synchronization to reviewed commit hashes or signed release tags. Verify commit or tag signatures against an explicit trusted-author allowlist.
  6. Use a strict structured schema for memories and reject fields containing instruction-like directives, executable commands, tool requests, or attempts to alter agent policy.
  7. Display a diff before updating the cache and record the exact source repository and commit hash in the generated cache.
  8. Restrict repository collaborators through least privilege, branch protection, mandatory review, and strong authentication.
  9. Keep personal data separate from behavioral policy. Files containing preferences or knowledge should not be permitted to modify safety constraints, tool permissions, or system-level instructions.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/install.sh:89
Finding

Arbitrary Python execution through unsafe interpolation of repository and agent values

Content
View full analysis

Vulnerability Details

File Location: scripts/install.sh:89-101
Vulnerability Type: Python source-code injection
Risk Level: Critical

Vulnerable Code

bash
mkdir -p "$CONFIG_DIR"
python3 -c "
import json, datetime
config = {
  'repo_url': '$REPO_URL',
  'local_path': '$CONFIG_DIR',
  'agent_id': '$AGENT_ID',
  'last_sync': datetime.datetime.now().isoformat()
}
json.dump(config, open('$CONFIG_FILE', 'w'), indent=2, ensure_ascii=False)
print('Configuration file written')
"

The displayed snippet translates only the final user-facing message into English; the vulnerable interpolation and executable logic are unchanged.

Technical Analysis

REPO_URL and AGENT_ID originate from interactive input, existing local configuration, or the ~/.openclaw/agent-id file. These values are expanded directly into the source text passed to python3 -c.

Shell quoting does not make this safe. After shell variable expansion, the resulting text is parsed as Python source. A value containing single quotes and Python operators can terminate or extend the intended string expression and cause an attacker-selected Python expression to execute.

For example, a crafted agent ID shaped like the following remains syntactically valid inside the dictionary value while invoking os.system:

text
x' + (__import__('os').system('ATTACKER_COMMAND') and '') + '

After interpolation, the relevant Python expression becomes conceptually equivalent to:

python
'agent_id': 'x' + (__import__('os').system('ATTACKER_COMMAND') and '') + '',

Python evaluates the injected call while constructing the dictionary. No shell metacharacter injection is required because the attack targets the dynamically constructed Python program itself.

Attack Path

  1. An attacker causes a crafted value to be stored in ~/.openclaw/agent-id, supplies it through the interactive agent-ID prompt, or places a mali ...[truncated 1310 chars]
Remediation
View remediation

Remediation Suggestions

Do not interpolate shell variables into Python source. Pass data through positional arguments or environment variables and let Python treat it strictly as data. For example:

bash
python3 - "$REPO_URL" "$CONFIG_DIR" "$AGENT_ID" "$CONFIG_FILE" <<'PYEOF'
import datetime
import json
import sys

repo_url, config_dir, agent_id, config_file = sys.argv[1:]

config = {
    "repo_url": repo_url,
    "local_path": config_dir,
    "agent_id": agent_id,
    "last_sync": datetime.datetime.now().isoformat(),
}

with open(config_file, "w", encoding="utf-8") as handle:
    json.dump(config, handle, indent=2, ensure_ascii=False)
PYEOF

Additionally:

  1. Validate AGENT_ID against a conservative allowlist such as ^[A-Za-z0-9._-]{1,64}$.
  2. Parse and validate repository URLs, allowing only explicitly supported schemes and hosts.
  3. Reject control characters and unexpected line breaks in all configuration values.
  4. Validate existing configuration and agent-ID files as rigorously as interactive input.
  5. Create configuration files with restrictive permissions, such as mode 0600, if they may contain private repository locations or future credentials.
  6. Add automated tests containing quotes, backslashes, newlines, Python expressions, and shell metacharacters to ensure input is always serialized as data.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (18)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill is designed to collect preferences, habits, and related memory and transmit them to a GitHub repository, but the description does not clearly warn users of that remote data flow. This creates a meaningful privacy and consent risk because users may not realize their information will be persisted and shared across agents.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill describes reading and writing local files and modifying agent behavior, but it does not declare any explicit tool scope or permissions boundaries. This weakens least-privilege controls and makes it easier for the skill to perform file operations without clear user or platform visibility into what resources it needs.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrase "shared memory" is broad enough to match ordinary conversation rather than a deliberate request to invoke this skill. That can cause unintended activation of repository sync/read behavior and exposure of shared context or data transfer when the user was only speaking generally.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill explicitly instructs agents to collect and share the owner's preferences, habits, and communication style across multiple agents via a common repository and cache. This broad cross-agent persistence increases privacy exposure and expands the blast radius of any mistaken, excessive, or sensitive memory entry.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Defining USER.md as a shared location for the owner's preferences and habits institutionalizes storage of personal profiling data for broad reuse. Even in a private repository, this creates retention, over-sharing, and misuse risks if multiple agents or environments consume the same content.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The read operation loads all four shared memory files into context, including user-specific information and shared rules/tools, without narrowing to the current task. Bulk ingestion increases unnecessary exposure of personal data and also raises prompt-injection risk from remotely maintained markdown being inserted into model context.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
93% confidence
Finding

This is a duplicate persistence concern on the same write workflow: it stores conversation-derived information beyond the current session and propagates it to other agents. In context, shared remote persistence amplifies privacy and integrity risks compared with ordinary local memory because updates can influence multiple future sessions and systems.

Content

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

  1. 读取四个文件内容到上下文
  2. 告知用户"已加载共享记忆(最后更新:XXX)"

write — 写入新记忆

text
触发词:写入共享记忆、记录偏好、记住这个

Session Persistence

Medium
Category
Rogue Agent
Confidence
93% confidence
Finding

This is a duplicate persistence concern on the same write workflow: it stores conversation-derived information beyond the current session and propagates it to other agents. In context, shared remote persistence amplifies privacy and integrity risks compared with ordinary local memory because updates can influence multiple future sessions and systems.

Content

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

  1. 读取四个文件内容到上下文
  2. 告知用户"已加载共享记忆(最后更新:XXX)"

write — 写入新记忆

text
触发词:写入共享记忆、记录偏好、记住这个

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The write workflow directs agents to persist new memories, including owner preferences, and push them to a shared remote repository. This creates durable cross-agent propagation of potentially sensitive personal data and makes accidental or excessive collection more harmful than ordinary local note-taking.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The trigger phrase "记住这个" is a common conversational expression and may unintentionally invoke persistent storage. Because this skill writes to a shared GitHub repository, accidental activation could cause personal or sensitive user information to be stored and propagated to other agents.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The sync operation is explicitly silent while still pulling remote content and rewriting a local cache/config file. Silent background state changes reduce transparency and can import unreviewed remote instructions or personal data into the local environment without the user noticing.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The entire guide is written in Chinese and does not provide any language choice, opt-in, or explanation that the skill is intended only for a Chinese-speaking or region-specific audience. Under the policy, natural-language content that effectively forces a locale without user opt-in should be flagged.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
92% confidence
Finding

The guide instructs users to run a Docker image using the floating tag qdrant/qdrant without pinning a specific version or digest. This creates a supply-chain and reproducibility risk because future image changes could introduce vulnerable or unexpected behavior, and users following the documentation would implicitly trust whatever image is current at pull time.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The installer performs git clone/pull and may also push repository contents, but it does not clearly warn the user that data in this shared-memory repo will be transmitted to a remote service. In the context of a memory-sharing skill that stores preferences, rules, and knowledge, this can cause unintended disclosure of sensitive local or user-derived information to GitHub or another remote origin.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

The installer stores persistent session-related metadata such as repo_url, local_path, agent_id, and last_sync under the user's home directory. In a shared-memory skill, persistent identifiers and synchronization metadata can enable cross-session tracking and broaden the blast radius if local memory files or configuration are later exposed or misused.

Content

Scanner excerpt · scripts/install.sh (reported line 84)May include surrounding context.

sh
cd -

# 5. 写入配置文件
mkdir -p "$CONFIG_DIR"
python3 -c "
import json, datetime
config = {

Vague Triggers

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The automatic sync trigger "心跳时自动检查" is underspecified and allows background activation without clear user intent or bounded conditions. Ambiguous autonomous execution increases the chance of silent remote pulls and local file modification outside expected user workflows.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

User-facing prompts and status messages throughout the script are written in Chinese, which forces a specific language for interaction. There is no opt-in, language selection, or documentation that this installer is intended only for Chinese-speaking users or a Chinese-specific deployment context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The script creates and modifies local configuration, cache, agent-id, and AGENTS.md files without presenting an upfront consolidated notice of filesystem changes. While some modification is inherent to installation, silently altering agent startup behavior via AGENTS.md increases the chance of persistent, user-unexpected changes.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.