Back to skill

Security audit

Kb Mini

Security checks for vulnerabilities and agentic risk

Overview

This knowledge-base skill matches its general purpose, but it automatically stores conversation content, can retain secrets, and has serious injection flaws that require Review before installation.

Install only if you are comfortable with a persistent local knowledge database that may automatically save full conversation turns. Avoid sharing secrets while it is enabled, prefer a private KB path, and require fixes for parameterized database access, safe summarization, secret redaction, explicit capture consent, and review/delete controls before using it for sensitive work.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/lifecycle.sh:118
Finding

Arbitrary Python Code Execution Through Stored Knowledge Content

Content
View full analysis
/dev/null) if [[ -z "$content" ]]; then echo '{"status": "error", "error": "Entry not found"}' return 1 fi local summary summary=$(echo "$content" | head -c "$limit") if [[ ${#content} -gt $limit ]]; then summary="$summary..." fi local key_points key_points=$(echo "$content" | grep -oE '[^.!?]+[.!?]' | head -3 | tr '\n' ' ' || echo "") local dag_summary dag_summary=$(python3 -c " import sys, json content = '''$content''' summary = '''$summary''' key_points = '''$key_points''' dag = { 'd0': content, 'd2': { 'summary': summary, 'key_points': key_points, 'word_count': len(content.split()), 'char_count': len(content) } } print(json.dumps(dag, ensure_ascii=False, indent=2)) " 2>/dev/null) ``` ### Technical Analysis Knowledge-base content, its derived summary, and extracted key points are interpolated directly into source code passed to `python3 -c`. Shell quoting does not make these values safe Python literals. A stored value containing a triple-quote terminator such as `'''` can escape the intended string literal and introduce arbitrary Python statements. Python can then invoke operating-system commands through modules such as `os` or `subprocess`. This is a second-order injection vulnerability: the malicious value is first stored as data and is executed later when the entry is summarized. The existing SQL injection vulnerabilities provide one way to place a specially crafted value into the database. An attacker with another legitimate database-writing path could exploit the same sink. ### Attack Path 1. An attacker causes c ...[truncated 1151 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/storage.sh:142
Finding

SQL Injection Across Storage, Search, Retrieval, and Lifecycle Operations

Content
View full analysis
/dev/null || true) local action if [[ -n "$existing" ]]; then action="update" sqlite3 "$db" " UPDATE entries SET content = content || char(10) || '$content', updated_at = '$updated_at', metadata = '$metadata' WHERE topic_key = '$topic_key' " else action="insert" sqlite3 "$db" " INSERT INTO entries (id, topic_key, title, content, source, tags, access_level, created_at, updated_at, metadata) VALUES ('$id', '$topic_key', '$title', '$content', '$source', '$tags', $access_level, '$created_at', '$updated_at', '$metadata') " sqlite3 "$db" " INSERT INTO knowledge_entries (id, topic_key, title, content, source, tags, access_level, created_at, updated_at) VALUES ('$id', '$topic_key', '$title', '$content', '$source', '$tags', $access_level, '$created_at', '$updated_at') " 2>/dev/null || true fi ``` From `scripts/storage.sh:207-229`: ```bash if [[ -n "$source" ]]; then where_conditions="$where_conditions AND source = '$source'" fi local search_term="%$query%" local results results=$(sqlite3 -json "$db" " SELECT id, topic_key, title, CASE WHEN access_level <= 1 THEN substr(content, 1, 200) ELSE substr(content, 1, 500) END as summary, source, tags, updated_at, 1.0 as relevance_score FROM entries WHERE ($where_conditions) AND (title LIKE '$search_term' OR content LIKE '$search ...[truncated 2952 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/retriever.sh:243
Finding

Automatic Plaintext Persistence of API Keys, Tokens, Passwords, and Complete Conversation Turns

Content
View full analysis
= $threshold else 1)" 2>/dev/null; then captured="true" else captured="false" fi ``` From `scripts/hooks.sh:95-157`: ```bash local turn="$user_message" if [[ -n "$agent_message" ]]; then turn="$turn\n$agent_message" fi local capture_result capture_result=$("$RETRIEVER_SCRIPT" capture --turn "$turn" --threshold "$threshold" 2>/dev/null) ... if [[ "$captured" == "true" ]]; then local title="User note: ${user_message:0:50}" local content="$turn" local topic_key topic_key=$(echo "$user_message" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/-\+/-/g' | sed 's/^-//' | sed 's/-$//' | cut -c1-50) "$STORAGE_SCRIPT" store \ --title "$title" \ --content "$content" \ --source "capture" \ --topic-key "capture-$topic_key" \ --tags "auto-captured" \ > /dev/null 2>&1 fi ``` The behavior is explicitly tested in `tests/hooks_test.sh:45-69`: ```bash TEST_DB="/tmp/kb_hooks_t2_$$.db" export KNOWLEDGE_DB="$TEST_DB" rm -f "$TEST_DB" "$STORAGE" init result=$("$HOOKS" after_turn --user "请记住这个配置:api_key=12345" --agent "好的,已记住" ...[truncated 2258 chars]
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
scripts/retriever.sh:147
Finding

Persistent Agent Memory Poisoning Through Automatically Recalled Untrusted Content

Content
View full analysis
/dev/null) local entries_count entries_count=$(echo "$result" | python3 -c " import sys, json, re try: raw = sys.stdin.read() raw = re.sub(r'[\x00-\x1f\x7f-\x9f]', ' ', raw) data = json.loads(raw) print(len(data.get('results',[]))) except: print(0) " 2>/dev/null || echo "0") echo "{\"injected_context\": \"$injected\" ...[truncated 2324 chars]
Remediation
View remediation
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 Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (43)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The design explicitly states that after each reply the system may extract and store user preferences, configuration, and important conversational context, yet it provides no visible privacy notice, consent flow, or data classification controls. This creates a real risk of silently persisting sensitive natural-language data, including secrets or personal information, into a long-lived knowledge store.

Content

No source excerpt is available for this finding.

Self-Modification

High
Category
Rogue Agent
Confidence
90% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · RESEARCH.md (reported line 72)May include surrounding context.

md
**核心设计**:
- **53 个 skills**: 15 核心 + 37 OpenClaw-native + 1 community
- **Self-modifying**: agent 可以自己写新 skill
- **DAG-based memory compaction**: 层级摘要 DAGs
- **SQLite session persistence + FTS5**: 和我们的方案类似!
- **Security guardrails**: 6 层安全防护

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The capture logic explicitly assigns high scores to turns containing API keys, tokens, passwords, and similar sensitive data, marking them as worth remembering. Doing this automatically and without user-facing warning creates a serious privacy and secret-handling risk because credentials may be retained in memory systems where they can later be exposed or misused.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The code treats mentions of credentials and passwords as especially valuable for capture, assigning them the highest capture score. In the context of a knowledge-base skill, this makes the feature more dangerous because a memory subsystem is an inappropriate place to retain secrets and may later leak them through retrieval, logs, or downstream prompts.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Automatic capture into a persistent or shared knowledge base creates a classic retention and leakage risk for free-form conversation data. Because natural-language exchanges often contain credentials, private preferences, internal plans, or other sensitive context, persistent storage materially increases the blast radius of later compromise, misuse, or unintended retrieval.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The shared knowledge-base mode allows multiple agents to read and write the same database, but the plan does not describe access controls, trust boundaries, provenance, or integrity protections. In this context, one agent could poison shared memory, read data from another workflow, or cause cross-agent leakage of sensitive information.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger keywords include broad everyday phrases like '记得这个' and '保存上下文', which can cause the skill to activate unintentionally during normal conversation. In a knowledge-base skill that persists data and may run hooks automatically, accidental invocation can lead to unwanted storage or retrieval of user data without clear intent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The automatic trigger scenarios are described at a high level without guardrails, opt-in requirements, or exclusion rules. Because the skill performs recall before conversations and capture after turns, vague activation boundaries can cause over-collection, unwanted context injection, or storage of sensitive information in situations the user did not anticipate.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file contains all user-facing content in Chinese, and there is no indication that the skill or its documentation supports user language choice or that Chinese is a required locale. Under the policy, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list is broad and includes generic terms like "knowledge base", "知识库", "KB", "记得这个", and "记忆", which can plausibly appear in normal conversation without an explicit intent to invoke persistent storage or retrieval. In a skill that can automatically retrieve before a session and store after a turn, unintended activation can expose prior stored data or cause silent persistence of user content beyond what the user expected.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill describes automatic retrieval in a before_agent_start hook and automatic storage in an after_turn hook, but does not provide a clear user warning, consent mechanism, or limits on what conversation content may be persisted. This is dangerous because users may unknowingly have sensitive prompts, secrets, or personal data searched against and written into a long-lived SQLite knowledge base, potentially shared across agents via environment-controlled paths.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The design explicitly captures post-conversation data such as user preferences, decisions, and important context after every turn, but the specification does not require clear user notice, consent, minimization, or retention controls at capture time. In a memory skill, this creates a real privacy risk because sensitive personal or operational information may be persistently stored without the user understanding that retention is happening.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Automatic capture of user-provided preferences and important context from every turn materially increases the chance that sensitive natural-language data will be retained long-term. In this skill context, the danger is higher because the entire purpose of the component is persistent storage and later retrieval, so any overcollection can propagate private data across future interactions.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The capture API accepts an entire dialogue turn as input, which encourages verbatim logging of user inputs and agent outputs. That design can easily store secrets, credentials, personal data, internal prompts, or confidential business context, especially when combined with automatic hooks and shared KB support.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The spec documents kb capture --turn as an automatic hook that stores conversation content based on a threshold, but it provides no user-facing notice, consent model, retention policy, or redaction guidance. This can lead to unintended collection of sensitive user prompts, agent outputs, secrets, or personal data, especially because it is triggered internally after turns rather than by explicit user action.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This markdown file includes a migration statement that sets language TEXT DEFAULT 'zh', which imposes a specific locale by default. The documented policy flags language or locale constraints when they are forced without user opt-in or a clear region-specific justification, and no such justification appears in this file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The hook automatically persists conversation-derived content to the knowledge base when the capture heuristic returns true, without any user notification, consent flow, or sensitivity filtering. In an agent context, users may reveal secrets, personal data, or proprietary information during normal interaction, so silent retention materially increases privacy and data exposure risk.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The hook stores the combined user and agent turn as content in persistent storage, which can retain sensitive prompts, model outputs, credentials, internal instructions, or regulated data. Because this is integrated into automated hooks, the skill context makes the issue more dangerous: retention happens during ordinary operation and may be broad, repeated, and invisible to end users.

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 · scripts/hooks.sh (reported line 236)May include surrounding context.

sh
KNOWLEDGE_DB="$2"
                export KNOWLEDGE_DB
                # 确保目录存在
                mkdir -p "$(dirname "$KNOWLEDGE_DB")"
                shift 2
                ;;
            --recall-limit)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The cleanup path performs a DELETE against the knowledge database and only reports the result after the deletion has already occurred. There is no confirmation prompt or explicit pre-action warning to the user before this irreversible data removal.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The comment at L269 says this block checks for 'token inflation' where a summary is longer than the original text. However, the SQL condition requires LENGTH(content) > 5000 and LENGTH(content) < 100 at the same time, which is contradictory and unrelated to comparing summary length against source length. This is an active contradiction between documented intent and actual behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The repair function deletes orphaned archived entries from the database as part of a fix operation, but the script provides no pre-action warning, confirmation, or explicit user-facing notice that data will be removed. Because this is a destructive operation, users may not realize repair can permanently delete records.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The natural-language comment and user-facing help strings throughout the script are written in Chinese, and the injected recall context begins with the fixed Chinese phrase '相关知识:'. There is no indication that the user can choose language or locale, which may conflict with a language-choice policy.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The script performs automated memory-capture classification on conversational turns without any visible consent, purpose limitation, or retention control. In an agent skill, this can silently expand data collection beyond retrieval into surveillance-like behavior, especially when users are unaware their content is being evaluated for storage.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The help text and file header present this skill as a 'Knowledge Base Retriever', which implies retrieval-focused behavior. However, the implemented and documented capture command decides whether conversation content should be remembered, which is a different memory-management capability rather than retrieval.

Content

No source excerpt is available for this finding.