Back to skill

Security audit

Unified Self Improving

Security checks for vulnerabilities and agentic risk

Overview

This skill has a coherent memory-management purpose, but its file path handling can escape intended storage boundaries and delete or overwrite local data.

Review before installing. Use only trusted JSONL imports, avoid storing secrets or sensitive prompts, and do not run namespace/delete/import/move commands with untrusted names or IDs. The publisher should add strict ID and namespace validation, path containment checks, safer JSON construction, schema/provenance controls for imports, and clearer confirmation for destructive or automatic persistence actions.

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/lib/namespace.sh:65
Finding

Path Traversal Enables Recursive Deletion Outside the Namespace Directory

Content
View full analysis
&2 return 1 fi local ns_dir="$NAMESPACE_DIR/$name" if [[ ! -d "$ns_dir" ]]; then echo "Namespace '$name' does not exist" return 1 fi read -p "Delete namespace '$name' and all its data? (y/N) " confirm if [[ "$confirm" != "y" ]]; then echo "Cancelled" return 0 fi rm -rf "$ns_dir" echo "Deleted namespace: $name" } ``` The corresponding command handler passes the user-provided value directly to this function: ```bash delete) shift namespace_delete "$@" ;; ``` ### Technical Analysis The namespace name is concatenated directly with `NAMESPACE_DIR` without validation or canonicalization. Names containing path separators and `..` components can resolve outside the intended namespace directory. The only protected value is the literal default namespace name. There is no check that the resolved deletion target remains a direct child of `NAMESPACE_DIR`. The existence check does not provide containment protection; it merely confirms that the traversed target is a directory. The confirmation prompt displays the untrusted namespace string rather than the canonical deletion target. It therefore does not adequately inform the user which directory will actually be removed. ### Attack Path 1. An attacker persuades a user or automation process to execute a namespace deletion using a traversal value, such as: ```bash unified-self-improving namespace delete ../hot ``` 2. The value is passed unchanged to `namespace_delete`. 3. The constructed path becomes: ```text $MEMORY_ROOT/namespace ...[truncated 1000 chars]
Remediation
View remediation
&2 return 1 } ``` 5. Refuse to delete the root itself, symbolic links, or unexpected filesystem objects. 6. Display the canonical target path in the confirmation prompt. 7. Apply the same namespace validator consistently in create, delete, use, import, query, recall, and move operations. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/commands/import.sh:78
Finding

Unvalidated Learning IDs and Namespaces Permit Out-of-Scope File Access

Content
View full analysis
/dev/null 2>&1; then local id=$(echo "$line" | jq -r '.id') # 如果没有 ID,生成一个 if [[ "$id" == "null" || -z "$id" ]]; then id=$(generate_id) line=$(echo "$line" | jq --arg id "$id" '.id = $id') fi # 保存到指定层级 local path=$(get_learn_path "$id" "$level" "$namespace") mkdir -p "$(dirname "$path")" echo "$line" > "$path" # 添加到索引 index_add "$id" "$level" "$namespace" ((count++)) else ((errors++)) echo "Warning: Invali ...[truncated 2868 chars]
Remediation
View remediation
&2 return 1 } ``` 2. Apply an equivalent allowlist to namespace names. 3. Reject `.`, `..`, slashes, backslashes, nulls, and control characters. 4. Move all path creation into a single guarded function that: - Canonicalizes the expected tier root. - Canonicalizes the destination parent. - Verifies that the destination remains beneath the expected root. - Rejects symbolic-link traversal. 5. Validate imported records against a strict schema, not merely JSON syntax. 6. Avoid overwriting existing records by default. Use exclusive creation or require an explicit overwrite option. 7. Use restrictive permissions and atomic writes: ```bash umask 077 tmp="$(mktemp "$target_dir/.import.XXXXXX")" || exit 1 printf '%s\n' "$line" > "$tmp" mv -- "$tmp" "$target" ``` 8. Use `--` before path operands passed to utilities such as `cat`, `mv`, and `mkdir` where supported. 9. Add tests covering traversal through IDs, namespaces, symbolic links, and nested paths for every command. ]]>

T02 · Agent Memory Poisoning

Warning
Location
scripts/commands/import.sh:72
Finding

Untrusted Imports Can Poison Persistent Agent Memory

