Back to skill

Security audit

Behavior Tracker

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local behavior tracker, but it profiles OpenClaw conversation memory and stores durable behavior reports without enough consent, scope, or retention controls.

Install only if you are comfortable with a skill reading your OpenClaw conversation memory and keeping a local behavioral profile. Prefer manual runs over cron or heartbeat automation unless you have explicitly opted in, and periodically inspect or delete the generated behavior-patterns.json, behavior-report.md, and behavior-last-check.json files.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

other

Warning
Location
scripts/analyzer.py:58
Finding

Automated Profiling of Persistent Conversation Memory

Content
View full analysis

Vulnerability Details

File Location: scripts/analyzer.py:58-139; related behavior in scripts/heartbeat_tracker.py:39-49, 78-124 and automatic execution guidance in SKILL.md:12-15, 19-27, 56-59
Vulnerability Type: Privacy-sensitive Agent memory profiling
Risk Level: Medium

Vulnerable Code

python
def extract_from_memory(date_str=None):
    """从记忆文件提取信息"""
    if date_str is None:
        date_str = datetime.now().strftime("%Y-%m-%d")
    
    memory_file = MEMORY_DIR / f"{date_str}.md"
    if not memory_file.exists():
        return None
    
    with open(memory_file, 'r') as f:
        content = f.read().lower()
    
    found = {"topics": [], "projects": [], "skills": []}
    
    for kw in KEYWORDS["topics"]:
        if kw.lower() in content:
            found["topics"].append(kw)
    
    for kw in KEYWORDS["projects"]:
        if kw.lower() in content:
            found["projects"].append(kw)
    
    for kw in KEYWORDS["skills"]:
        if kw.lower() in content:
            found["skills"].append(kw)
    
    return found

def analyze(days=7):
    """分析最近N天的行为"""
    results = {
        "topics": [],
        "projects": [],
        "skills": [],
        "dates": []
    }
    
    for i in range(days):
        date = datetime.now() - timedelta(days=i)
        date_str = date.strftime("%Y-%m-%d")
        
        found = extract_from_memory(date_str)
        if found:
            results["topics"].extend(found["topics"])
            results["projects"].extend(found["projects"])
            results["skills"].extend(found["skills"])
            results["dates"].append(date_str)
    
    return results

def update_patterns(analysis):
    """更新行为模式"""
    data = load_behavior_data()
    
    if "skills" not in data:
        data["skills"] = {}
    if "active_hours" not in data:
        data["active_hours"] = {}

...[truncated 3650 chars]
Remediation
View remediation

Remediation Suggestions

  1. Require explicit, informed opt-in before reading any persistent conversation-memory file.
  2. Default to manual analysis of user-selected files or explicitly supplied conversation summaries rather than scanning the workspace automatically.
  3. Clearly disclose every collected field, the analysis period, storage location, retention period, and intended use before activation.
  4. Provide controls to disable tracking, inspect collected data, reset counters, and securely delete all generated profiles.
  5. Minimize collection by omitting activity hours, skill usage, and project identifiers unless the user specifically requests those dimensions.
  6. Apply a short retention period and avoid indefinite cumulative aggregation.
  7. Create profile and report files with owner-only permissions, and verify that the target workspace is trusted before reading or writing.
  8. Validate and constrain OPENCLAW_WORKSPACE so an inherited or manipulated environment variable cannot silently redirect analysis to an unintended directory.
  9. Modify heartbeat processing to track the previously processed content boundary or a content hash. Process only new material rather than recounting every keyword whenever the file size changes.
  10. Keep automatic scheduling disabled by default and require a separate, explicit user action to enable recurring analysis.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (16)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The skill claims automatic behavior recording and analysis, but the described implementation appears to only store supplied labels/counters via manual invocation rather than meaningfully analyze conversations. This is dangerous because it misrepresents capability and data handling, preventing users from understanding what is actually collected and stored.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill claims automatic behavior recording and analysis, but the described implementation appears to only store supplied labels/counters via manual invocation rather than meaningfully analyze conversations. This is dangerous because it misrepresents capability and data handling, preventing users from understanding what is actually collected and stored.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill promotes automatic recording and behavioral analysis of conversations without a prominent warning, consent flow, or clear privacy notice. Because the data concerns user behavior patterns inferred from conversations, inadequate disclosure creates substantial privacy and trust risk even if the implementation is technically simple.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill declares automation around recording and analysis while omitting any explicit tool scope or permission boundaries, despite detected read/write and environment capabilities. That makes data access and persistence implicit and harder to audit, which is risky for a privacy-sensitive skill that handles conversation-derived behavioral data.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger condition 'after each important conversation' is subjective and overly broad, creating room for automatic recording without a predictable or user-controlled boundary. For a privacy-affecting skill, ambiguous triggers increase the chance of over-collection and unauthorized profiling.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The module description and subsequent user-facing strings are presented in Chinese, and the script does not offer any language selection or opt-in. This can violate language/locale policy where skills must not force a locale-specific experience without explicit choice or justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script persistently stores conversation-derived behavioral analytics to disk without any user notice, consent flow, retention limit, or access control. Because the skill's stated purpose is to automatically record and analyze user behavior patterns from conversations, this creates a real privacy and surveillance risk: users may unknowingly have sensitive interests, habits, and activity patterns profiled over time.

