Back to skill

Security audit

meta-memory-cross-engine

Security checks for vulnerabilities and agentic risk

Overview

This memory skill should be reviewed because it stores cross-session user data and tells the agent to rewrite its own skill instructions.

Install only if you intentionally want a local cross-session memory layer. Before use, remove or disable the SKILL.md self-write rule, require explicit consent before saving preferences or task notes, avoid storing secrets or sensitive user content, and provide a way to inspect and delete learned_patterns.json.

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

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:52
Finding

Persistent Agent Memory and Instruction Poisoning

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 52-71
Vulnerability Type: Persistent storage of user-controlled preferences and failure-derived instructions
Risk Level: High

Vulnerable Excerpt

The following is an English translation of the security-relevant directives:

text
This skill includes the general learning module scripts/learner.py. After each
use, it automatically reviews the operation and accumulates experience to
improve future output quality and execution efficiency without manual
maintenance.

learned_patterns.json records operation counts, capability usage frequency,
error patterns, user preferences, and improvement suggestions.

Error count greater than or equal to three: proactively add preflight or
fallback steps and write the experience back into SKILL.md.

Important user preferences: write them into learned_patterns.json and apply
them directly the next time the skill is invoked.

Related instructions also appear in SKILL.md, lines 31-35, where the skill states that learned information is injected into a cross-session evolution loop.

Technical Analysis

The skill directs the Agent to retain user-controlled preferences, notes, and failure-derived rules across sessions. More critically, it instructs the Agent to write accumulated experience back into SKILL.md, which is itself an instruction source loaded by future Agent sessions.

This design fails to separate untrusted task data from trusted Agent instructions. If attacker-controlled content is accepted as a preference, error note, or improvement rule and later written into the skill document, that content can become a durable instruction. Future invocations may then treat it as authoritative rather than as untrusted historical data.

Although the included learner.py does not itself modify SKILL.md, the skill text explicitly tells the executing Agent to perform that modification. The vulnerability there ...[truncated 1262 chars]

Remediation
View remediation

Remediation Suggestions

  • Remove all runtime instructions that permit automatic modification of SKILL.md.
  • Keep executable instructions immutable and separate from learned telemetry.
  • Store only structured values under a strict schema; never store arbitrary text as a future behavioral rule.
  • Treat every stored note and preference as untrusted data, not as an instruction.
  • Reject or neutralize imperative content, role directives, tool-use requests, and prompt-like text in stored fields.
  • Scope retained state by user, tenant, and task to prevent cross-user contamination.
  • Require explicit, informed user approval before retaining a preference across sessions.
  • Apply expiration policies and provide mechanisms to inspect and delete retained data.
  • Require trusted human review before promoting any observation into an Agent policy.
  • Ensure future prompts delimit retained data and explicitly prohibit following instructions contained within it.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/learner.py:10
Finding

Unsafe Plaintext State Storage and Misleading Command Interface

Content
View full analysis

Vulnerability Details

File Location: scripts/learner.py, lines 10-22
Vulnerability Type: Unvalidated plaintext persistence, non-atomic file writes, and inconsistent command handling
Risk Level: Medium

Vulnerable Code

python
def record(op_ok=True, note=""):
    d = load(); d["total_ops"] += 1
    if not op_ok:
        d["total_fails"] += 1
    if note:
        d.setdefault("patterns", []).append(note)
    json.dump(d, open(MEM, "w", encoding="utf-8"), ensure_ascii=False, indent=2)
    return d
if __name__ == "__main__":
    ok = (sys.argv[1] != "fail") if len(sys.argv) > 1 else True
    rec = (sys.argv[2] if len(sys.argv) > 2 else "")
    print(json.dumps(record(ok, rec), ensure_ascii=False))

Technical Analysis

The script appends arbitrary command-line text to the persistent patterns collection without validation, redaction, length limits, or a defined schema. It then writes the complete state directly to a predictable plaintext file.