Content
View full analysis
/dev/null 2>&1; then local id=$(echo "$line" | jq -r '.id') # 如果没有 ID,生成一个 if [[ "$id" == "null" || -z "$id" ]]; then id=$(generate_id) line=$(echo "$line" | jq --arg id "$id" '.id = $id') fi # 保存到指定层级 local path=$(get_learn_path "$id" "$level" "$namespace") mkdir -p "$(dirname "$path")" echo "$line" > "$path" # 添加到索引 index_add "$id" "$level" "$namespace" ((count++)) else ((errors++)) echo "Warning: Invalid JSON skipped: ${line:0:50}..." >&2 fi done < "$file" ``` Querying by ID returns the stored object directly: ```bash if [[ -n "$id" ]]; then local data=$(find_learn "$id" "$namespace" | tail -1) if [[ -n "$data" ]]; then echo "$data" | jq '.' return 0 else echo "Not found: $id" >&2 return 1 fi fi ``` Bulk queries likewise emit stored content without provenance or trust labeling: ```bash for file in "$dir"/*.jsonl; do [[ -f "$file" ]] || continue local content=$(cat "$file") local match=true # 应用过滤条件 if [[ -n "$pattern" ]]; then if ! echo "$content" | jq -r '.content' | grep -qi "$pattern"; then match=false fi fi if [[ -n "$priority" ]]; then if ! echo "$content" | jq -r '.priority' | grep -qi "$priority"; then match=false ...[truncated 2729 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/commands/log.sh:85
Finding

Unsafe JSON Construction Allows Record Corruption and Field Injection