Content

No source excerpt is available for this finding.

Tainted flow: 'BEHAVIOR_FILE' from os.environ.get (line 16, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/analyzer.py (reported line 55)May include surrounding context.

python
"""保存行为数据"""
    data["last_updated"] = datetime.now().isoformat()
    BEHAVIOR_FILE.parent.mkdir(parents=True, exist_ok=True)
    with open(BEHAVIOR_FILE, 'w') as f:
        json.dump(data, f, indent=2, ensure_ascii=False)

def extract_from_memory(date_str=None):

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script prints status messages and generates a markdown report entirely in Chinese, creating a fixed-language user experience. No configuration, opt-in, or documented region-specific scope is provided to justify the enforced locale.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The generated markdown report writes aggregated conversation-derived behavioral information to persistent storage without warning the user. Even if summarized, the report can expose interests, project associations, and usage patterns to anyone with filesystem access, increasing privacy impact beyond transient in-memory processing.

Content

No source excerpt is available for this finding.

Tainted flow: 'report_file' from os.environ.get (line 194, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/analyzer.py (reported line 195)May include surrounding context.

python
# 3. 生成报告
    report = generate_report(analysis, data)
    report_file = MEMORY_DIR / "behavior-report.md"
    with open(report_file, 'w') as f:
        f.write(report)
    
    print(f"[{datetime.now()}] ✅ 分析完成!")

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script is presented as a manual conversation note recorder, but it persistently stores topic, project, and skill usage data in a behavior-patterns.json file. That mismatch increases privacy risk because users or operators may not realize they are building a durable behavioral profile rather than taking transient notes.

Content

No source excerpt is available for this finding.

Tainted flow: 'BEHAVIOR_FILE' from os.environ.get (line 13, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
95% confidence
Finding

The output path is derived from the OPENCLAW_WORKSPACE environment variable and then used for file writes without validation. An attacker who can influence the runtime environment could redirect writes to an unintended location, causing unauthorized file creation or overwrite within the agent's permissions.

Content

Scanner excerpt · scripts/recorder.py (reported line 22)May include surrounding context.

python
return {"topics": {}, "projects": {}, "skills": {}}

def save_data(data):
    with open(BEHAVIOR_FILE, 'w') as f:
        json.dump(data, f, indent=2, ensure_ascii=False)

def record(topic=None, project=None, skill=None, note=None):

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

User-supplied notes are echoed directly to stdout, which can expose sensitive conversation content in terminal scrollback, logs, or higher-level agent telemetry. In an agent environment, stdout is often captured automatically, so this increases the chance of unintended disclosure.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains natural-language documentation entirely in Chinese and does not mention that the language is optional or intended for a specific locale. Under the language/locale policy, forcing a specific language without user opt-in is a policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring and all user-facing CLI text are presented only in Chinese, which imposes a specific language on users without opt-in. Under the policy, forcing a language or locale without choice or clear justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.