The write is not atomic and does not use a context manager, file lock, restrictive permission setup, or temporary-file replacement. Concurrent executions or interruption during serialization can truncate or corrupt the state. Sensitive information accidentally supplied as a note remains available in plaintext to any principal able to read the file under the surrounding filesystem permissions.

The implementation also does not match the interface documented in SKILL.md. The documentation advertises record, prefer, insight, and reflect subcommands with named options. The script only treats the literal first argument fail as a failed operation and stores the second positional argument as a note. For example, a documented invocation beginning with record is treated as successful, while the next argument may be persisted as the note rather than parsed according to the documented interface.

Because load() catches every exception and silen ...[truncated 1381 chars]

Remediation
View remediation

Remediation Suggestions

  • Replace positional argument handling with argparse subcommands that exactly implement the documented interface.
  • Validate every stored field against a strict schema and allowlist expected values.
  • Enforce conservative per-field and total-file size limits.
  • Prohibit storage of secrets, credentials, access tokens, private keys, and unrestricted free-form prompt content.
  • Apply secret detection and redaction before persistence.
  • Open files with context managers and report parsing or permission errors explicitly.
  • Write state atomically by creating a temporary file in the same directory, flushing and synchronizing it, and replacing the destination with os.replace.
  • Use file locking or another concurrency-safe storage mechanism.
  • Create the state file with restrictive permissions appropriate to the platform.
  • Separate counters, preferences, and diagnostic events into typed fields rather than combining arbitrary notes in patterns.
  • Add retention limits, expiration, and secure deletion controls.
  • Add tests covering malformed JSON, concurrent writers, interrupted writes, oversized input, Unicode input, and every documented command.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description presents a broad, advanced autonomous meta-skill with orchestration, reflection, verification, and continual evolution capabilities. The supplied code does not implement those behaviors. It only logs invocation outcomes and notes to a local JSON file, which may support a larger learning loop but is not itself that loop. This is a material description-behavior mismatch: the actual primary purpose is lightweight telemetry/state recording, not an advanced self-improving super-agent capability.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill explicitly directs the system to write learned experience back into SKILL.md, which is autonomous self-modification of the skill's own instructions/documentation. Self-editing skill files can silently change future behavior, weaken guardrails, create persistence for malicious prompt content, and make audits unreliable because the trusted specification is no longer stable.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill documents file-writing behavior via learner state and write-back workflows, but it declares no explicit tool scope or permissions. This creates an authorization ambiguity where a host agent may permit broader file operations than users expect, especially because the skill later instructs persistence to local files and modification of SKILL.md.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill instructs persistent collection of user preferences, usage history, error patterns, and operational metadata beyond the narrowly described cross-engine memory function. Storing this across sessions without clear minimization, consent, or purpose limits increases privacy risk and can expose sensitive behavioral data if the file is accessed by other skills, users, or processes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation says the skill automatically persists user preferences and usage history, but provides no privacy notice, retention policy, deletion path, or sensitivity guidance. This is dangerous because users may unknowingly disclose preferences, failures, or task details that become durable artifacts beyond the immediate session.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Across this section, the skill promotes persistent logging of operation counts, capabilities used, error modes, user preferences, and improvement notes in local files. In the context of a public skill with no stated access controls or retention limits, this broad, plain-language persistence creates a real risk of data leakage, cross-session profiling, and accidental storage of sensitive task content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The example persists '输出语言=中文' for future use, effectively setting a lasting language preference without explaining opt-in or offering a choice framework. While lower severity than self-modification, it still represents cross-session preference persistence that can surprise users and bias later interactions without consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill tells the system to write accumulated experience back into SKILL.md without warning that it may modify its own documentation. Hidden self-modification undermines transparency and trust, and can alter future execution semantics in ways that users and operators did not authorize.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The entire report is written in Chinese, with no indication that language selection is optional or user-configurable. The policy explicitly calls for flagging language or locale constraints when they are imposed without user opt-in or documented justification.

Content

No source excerpt is available for this finding.