Content
View full analysis
"$path" ``` ### Technical Analysis The `content` and `namespace` values are controlled through CLI arguments and are interpolated directly into a JSON string. JSON-sensitive characters—including quotation marks, backslashes, carriage returns, and newlines—are not escaped. A value containing a quotation mark can terminate the intended JSON string. Depending on the supplied text, this can: - Produce invalid JSON - Add attacker-selected properties - Introduce duplicate properties interpreted inconsistently by downstream tools - Break JSONL's one-record-per-line structure The malformed or manipulated record is written before the later `jq` display operation attempts to parse it. Therefore, a parsing failure at the end does not prevent the corrupted data from being persisted. ### Attack Path 1. Supply content containing JSON syntax: ```bash unified-self-improving log \ -t correction \ -c 'text", "status":"attacker-controlled", "extra":"value' ``` 2. The value is inserted into the heredoc without JSON escaping. 3. The resulting data may contain injected fields or invalid syntax. 4. The record is written to HOT storage. 5. Later query, indexing, pattern-detection, or access-count operations process the corrupted record and may fail or interpret conflicting fields. ### Impact Assessment An attacker able to control logging arguments can corrupt persistent learning records ...[truncated 452 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (24)

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

The declared description presents the skill as a broad unified self-improving system with several specific capabilities. However, the supplied code only implements an index-management command dispatcher that calls index_rebuild, index_search, and index_init from sourced libraries. Its primary purpose in this chunk is command routing for index operations, not the described self-evolution functionality. While this could be one supporting subcomponent of a larger system, taken as supplied, the behavior is materially narrower and different from the declared purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description presents a broad unified self-improving system with multiple features: structured logs, three-layer storage, automatic upgrading, pattern detection, namespace isolation, and JSONL support. The supplied code chunk implements only a specific CLI subcommand for moving an existing learning item between levels. Namespace support and the notion of three levels are partially consistent with the description, but the primary behavior in this chunk is much narrower and does not demonstrate most of the declared capabilities. This is a material description-behavior mismatch for the provided code chunk.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
72% confidence
Finding

The skill explicitly promotes persistent storage of session history, namespaces, learnings, and archived memory under a user directory, including automatic session start/end workflows and retention tiers. In an agent setting, persistent memory can capture sensitive prompts, corrections, operational context, or secrets and make them available across sessions without clear consent, minimization, or retention safeguards.

Content

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

命名空间

bash
# 创建命名空间
unified-self-improving namespace create myproject

# 列出命名空间
unified-self-improving namespace list

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file documents commands that can alter persisted data, including namespace deletion, importing into storage, index rebuilds, and session end performing automatic upgrade and cleanup. The README explains how to run them but provides no warning about possible data loss, modification of stored memory, or cleanup side effects.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list includes broad conditions such as session-end, error, correction, pattern-detected, manual-trigger, and heartbeat, which could cause the skill to activate during many ordinary interactions. In a persistence-focused skill that writes to memory and performs cleanup, over-broad activation increases the chance of unintended data collection, automatic state changes, and surprise execution without clear user intent.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
79% confidence
Finding

The skill is explicitly designed for session persistence, with namespace creation, imports, recall, indexing, and multi-tier retention under a shared workspace path. In this context, persistent memory is intentional, but it still creates security and privacy risk if sensitive conversation data is retained across sessions or projects without strict boundaries, minimization, and user control.

Content

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

bash
# 创建命名空间
unified-self-improving namespace create myproject

# 列出命名空间
unified-self-improving namespace list

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill documents that session-end automation will merge logs, update indexes, and clean up retained HOT-session data, but it does not present a prominent user warning or consent boundary for those writes and deletions. This is dangerous because users may not realize that ordinary session closure causes persistent storage changes and data lifecycle operations, potentially affecting privacy, auditability, and recovery.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This shell script writes imported JSON records to storage paths using echo "$line" > "$path", which can create or overwrite files as part of the import operation. Although the command name suggests importing, the help text does not explicitly warn users that local files will be created or overwritten, and there is no runtime confirmation or user-facing notice before the write occurs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
80% confidence
Finding

The rebuild subcommand invokes index_rebuild directly, and this wrapper provides no confirmation prompt, warning message, or explanatory comment about what rebuilding does. Because a full index rebuild may overwrite or regenerate stored index data, users are not clearly informed of the operation's impact from 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 command persists user-supplied content directly to JSONL and Markdown files without any consent prompt, sensitivity warning, redaction, or retention control. In a self-improving/learning skill, users may naturally log prompts, errors, tokens, secrets, or personal data, so this creates a realistic confidentiality risk if stored data is later exposed, synced, or read by other components.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The comment uses Chinese (命名空间管理命令) while the rest of the user-facing help is in English, and the file provides no indication that language selection is configurable or intentionally region-specific. This can violate language/locale policy when a skill implicitly fixes language without user opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The function moves a learning item with mv "$src_path" "$dst_path", which modifies filesystem state and can overwrite or relocate user data, but there is no confirmation prompt or warning comment describing this destructive action. The later status message appears only after the operation succeeds, so it does not disclose the risk beforehand.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

These lines rewrite the index by generating a temp file and replacing INDEX_FILE with mv, which is a file-write operation affecting persisted state. There is no confirmation, user-visible warning, or explanatory comment indicating that the index will be modified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The code pipes transformed JSON directly into > "$path", replacing the existing file contents. This is a state-changing file write with no prior warning, confirmation, or explanatory disclosure to the user about modifying stored learning-item data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The natural-language instructional content is presented entirely in Chinese, which effectively forces a specific language for users of the skill. There is no indication that the skill is region-specific or that users can opt into another language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This shell script includes user-facing natural-language text in Chinese, and the file provides no indication that users can choose an alternate language or locale. Under the language/locale policy, forcing a specific language without opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The file includes natural-language content in Chinese (批量导入学习项) and additional Chinese comments, but there is no indication that language choice is configurable or that the skill is intentionally limited to Chinese-speaking users. Under the stated policy, forcing a specific language without user opt-in can be a locale/language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
75% confidence
Finding

The comment 索引管理命令 indicates a fixed non-English language choice in natural-language content within the file, with no indication that users can opt into another language or locale. This may violate a language or locale policy where skills should not force a specific language without user choice or clear justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The script includes user-facing comments, examples, and messages in Chinese, with no indication that another language is supported or that the language choice is intentional and documented. This can violate a language/locale policy when a skill imposes a specific language without offering user choice or clear justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The script presents user-facing natural language in both Chinese and English, including the descriptive comment and help output, without documenting a language/locale choice or opt-in. This can violate a language policy when skills are expected to use a consistent user-facing locale unless explicitly justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This shell skill includes a namespace deletion operation, which is a destructive action, but the user-facing help only lists the command name and provides no caution that it removes data or may be irreversible. Under the code-file criteria, destructive operations should have some visible disclosure unless the risk is otherwise explained.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This shell script includes natural-language content in Chinese, beginning with the top-level description, without any indication that the skill is intended only for Chinese-speaking users or that another language option is available. Under the policy, forcing a specific language without user opt-in is a locale/language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

This shell file contains natural-language comments in Chinese (for example at L02, L08, L15, L21, L26, and L31), which imposes a specific language for maintainers or users reading the skill without any opt-in or documented locale requirement. The stated policy flags language or locale constraints when they are forced rather than optional or justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The file contains natural-language comments in Chinese, such as the module description on L002, with no indication that the skill supports other languages or that this locale choice is required. Per the policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.