Back to skill

Security audit

Memory Strategy

Security checks for vulnerabilities and agentic risk

Overview

This memory skill is not overtly malicious, but it needs Review because it can silently persist conversation content, store API keys in plaintext memory files, and send text to an external scoring API without clear consent controls.

Install only after reviewing whether you want automatic conversation memory at all. Do not store API keys, tokens, passwords, private keys, or sensitive personal data in this memory system. Use explicit approval before long-term writes, disable silent auto-write unless you trust the workflow, and avoid Kimi/API scoring for confidential text unless you have a clear privacy agreement and redaction process.

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

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:95
Finding
Untrusted User Content Can Poison Persistent Agent Memory<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:95-105`, `SKILL.md:122-130`, `SKILL.md:144-155`, `SKILL.md:170-176`, `SKILL.md:226`, `SKILL.md:313-317` **Vulnerability Type**: Persistent memory poisoning through untrusted conversation content **Risk Level**: High ### Vulnerable Code Snippet ```markdown #### 触发词检测 用户说以下词语时自动提升评分: | 触发词 | 评分 | 写入位置 | |--------|------|----------| | "永久保存" | 5分 | MEMORY.md | | "这是一个重点" | 5分 | MEMORY.md | | "记下来" | 4分 | 长期记忆 | | "记住这个" | 4分 | 长期记忆 | | "别忘了" | 4分 | 长期记忆 | ``` The subsequent retrieval strategy treats persisted files as authoritative memory: ```text Level 1: 核心记忆 (P0) ├── MEMORY.md - 关键配置段落 └── contacts.md - 相关API密钥 Level 2: 专题记忆 (P1/P2) ├── 检测用户查询关键词 ├── 匹配INDEX.md主题分类 └── 加载对应的专题文件 ``` The long-term directory is also described as always effective: ```text ├── long-term/ # 长期记忆(始终生效) ``` ### Technical Analysis The Skill allows a user to force arbitrary conversation content into persistent memory by including a trigger phrase such as “remember this” or “save permanently.” Trigger detection increases the importance score and directs the content into long-term files without defining any validation, provenance tracking, trust boundary, or separation between historical data and executable agent instructions. The scoring system evaluates importance rather than safety. It does not reject content that attempts to override policies, redefine tool behavior, request disclosure of secrets, or establish persistent behavioral rules. Since the retrieval workflow loads these files during later sessions and describes long-term memory as always effective, malicious instructions can cross session boundaries. This is a direct persistent prompt-injection condition: attacker-controlled text can be stored in a context source that the agent may later interpret as trusted instructions. ### Attack Path 1. An attacker supplies a message containing a recognized persistence trigger, such as “remember this ...[truncated 1360 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Treat all remembered content as quoted, non-executable data rather than agent instructions. 2. Reject or quarantine entries containing policy overrides, role reassignment, tool directives, secret-disclosure requests, or instructions aimed at future sessions. 3. Require explicit user confirmation before writing any entry to long-term memory. 4. Record provenance metadata for every entry, including user identity, source session, timestamp, trust level, and approval status. 5. Place retrieved memories inside a clearly delimited data structure and instruct the agent never to execute directives found inside that structure. 6. Remove the “always effective” semantics from long-term memory. 7. Apply authorization controls so one user cannot create memories that affect another user. 8. Provide review, modification, deletion, expiration, and rollback mechanisms. 9. Revalidate stored entries before retrieval rather than relying only on validation at write time. 10. Add tests covering persistent prompt injection, indirect prompt injection, and malicious instructions embedded in quoted or summarized content. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:122
Finding
API Keys Are Designated for Plaintext Persistent Markdown Storage<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:122-130`, `SKILL.md:218-233` **Vulnerability Type**: Plaintext storage and context loading of sensitive credentials **Risk Level**: High ### Vulnerable Code Snippet ```text Level 1: 核心记忆 (P0) ├── MEMORY.md - 关键配置段落 └── contacts.md - 相关API密钥 ``` The documented storage structure places that file in persistent long-term memory: ```text .memory/ ├── INDEX.md # 记忆索引(快速导航) ├── README.md # 使用说明 ├── config.yaml # 配置文件 │ ├── long-term/ # 长期记忆(始终生效) │ ├── MEMORY.md # 核心知识库(P0) │ ├── contacts.md # 联系人信息(P0) │ ├── projects.md # 项目信息(P1) │ ├── decisions.md # 重要决策(P1) │ ├── patterns.md # 模式实践(P2) │ ├── preferences.md # 用户偏好(P2) │ └── feedback.md # 反馈记录(P2) ``` ### Technical Analysis The retrieval documentation explicitly identifies `contacts.md` as containing related API keys. The file is a Markdown document inside the persistent `.memory/long-term/` directory. The Skill does not require encryption at rest, restrictive file permissions, secret-manager integration, credential redaction, repository exclusions, access auditing, or separation between contact information and authentication secrets. It also classifies the file as a high-priority memory source, increasing the likelihood that its contents will be loaded into the agent context. Plaintext credential storage expands exposure beyond the intended API client. Any process, user, backup system, repository operation, or agent tool with access to the project directory may be able to read the key. ### Attack Path 1. A user or automated organizer records an API key in `contacts.md` according to the documented memory layout. 2. The key remains in plaintext under `.memory/long-term/`. 3. An attacker gains read access through a shared workspace, overly permissive filesystem permissions, an accidental repository commit, a backup, or an agent file-reading action ...[truncated 786 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Prohibit storage of API keys, passwords, tokens, private keys, and session cookies in Markdown memory files. 2. Store secrets in an operating-system keychain, hardware-backed keystore, or dedicated secret-management service. 3. Store only an opaque secret identifier in memory, never the secret value. 4. Add secret detection and redaction before all memory writes, summaries, index updates, and external API submissions. 5. Restrict `.memory/` permissions to the owning account and document secure permission requirements. 6. Add `.memory/` and generated conversation logs to version-control exclusion rules. 7. Prevent sensitive memory categories from being loaded into general model context. 8. Require explicit authorization and purpose validation before resolving a secret reference. 9. Audit secret access and rotate any credential that was previously stored in plaintext. 10. Separate contact metadata from authentication material in both the schema and retrieval process. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:76
Finding
Potentially Sensitive Conversation Text Is Sent to an External Scoring API Without Privacy Controls<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:76-82`, `SKILL.md:243-262` **Vulnerability Type**: Uncontrolled external processing of conversation and memory content **Risk Level**: Medium ### Vulnerable Code Snippet ```markdown #### 自动评分(支持 Kimi API) **方式1:Kimi API 智能评分(推荐)** ```bash python scripts/evaluate_importance.py --auto --text "这里是需要评分的内容" ``` Kimi API 会根据内容语义自动判断4个维度的分值。 ``` The documented setup recommends authenticated automatic processing: ```bash # 需要先配置 API Key export KIMI_API_KEY="your-api-key" python scripts/evaluate_importance.py \ --auto \ --text "这是一个需要评估重要性的工作内容描述..." ``` ### Technical Analysis The recommended automatic scoring mode passes supplied text to the Kimi API for semantic evaluation. In the context of this Skill, that text can originate from conversations being considered for persistent storage and may contain personal data, credentials, proprietary information, or other confidential material. The Skill does not define: - Per-submission user consent. - Sensitive-data detection or redaction. - Data minimization requirements. - An endpoint allowlist. - Transport and certificate requirements. - Vendor retention and training policies. - Restrictions on sending credentials or confidential records. - A local-only mode as the secure default. The referenced `scripts/evaluate_importance.py` file is absent from the audited project. Therefore, the precise endpoint, payload, authentication mechanism, transport behavior, and server-side handling cannot be verified. The finding is based on the documented requirement to use an external API, not on evidence of a covert or malicious exfiltration implementation. ### Attack Path 1. A conversation contains sensitive information that the memory workflow considers for storage. 2. Automatic scoring is enabled as recommended by the documentation. 3. The conversation text is provided to `evaluate_importance.py` through the `--text` argument. 4. The scoring implementation s ...[truncated 964 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Make local or manual scoring the default and require explicit opt-in for every remote submission. 2. Display the exact content to be transmitted and obtain informed user approval before sending it. 3. Detect and redact credentials, personal data, private keys, financial data, and confidential identifiers. 4. Send only the minimum information required for scoring, preferably a locally generated sanitized summary. 5. Document the destination endpoint, request fields, transport protections, provider, retention period, deletion process, and model-training policy. 6. Enforce HTTPS with certificate validation and a strict endpoint allowlist. 7. Provide configuration that completely disables external processing. 8. Avoid placing sensitive text directly in command-line arguments because process listings and shell history may expose it; use protected standard input or a permission-restricted temporary channel. 9. Add audit logging that records when external processing occurred without recording the sensitive payload itself. 10. Include the actual implementation in the package so its network and credential behavior can be independently reviewed. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (9)

