Back to skill

Security audit

CrabPath

Security checks for vulnerabilities and agentic risk

Overview

CrabPath is a coherent memory-graph skill, but its workspace indexing and rebuild flows can expose or overwrite more local data than users would reasonably expect if paths are not tightly controlled.

Install only if you are comfortable with a persistent local memory graph over selected workspaces and optional transmission of indexed text to OpenAI. Use trusted, non-shared workspace directories, avoid indexing untrusted repositories or symlinks, prefer hash/offline mode for sensitive data, and do not run the OpenClaw rebuild scripts as a privileged account until path containment and private cache handling are fixed.

Vulnerability Patterns
  • 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
  • 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)

T09 · Insecure Skill Coding Practices

Error
Location
crabpath/split.py:397
Finding
Workspace Symlink Boundary Bypass Can Expose Files to OpenAI<![CDATA[ ## Vulnerability Details **File Location**: `crabpath/split.py:397-411`; network transmission occurs through `examples/openclaw_adapter/init_agent_brain.py:289-317` **Vulnerability Type**: Workspace boundary bypass and sensitive-data disclosure through symlink traversal **Risk Level**: High ### Vulnerable Code ```python for filename in sorted(file_names): rel = (rel_dir / filename).as_posix() if rel_dir.parts else filename file_path = Path(dir_path) / filename if not file_path.is_file() or file_path.suffix.lower() not in extensions: continue if _should_skip_path(rel, excludes, gitignore_patterns): continue candidates.append((file_path, rel)) split_plan: list[tuple[int, str, str, bool]] = [] for file_path, rel in candidates: text = file_path.read_text(encoding="utf-8") ``` The resulting text is passed to the OpenAI embedding callback: ```python graph, texts = split_workspace(str(workspace), llm_fn=None, llm_batch_fn=None) # ... embeddings = batch_or_single_embed( list(texts.items()), embed_batch_fn=embed_batch, ) ``` The callback submits the raw content: ```python response = client.embeddings.create( model=OPENAI_EMBEDDING_MODEL, input=list(contents), ) ``` ### Technical Analysis `Path.is_file()` and `Path.read_text()` follow symbolic links. The workspace scanner checks the lexical relative filename against exclusions, but it does not resolve each candidate to its canonical path and confirm that the resolved path remains beneath the canonical workspace directory. Consequently, a supported file inside the workspace can be a symbolic link to an arbitrary readable file outside the workspace. The scanner tests the extension of the symlink name rather than the resolved target, so an attacker can use a name such as `reference.json` even when the external target has another name. The default supported extensions include `.json`, `.yaml`, `.yml`, `.toml`, `.cfg`, `.ini`, `.md`, and `.txt`. Th ...[truncated 2388 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Reject symbolic links by default: ```python if file_path.is_symlink(): continue ``` 2. Enforce canonical workspace containment before reading: ```python workspace_root = workspace.resolve() try: resolved_file = file_path.resolve(strict=True) resolved_file.relative_to(workspace_root) except (FileNotFoundError, RuntimeError, ValueError): continue if not resolved_file.is_file(): continue ``` 3. Open files defensively to reduce check-to-use races. On supported platforms, use a directory file descriptor and `O_NOFOLLOW`, then verify with `fstat()` that the opened object is a regular file. 4. Apply the same containment policy to directory entries and explicitly prohibit traversal through symlinked directories, even if future code enables `os.walk(..., followlinks=True)`. 5. Add default exclusions for common sensitive filenames and patterns, including credential files, private keys, token stores, and provider configuration. Secret detection should supplement—not replace—the canonical containment check. 6. Add a preview or confirmation mode that lists every file whose contents will be sent to a network-backed embedder. 7. Update the OpenAI adapter documentation to state explicitly that raw workspace chunks and optional learning-record text are transmitted to the configured provider. 8. Add regression tests covering: - A file symlink to a target outside the workspace - A symlink with a supported name pointing to a differently named target - A symlink to a sensitive file - A symlink remaining within the workspace, according to the intended policy - A directory symlink escaping the workspace ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
examples/openclaw_adapter/rebuild_all_brains.py:34
Finding
Predictable Shared Temporary Cache Allows Symlink-Based File Overwrite<![CDATA[ ## Vulnerability Details **File Location**: `examples/openclaw_adapter/rebuild_all_brains.py:34-49` and `examples/openclaw_adapter/rebuild_all_brains.py:314-315` **Vulnerability Type**: Unsafe predictable temporary file and symlink-following write **Risk Level**: Medium ### Vulnerable Code The cache paths are fixed names in the shared `/tmp` directory: ```python AGENTS = { "main": { "workspace": Path.home() / ".openclaw" / "workspace", "sessions": Path.home() / ".openclaw" / "agents" / "main" / "sessions", "output": Path.home() / ".crabpath" / "main", "cache": Path("/tmp/crabpath_main_embeddings.json"), }, "pelican": { "workspace": Path.home() / ".openclaw" / "workspace-pelican", "sessions": Path.home() / ".openclaw" / "agents" / "pelican" / "sessions", "output": Path.home() / ".crabpath" / "pelican", "cache": Path("/tmp/crabpath_pelican_embeddings.json"), }, "bountiful": { "workspace": Path.home() / ".openclaw" / "workspace-bountiful", "sessions": Path.home() / ".openclaw" / "agents" / "bountiful" / "sessions", "output": Path.home() / ".crabpath" / "bountiful", "cache": Path("/tmp/crabpath_bountiful_embeddings.json"), }, } ``` The cache is later written without a symlink, ownership, or regular-file check: ```python updated_cache = {**cached, **new_vecs} cache_path.write_text(json.dumps(updated_cache)) ``` ### Technical Analysis The script uses fixed and publicly predictable filenames under `/tmp`, which is commonly writable by all local users. `Path.write_text()` follows symbolic links and truncates the resolved target. The implementation does not: - Reject symbolic links - Verify that the existing path is a regular file - Verify ownership - Use exclusive creation - Set an explicit restrictive file mode - Write atomically through a private temporary file A local attacker can pre-create one of the cache paths as a symbolic l ...[truncated 1827 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Move embedding caches out of shared `/tmp` and into a private per-user application cache directory, for example: ```python cache_root = Path.home() / ".cache" / "crabpath" cache_root.mkdir(parents=True, exist_ok=True, mode=0o700) cache_path = cache_root / "main_embeddings.json" ``` 2. Verify that the cache directory is owned by the current user and is not a symbolic link. 3. Reject an existing cache path if it is a symbolic link or non-regular file: ```python if cache_path.is_symlink(): raise RuntimeError(f"Refusing symlink cache path: {cache_path}") ``` 4. Write atomically using a uniquely named temporary file in the same private directory, set mode `0600`, flush and synchronize it, and then use `os.replace()`: ```python import os import tempfile fd, temporary_name = tempfile.mkstemp( prefix=".embeddings-", suffix=".tmp", dir=cache_path.parent, ) try: os.fchmod(fd, 0o600) with os.fdopen(fd, "w", encoding="utf-8") as handle: json.dump(updated_cache, handle) handle.flush() os.fsync(handle.fileno()) os.replace(temporary_name, cache_path) except Exception: try: os.unlink(temporary_name) except FileNotFoundError: pass raise ``` 5. When reading an existing cache, verify ownership, regular-file status, and restrictive permissions before trusting its contents. 6. Add tests that pre-create the cache as: - A symlink to another file - A directory - A file owned by another user where test infrastructure permits - A malformed or excessively large JSON file ]]>
Vulnerability Patterns
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (98)

Memory Manipulation

High
Category
Memory Poisoning
Content
### Fix: save_state() embedder metadata preservation
- Now reads existing meta before writing; no more silent hash-v1/1024 overwrite
- Dimension mismatch raises ValueError (prevents corrupt state)
- Fixes GitHub Issue #1 item #7 (CormorantAI production data corruption)

### Fix: Rebuild preserves injected nodes
Confidence
90% confidence
Finding
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The analyzer indicates direct access to local workspaces, logs, caches, SQLite databases, backup/rebuild workflows, and subprocess execution, all of which are far outside a pure memory-core claim. This can create serious integrity and confidentiality risks if administrators deploy the skill assuming limited behavior.

Static analysis

No suspicious patterns detected.