Back to skill

Security audit

Session Recovery

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed local session-recovery helper that writes project summary files, with privacy and archive-data-loss caveats but no evidence of hidden execution or exfiltration.

Install only if you want project-local session memory. Review STATUS.md and memory/ before committing or sharing them, avoid writing secrets into summaries, and harden or avoid weekly_archive.sh until its recursive archive and overwrite behavior is 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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/weekly_archive.sh:18
Finding

Recursive Archive Traversal Can Relocate or Overwrite Historical Records

Content
View full analysis

Vulnerability Details

File Location: scripts/weekly_archive.sh, lines 18-22
Vulnerability Type: Unsafe recursive file archival and basename collision
Risk Level: Medium

Vulnerable Code

bash
find "$MEMORY_DIR" -name "*.md" -mtime +7 -type f | while read file; do
    filename=$(basename "$file")
    echo "   Moving: $filename"
    mv "$file" "$WEEKLY_DIR/"
done

Technical Analysis

MEMORY_DIR is set to ./memory, while the archive directory is created beneath it as ./memory/archive. The recursive find command therefore scans both active daily records and existing archive directories.

Any archived Markdown file older than seven days can be selected again and moved into the current weekly archive. The script also discards each source file's directory structure by moving it under its basename. If files in different directories share the same basename, they are moved to the same destination path. Depending on the destination state and platform behavior, mv can overwrite an existing file without confirmation.

The loop also uses line-delimited read rather than null-delimited paths. Although ordinary date-based logs are unlikely to contain newline characters, crafted filenames containing newlines would be parsed incorrectly.

Attack Path

  1. An attacker or another local process with write access to the project creates or retains Markdown files older than seven days in different memory subdirectories.
  2. At least two files are given the same basename, such as:
    • memory/archive/2026-W01/2026-01-01.md
    • memory/archive/2026-W02/2026-01-01.md
  3. A user or scheduled task runs scripts/weekly_archive.sh.
  4. The recursive find command selects both previously archived files.
  5. The script moves both files into the current weekly directory as 2026-01-01.md.
  6. One file may replace the other, while records are also removed from their original weekly archives.

This issue requires local write access to the project ...[truncated 715 chars]

Remediation
View remediation

Remediation Suggestions

Restrict archival candidates to top-level daily records, explicitly exclude the archive tree, use null-delimited paths, and prevent destination overwrites:

bash
find "$MEMORY_DIR" \
    -maxdepth 1 \
    -type f \
    -name "????-??-??.md" \
    -mtime +7 \
    -print0 |
while IFS= read -r -d '' file; do
    filename=$(basename -- "$file")
    destination="$WEEKLY_DIR/$filename"

    if [ -e "$destination" ]; then
        echo "Refusing to overwrite existing archive file: $destination" >&2
        continue
    fi

    mv -- "$file" "$destination"
done

Additional hardening should include:

  1. Validate that each source resolves beneath the top-level memory directory and outside memory/archive.
  2. Use mv -n -- as a secondary overwrite safeguard where supported.
  3. Generate collision-resistant archive names or preserve relevant directory structure.
  4. Write an archival manifest containing source path, destination path, timestamp, and checksum.
  5. Test recursive archive scenarios, duplicate basenames, whitespace, and unusual filenames.
  6. Back up or copy records before deletion if archival data is considered critical.
  7. If invoked by cron, log failures and collision warnings to a monitored location.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (17)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README is written entirely in Chinese, including all setup and operating instructions, with no indication that other languages are supported or that the user can choose a preferred language. This creates a locale/language constraint in the skill documentation without explicit opt-in or justification for a region-specific audience.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README states that complete original conversation history is not saved and suggests only manual export if full dialogue is needed. However, the documented Git hook later instructs users to git add STATUS.md memory/, which would persist the detailed session records in memory/ to version control, undermining the stated 'not saved' behavior.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill describes multiple scripts that read, create, update, archive, and export files, but the skill metadata does not declare any tool scope such as permissions or allowed-tools. This creates an unsafe mismatch between documented capabilities and enforceable limits, increasing the chance that an agent executes file-write operations without explicit user awareness or least-privilege boundaries.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The weekly archive workflow explicitly says it will clean the memory/ directory after archiving, but it does not clearly warn that cleanup may delete or move user data. In an agent setting, vague cleanup language can cause irreversible data loss if users or the model assume the action is nondestructive.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This section instructs persistent recording and preservation of session content across conversations, including summaries and optional full exports. Persisting conversational data across sessions can violate user expectations, retain sensitive information longer than necessary, and increase breach impact if those files are later accessed, synced, or committed.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill instructs exporting full conversation logs to disk but does not provide any privacy or secret-handling warning. Full transcripts may contain credentials, personal data, internal prompts, or sensitive business context, so encouraging export without safeguards increases the risk of unintended persistence and disclosure.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill says it will automatically record 'key information' from the conversation into persistent memory files during normal use. Even if framed as helpful summarization, automatic extraction and storage of conversation-derived data can capture confidential project details, identifiers, constraints, or user instructions without a clear consent boundary or filtering policy.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document recommends automatic full conversation logging and provides example code that writes user messages, AI responses, and tool data to local JSONL files, but it does not warn about privacy, secrets retention, access control, or log sanitization. In a session-recovery skill, this is particularly risky because conversations may contain credentials, personal data, internal paths, or tool outputs that become persistently stored and easier to exfiltrate or misuse.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The document recommends running an automation script that summarizes sessions, updates STATUS.md, and archives data into memory/ without clearly warning that it will modify local files and persist conversation content. In a session-recovery skill, this creates a real risk of unintended file changes and silent retention of potentially sensitive project or conversation data if users follow the guidance without understanding the side effects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The fully automatic workflow says history will be summarized and replaced, but it does not warn that this may irreversibly discard details, omit important context, or degrade future decision quality. In this skill context, automatic context replacement is core functionality, so the absence of safeguards makes accidental data loss and integrity issues more likely rather than reducing the risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code file contains user-facing natural-language content and documentation exclusively in Chinese, including the module description and runtime prompts. Under the policy rule, forcing a specific language without user opt-in can be a locale policy violation when no choice or justification is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This shell script's natural-language comments and all visible status output are in Chinese, which imposes a specific language on users without any opt-in or documented justification. The policy requires flagging language or locale constraints when the skill does not offer a language choice or explain why the locale is necessary.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The '原文不保存' section says complete dialogue history is not preserved, yet the core feature description presents memory/YYYY-MM-DD.md as a deep-queryable '完整工作记录'. While not necessarily raw transcripts, this wording conflicts with the earlier statement and can mislead users about what level of historical detail is actually retained.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file contains user-facing natural-language guidance exclusively in Chinese, and nowhere indicates that the language choice is optional or limited to a justified region-specific context. Under the policy rule for language or locale constraints, forcing a single language without user 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

该文件整体内容仅使用中文呈现,且没有说明这是面向特定中文用户群体的区域化文档,也没有向用户提供语言/locale 选择。按照语言/locale 政策检查标准,这属于可能强制特定语言而未获得用户选择的自然语言策略问题。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This shell script's user-facing comments and terminal output are entirely in Chinese, which imposes a specific language/locale on users without any visible opt-in or alternative. The provided policy requires flagging language or locale constraints unless the skill offers choice or clearly documents a justified regional scope.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The comments and all user-facing output strings are written in Chinese, which imposes a specific language on users of the skill. The file does not offer a language choice or explain that the script is intended only for a Chinese-speaking or region-specific environment.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.