Vague Triggers

High
Confidence
96% confidence
Finding
The activation conditions are broad natural-language phrases like '记下来' and '回忆一下', plus operational conditions such as end-of-session archiving, which can cause the skill to run when the user did not intend durable storage. In a memory-management skill, unintended invocation directly increases the chance of persisting sensitive conversation content without meaningful user consent.

Missing User Warnings

High
Confidence
95% confidence
Finding
The overview presents automatic memory, scoring, decay, and silent archival as core features but does not provide a clear warning that user conversation content may be stored and indexed automatically. Lack of transparent disclosure undermines informed consent and makes accidental retention of personal or confidential data more likely.

Missing User Warnings

High
Confidence
98% confidence
Finding
The Kimi API scoring flow sends arbitrary text to an external service but does not warn users that their content may leave the local environment. If users ask the agent to remember sensitive information, that data could be disclosed to a third party during automatic scoring without their awareness.

Ssd 3

High
Confidence
99% confidence
Finding
The file structure and retrieval design explicitly include contact information and 'related API keys' in long-term memory, instructing the agent to persist and retrieve sensitive data. In the context of a memory skill, this is especially dangerous because the entire purpose is durable retention and later recall, magnifying the risk of secret leakage, unauthorized access, and secondary disclosure through summaries or searches.

