Back to skill

Security audit

Agent Memory Kit

Security checks for vulnerabilities and agentic risk

Overview

This is a local agent memory and search kit whose persistence and file access are disclosed and fit its purpose, though users should avoid storing sensitive information in memory files.

Install this only in workspaces where keeping long-term local agent memory is acceptable. Do not write API keys, tokens, passwords, private personal data, auth headers, or confidential raw logs into the memory files, and review any exported search results before sharing them. Verify paths before running uninstall commands, especially the rm -rf line.

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

T09 · Insecure Skill Coding Practices

Warning
Location
lib/search.sh:235
Finding

Untrusted Search Queries Are Interpreted as grep Options and Regular Expressions

Content
View full analysis
/dev/null) ``` The same unsafe query handling is used by count mode: ```bash local count=$(grep -c -i "$query" "$file" 2>/dev/null | head -1) ``` ```bash done < <(grep -i "$query" "$file" 2>/dev/null) ``` ### Technical Analysis The user-controlled `query` is passed directly to `grep` without an explicit `--` option terminator. Quoting prevents shell word splitting and command substitution, but it does not prevent `grep` from interpreting a value beginning with `-` as an option. The query is also interpreted as a basic regular expression even though the CLI documentation describes it as a keyword or phrase search and elsewhere characterizes matching as exact. Consequently: - Queries such as `--help`, `--version`, `-v`, or other implementation-supported options can alter `grep` behavior or prevent the intended file search. - Malformed regular expressions can cause search failures. - Computationally expensive expressions can consume excessive CPU when applied across many or large memory files. - Different `grep` implementations may expose different option-injection behavior, making results platform-dependent. - Search and count modes are both affected. This does not directly create shell command execution because the variable is quoted. The principal risks are argument injection, search-result manipulation, and resource exhaustion. ### Attack Path 1. An attacker supplies or induces an agent to use a search query beginning with a hyphen, such as `--help` or `-v`. 2. `search_memory` or `count_occurrences` passes the query directly to `grep`. 3. `grep` interprets the query as an option rather than the intended pattern. 4. Search ...[truncated 689 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
lib/search.sh:320
Finding

Memory Content Can Inject Terminal Control Sequences into Search Output

Content
View full analysis
/dev/null | tail -1 | sed 's/^#* //') if [[ -z "$heading" ]]; then heading=$(basename "$file" .md) fi echo -e "\n${COLOR_HEADING}${count}. ${heading}${COLOR_RESET}" if [[ -n "$date_match" ]]; then echo -e " ${COLOR_DATE}📅 $date_match${COLOR_RESET} ${COLOR_FILE}| $file:$line_num${COLOR_RESET}" else echo -e " ${COLOR_FILE}📄 $file:$line_num${COLOR_RESET}" fi if [[ -n "$tags" ]]; then echo -e " ${COLOR_TAG}Tags: $tags${COLOR_RESET}" fi # Show preview (first 150 chars) local preview=$(echo "$line_content" | head -c 150 | sed 's/^[[:space:]]*//') echo -e " ${COLOR_PREVIEW}$preview...${COLOR_RESET}" ``` ### Technical Analysis Headings, tags, previews, and file paths originate from memory files or filesystem names and are rendered directly to a terminal. The use of `echo -e` additionally interprets backslash escape sequences embedded in those values. If memory content contains ANSI, OSC, or other terminal control sequences, displaying search results can cause the terminal emulator to execute terminal-level actions rather than render the bytes as plain text. Depending on terminal capabilities and configuration, possible effects include: - Concealing or rewriting visible output. - Forging prompts or success messages. - Changing the terminal title. - Creating misleading clickable links. - Manipulating clipboard contents through OSC 52 in terminals that permit it. - Disrupting subsequent terminal interaction. Memory files may contain text copied from users, external documents, logs, tool output, or other agents. Therefore, treating their contents as trusted terminal markup creates a practical injection boundary. ### Attack Path 1. An attacker causes a memory entry or p ...[truncated 995 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
lib/search.sh:280
Finding

JSON Output Is Constructed Without Escaping Memory-Derived Fields

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (13)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · INSTALL-SEARCH.md (reported line 389)May include surrounding context.

If you want to remove search (keep Memory Kit):

bash
rm -f skills/agent-memory-kit/bin/memory-search
rm -rf skills/agent-memory-kit/lib/
rm -f skills/agent-memory-kit/SEARCH.md
rm -f skills/agent-memory-kit/QUICKSTART-SEARCH.md

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

