Back to skill

Security audit

Metaclaw

Security checks for vulnerabilities and agentic risk

Overview

MetaClaw appears purpose-built for memory management, but it needs review because it can persist conversation-derived data, run scheduled memory processing, mutate skill files, and has a local file-access boundary bug.

Install only if you want this skill to read local memory/session content and persist extracted preferences or project facts. Run extraction and digest commands in dry-run mode first, avoid enabling the cron job until you have reviewed outputs, do not pass untrusted --date values, and use pinned dependencies if possible. Treat --allow-write as an administrative maintenance mode because it can change skill files.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/memory-extract.py:80
Finding

Unvalidated date argument permits directory traversal when reading session files

Content
View full analysis

Vulnerability Details

File Location: scripts/memory-extract.py:80-89, 405-411, 437-441
Vulnerability Type: Path traversal / unintended local file access
Risk Level: Medium

Vulnerable Code

python
def get_last_session_content(date: str) -> str:
    """Get content from last session (either LCM or memory file)."""
    session_file = MEMORY_DIR / f"{date}.md"
    
    if session_file.exists():
        return session_file.read_text()
    
    # Try LCM via openclaw command (if available)
    try:
        result = os.popen("lcm_describe 2>/dev/null").read()

The value originates from a command-line argument without format validation:

python
parser.add_argument(
    "--date",
    type=str,
    default=None,
    help="Date for session to process (YYYY-MM-DD)"
)

It is subsequently passed directly to the file-access function:

python
extraction_date = args.date or get_latest_session_date()
logger.info(f"Processing date: {extraction_date}")

# Get content
content = get_last_session_content(extraction_date)

Technical Analysis

Although the documented format is YYYY-MM-DD, the program does not enforce that format. pathlib.Path preserves path separators and parent-directory components contained in date. Consequently, a value such as ../../target produces a path equivalent to:

text
<workspace>/memory/../../target.md

This escapes the intended memory directory. If the resulting Markdown file exists and is readable by the current process, its contents are loaded as session data. The contents are then incorporated into the extraction prompt and submitted to the configured local Ollama API.

The vulnerability does not bypass operating-system permissions. It nevertheless violates the application’s intended file-access boundary and allows any caller who can control the command-line argument to select arbitrary readable .md files re ...[truncated 1230 chars]

Remediation
View remediation

Remediation Suggestions

  1. Parse and validate --date before using it in a path:

    python
    from datetime import datetime
    
    def validate_date(value: str) -> str:
        try:
            parsed = datetime.strptime(value, "%Y-%m-%d")
        except ValueError as exc:
            raise argparse.ArgumentTypeError(
                "Date must use the YYYY-MM-DD format"
            ) from exc
    
        canonical = parsed.strftime("%Y-%m-%d")
        if canonical != value:
            raise argparse.ArgumentTypeError("Date is not canonical")
        return canonical
    

    Register this function as the argument type:

    python
    parser.add_argument("--date", type=validate_date, default=None)
    
  2. Enforce containment as a defense-in-depth measure:

    python
    session_file = (MEMORY_DIR / f"{date}.md").resolve()
    memory_root = MEMORY_DIR.resolve()
    
    if session_file.parent != memory_root:
        raise ValueError("Session file must be inside the memory directory")
    
  3. Apply the same canonical validation to the date used in report filenames.

  4. Read files with an explicit encoding and handle permission and decoding failures safely.

  5. Add regression tests for ../, absolute paths, path separators, malformed dates, and valid leap-year dates.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:26
Finding

Installation instructions use unpinned third-party dependencies

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:26-32 and README.md:27-34
Vulnerability Type: Unpinned dependency installation / supply-chain exposure
Risk Level: Medium

Vulnerable Code

bash
# VEnv für Dependencies erstellen (wird automatisch verwendet)
cd ~/.openclaw/workspace/skills/metaclaw
python3 -m venv .venv-metaclaw
source .venv-metaclaw/bin/activate
pip install lancedb sentence-transformers

The troubleshooting instructions also introduce an additional unpinned dependency:

bash
source .venv-metaclaw/bin/activate
pip install lancedb sentence-transformers numpy

Technical Analysis

The installation commands resolve mutable package versions from whichever Python package index is configured in the user’s environment. No exact versions, integrity hashes, lock file, or approved index URL are specified.

As a result, the reviewed Skill does not uniquely identify the code that users will install and execute. A future compromised release, compromised package-index account, malicious configured mirror, or dependency-confusion condition could introduce code that was not present during this audit. Python packages may execute code during installation and will execute package code when imported by the memory search implementation.

The package names themselves are not shown to be malicious. The finding concerns the lack of reproducible and integrity-verified dependency resolution.

Attack Path

  1. A user follows the documented installation command.
  2. pip contacts the package index or mirror configured in the environment.
  3. Because versions and hashes are unrestricted, pip selects the currently preferred compatible releases and transitive dependencies.
  4. A compromised or substituted package is downloaded and installed into the virtual environment.
  5. Malicious installation hooks or imported package code execute with the privileges of the user running the Skill. 6 ...[truncated 667 chars]