Missing User Warnings

High
Confidence
96% confidence
Finding
The Silent Agent flow performs content extraction, scoring, file writes, and index updates automatically, yet the documentation does not foreground the privacy and persistence implications. Silent or background writes are especially risky because they can archive data users never intended to retain and make later disclosure through retrieval more likely.

Vague Triggers

Medium
Confidence
89% confidence
Finding
Automatically invoking archival at session end is insufficiently specific because many sessions may contain transient or sensitive content that was never intended for persistence. Without explicit confirmation or content filtering, this behavior can silently store private data and create a larger long-term exposure surface.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
Referencing API keys as memory content without an explicit prohibition signals that credential storage is acceptable in this system. That omission is dangerous because users or downstream implementers may persist secrets into searchable markdown files that are then indexed and retrievable by the agent.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
The skill explicitly treats 'contacts.md - 相关API密钥' as retrievable memory content, which normalizes storing secrets inside conversational memory files. This is dangerous because memory stores are likely to be broadly readable by the agent and may later be surfaced, indexed, summarized, or exfiltrated during retrieval or archival flows.

Ssd 3

Medium
Confidence
94% confidence
Finding
The automatic archival pipeline encourages broad capture of conversation content into long-term and short-term memory without clearly restricting sensitive information. Because the process is designed to happen silently and at session boundaries, it increases the likelihood that personal data, confidential business content, or credentials are persisted unintentionally.

Static analysis

No suspicious patterns detected.