The use of rm -rf on a directory is inherently more dangerous because recursive force deletion can remove a larger tree if the path is mistyped, expanded unexpectedly, or executed from an unintended context. In a user-facing guide, providing a force-recursive deletion command without guardrails increases the chance of accidental local data loss.

Content

Scanner excerpt · INSTALL-SEARCH.md (reported line 390)May include surrounding context.

bash
rm -f skills/agent-memory-kit/bin/memory-search
rm -rf skills/agent-memory-kit/lib/
rm -f skills/agent-memory-kit/SEARCH.md
rm -f skills/agent-memory-kit/QUICKSTART-SEARCH.md
rm -f skills/agent-memory-kit/EXAMPLES.md

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · INSTALL-SEARCH.md (reported line 391)May include surrounding context.

bash
rm -f skills/agent-memory-kit/bin/memory-search
rm -rf skills/agent-memory-kit/lib/
rm -f skills/agent-memory-kit/SEARCH.md
rm -f skills/agent-memory-kit/QUICKSTART-SEARCH.md
rm -f skills/agent-memory-kit/EXAMPLES.md

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · INSTALL-SEARCH.md (reported line 392)May include surrounding context.

rm -f skills/agent-memory-kit/bin/memory-search rm -rf skills/agent-memory-kit/lib/ rm -f skills/agent-memory-kit/SEARCH.md rm -f skills/agent-memory-kit/QUICKSTART-SEARCH.md rm -f skills/agent-memory-kit/EXAMPLES.md

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · INSTALL-SEARCH.md (reported line 393)May include surrounding context.

rm -rf skills/agent-memory-kit/lib/ rm -f skills/agent-memory-kit/SEARCH.md rm -f skills/agent-memory-kit/QUICKSTART-SEARCH.md rm -f skills/agent-memory-kit/EXAMPLES.md

text

**Note:** Keeps Memory Kit v2.0 core features intact.

Context Leakage

High
Category
Data Exfiltration
Confidence
75% confidence
Finding

Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.

Content

Scanner excerpt · SEARCH.md (reported line 455)May include surrounding context.

md
- Parse frontmatter (YAML between `---` markers)
   - Check frontmatter matches filters (tags, project, agent)
   - Search content with grep (case-insensitive)
   - Extract context window (N lines before/after)
   - Parse inline tags from matching lines
   - Calculate relevance score
4. **Sort results** by score (descending)

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · templates/ARCHITECTURE.md (reported line 110)May include surrounding context.

md
## Compaction Survival

Context compactions wipe conversation history. Survive them by:

**Pre-compaction flush:**
- Capture current state in `context-snapshot.md`

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The guide provides destructive uninstallation commands that delete files but does not clearly and explicitly warn the user that these commands will remove components from the local skill directory. In an installation document, readers may copy-paste commands quickly, so omission of a prominent deletion warning increases the risk of unintended data loss or confusion about what is being removed.

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 · SEARCH.md (reported line 582)May include surrounding context.

md
### Tagging

**Do:**
- ✅ Tag as you write (part of daily flow)
- ✅ Use 2-4 tags per entry
- ✅ Prefer specific tags (`#kits`) over generic (`#work`)
- ✅ Tag decisions, learnings, blockers (high value)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The guide explicitly instructs recording detailed events, interactions, and especially 'HOW' steps into persistent memory files, but it provides no guardrails against storing secrets, personal data, tokens, credentials, or other sensitive operational details. In an agent context, this creates a durable data-retention channel that can unintentionally capture and later expose confidential user or system information.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The 'Golden Rule' encourages preserving exact technical details such as concrete endpoints, with an example including a localhost API path. Without cautionary guidance, this normalizes storing infrastructure details, internal URLs, and integration specifics that may reveal private topology, services, or privileged interfaces to later readers or downstream agents.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file includes a command that redirects memory-search output into recent-decisions.txt, which creates a new file containing decision-related memory content. The surrounding description says only 'Export for analysis' and does not warn that potentially sensitive memory data will be written to disk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The template explicitly instructs the agent to create, update, append to, and sync persistent project files such as memory logs, procedures, and queue state, but it does not warn that these are state-changing operations. In an agent setting, silent persistent writes can cause unintended data modification, stale or sensitive context retention, or pollution of project memory if followed automatically without user awareness.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.