Remediation
View remediation

Remediation Suggestions

  1. Create a reviewed dependency lock file containing exact versions for direct and transitive dependencies.

  2. Generate and verify cryptographic hashes, then install with hash enforcement:

    bash
    python3 -m pip install --require-hashes -r requirements.lock
    
  3. Use python3 -m pip instead of a bare pip command to ensure installation targets the intended interpreter.

  4. Specify an approved package index and prevent unintended fallback indexes where appropriate:

    bash
    python3 -m pip install \
      --index-url https://pypi.org/simple \
      --require-hashes \
      -r requirements.lock
    
  5. Review package provenance, release signatures where available, and transitive dependencies before updating the lock file.

  6. Add automated dependency vulnerability and integrity scanning to the release process.

  7. Keep the virtual environment, but clarify that it provides dependency isolation rather than a security sandbox.

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
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (36)

Tainted flow: 'req' from os.environ.get (line 146, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/memory-extract.py (reported line 153)May include surrounding context.

python
method="POST"
            )
            
            with urllib.request.urlopen(req, timeout=OLLAMA_TIMEOUT) as response:
                result = json.loads(response.read().decode())
                response_text = result.get("response", "{}")
                return json.loads(response_text)

Self-Modification

High
Category
Rogue Agent
Confidence
95% confidence
Finding

The documented --auto-fix --allow-write workflow explicitly enables automated modification of skill files, which is self-modifying behavior. In an agent ecosystem, write-capable self-repair or self-evolution features are dangerous because they can silently alter trusted skill logic, introduce supply-chain risk, or corrupt behavior if triggered without strict review.

Content

Scanner excerpt · README.md (reported line 104)May include surrounding context.

python3 skills/metaclaw/scripts/skill-eval.py --auto-fix skills/metaclaw/

Auto-Fix (mit Schreiben)

python3 skills/metaclaw/scripts/skill-eval.py --auto-fix --allow-write skills/metaclaw/

text

---

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

Auto-fix, backup creation, deletion, and write operations to SKILL.md are materially different from the declared memory-management role. A skill that can rewrite its own documentation or related files without a clear, narrow declaration creates integrity risks and can be abused to conceal future behavior changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
88% confidence
Finding

Auto-fix, backup creation, deletion, and write operations to SKILL.md are materially different from the declared memory-management role. A skill that can rewrite its own documentation or related files without a clear, narrow declaration creates integrity risks and can be abused to conceal future behavior changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
86% confidence
Finding

Auto-fix, backup creation, deletion, and write operations to SKILL.md are materially different from the declared memory-management role. A skill that can rewrite its own documentation or related files without a clear, narrow declaration creates integrity risks and can be abused to conceal future behavior changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Auto-fix, backup creation, deletion, and write operations to SKILL.md are materially different from the declared memory-management role. A skill that can rewrite its own documentation or related files without a clear, narrow declaration creates integrity risks and can be abused to conceal future behavior changes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Auto-fix, backup creation, deletion, and write operations to SKILL.md are materially different from the declared memory-management role. A skill that can rewrite its own documentation or related files without a clear, narrow declaration creates integrity risks and can be abused to conceal future behavior changes.

Content

No source excerpt is available for this finding.

Self-Modification

High
Category
Rogue Agent
Confidence
96% confidence
Finding

The documented auto-fix mode can write into the skill directory, which constitutes self-modification or modification of the skill package. Self-editing behavior is dangerous because it can alter future execution semantics, bypass review expectations, or persist unsafe changes under the guise of maintenance.

Content

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

python3 scripts/skill-eval.py --layer1 skills/metaclaw/

Auto-Fix (mit --allow-write zum Schreiben)

python3 scripts/skill-eval.py --auto-fix --allow-write skills/metaclaw/

text

### Output

Self-Modification

High
Category
Rogue Agent
Confidence
96% confidence
Finding

This is a second occurrence of the same self-modification capability: auto-fix with write access to the skill path. Repetition in the documentation reinforces that mutation of the skill's own files is an intended feature, which raises integrity and persistence concerns in an agent ecosystem.

Content

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

python3 scripts/skill-eval.py --auto-fix skills/metaclaw/

Auto-Fix (mit Schreiben)

python3 scripts/skill-eval.py --auto-fix --allow-write skills/metaclaw/

text

### Quality Targets

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script executes another script from a workspace-controlled path: "$WORKSPACE/scripts/session-counter.sh". If an attacker can modify the workspace or influence the WORKSPACE environment variable, they can cause arbitrary code execution whenever memory-digest runs, which is far more dangerous than simple digesting logic.

Content

No source excerpt is available for this finding.

os.system() or os exec-family call

High
Category
Dangerous Code Execution
Confidence
96% confidence
Finding

The script invokes an external command through the shell using os.popen("lcm_describe 2>/dev/null"), which inherits PATH and shell semantics. Even though the command string is constant, an attacker controlling the runtime environment or PATH could cause execution of a malicious binary, turning a memory-extraction helper into arbitrary code execution.

Content

Scanner excerpt · scripts/memory-extract.py (reported line 89)May include surrounding context.

python
# Try LCM via openclaw command (if available)
    try:
        result = os.popen("lcm_describe 2>/dev/null").read()
        if result:
            return result
    except Exception as e:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README advertises automatic memory extraction and write-capable auto-fix behavior, but it does not prominently warn that these actions can modify persisted memory data or skill files. In an agent skill context, unclear documentation around autonomous writes increases the risk of unintended data alteration, privacy issues, and unsafe execution by users who assume the commands are read-only.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
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.

Content

Scanner excerpt · README.md (reported line 104)May include surrounding context.

python3 skills/metaclaw/scripts/skill-eval.py --auto-fix skills/metaclaw/

Auto-Fix (mit Schreiben)

python3 skills/metaclaw/scripts/skill-eval.py --auto-fix --allow-write skills/metaclaw/

text

---

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The optional cron-based auto-consolidation is documented as unattended recurring execution, but the README does not clearly warn that it can repeatedly modify memory data without interactive review. In a memory-management skill, background persistence and consolidation can amplify mistakes, overwrite useful history, or store sensitive content over time.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
91% confidence
Finding

The cron example establishes unattended periodic execution, which is a form of persistence. In the context of a memory-management skill that performs consolidation, persistent scheduled execution can continuously process and modify data long after initial setup, increasing the blast radius of logic errors or misuse.

Content

Scanner excerpt · README.md (reported line 186)May include surrounding context.

Cron-Job (Optional)

bash
# crontab -e
# Tägliche Auto-Dream Consolidation (03:00)
0 3 * * * "$HOME/.openclaw/workspace/skills/metaclaw/scripts/memory-digest.sh" --auto-dream

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill documents shell commands, package installation, cron setup, and file-modifying operations but does not declare any explicit tool scope or permissions boundary. In an agent setting, missing scope metadata increases the chance that the skill is invoked with broader filesystem, shell, or network capabilities than a user expects.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
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.

Content

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

PluginEval Quality Check

python3 scripts/skill-eval.py --layer1 skills/metaclaw/

Auto-Fix (mit --allow-write zum Schreiben)

python3 scripts/skill-eval.py --auto-fix --allow-write skills/metaclaw/

text

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill advertises auto-fix with write capability but does not prominently warn that local files and memory data may be modified. Users may invoke these commands expecting analysis only, leading to unintended integrity changes in skill definitions or stored memory artifacts.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The cron-based auto-dream setup enables unattended, scheduled modification of memory files without a strong warning about automatic changes. Unattended mutation increases the risk of silent corruption, privacy issues, or confusing state changes over time, especially in a memory-management context.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
91% confidence
Finding

The cron job establishes persistence by causing the system to run the skill's consolidation script automatically on a schedule. Persistence mechanisms are security-relevant because they extend the lifetime and autonomy of side effects beyond the initiating session.

Content

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

Cron-Job (Optional)

bash
# crontab -e
# Tägliche Auto-Dream Consolidation (03:00)
0 3 * * * "$HOME/.openclaw/workspace/scripts/memory-digest-enhanced.sh" --auto-dream

Session Persistence

Medium
Category
Rogue Agent
Confidence
91% confidence
Finding

This is another persistence instruction via cron integration, again enabling unattended recurring execution. In context, recurring memory consolidation can silently mutate long-lived local state, making the risk greater than a one-time manual command.

Content

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

Cron Integration

bash
# crontab -e
# Auto-Dream tägliche Consolidation (Optional)
0 3 * * * "$HOME/.openclaw/workspace/scripts/memory-digest-enhanced.sh" --auto-dream

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The header comments describe the script as consolidating, cleaning, and reorganizing memory files, but the implemented actions are mostly diagnostic checks plus explicit state mutation: resetting an external session counter and writing a timestamp file. Those writes go beyond a passive 'digest' or inspection role implied by the file name and summary comments.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

A digest/consolidation tool would be expected to analyze or possibly reorganize memory artifacts, but resetting a session counter changes broader runtime state. That side effect is not evident from the file's documentation and is not obviously required to check stale references, memory size, or date formatting.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The script reaches outside its direct data sources and executes an external command to fetch session data, expanding its trust boundary unnecessarily. In the skill context, this is more dangerous because the tool processes sensitive conversation memory; pulling data via a shell command can expose the process to command hijacking, unexpected side effects, or ingestion of untrusted output.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The prompt explicitly instructs the model to mine full session content for preferences, facts, and project updates and then persist them into memory files, creating durable storage of potentially sensitive personal and operational data. In this skill context, that is especially risky because it transforms ephemeral conversation data into long-lived artifacts without apparent minimization, classification, or retention controls.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.