T02 · Agent Memory Poisoning
- Location
scripts/learner.py:5- Finding
Unvalidated Persistent Notes Can Poison Future Agent State
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mainly does local text alignment, but it also instructs persistent learning and possible self-modification that conflict with its stated read-only safety boundary.
Install only if you are comfortable with a skill that may keep local cross-session notes and whose documentation encourages future behavior changes. Treat learned_patterns.json as untrusted data, avoid storing sensitive prompts or preferences there, and do not allow automatic edits to SKILL.md without manual review.
scripts/learner.py:5Unvalidated Persistent Notes Can Poison Future Agent State
scripts/align.py:20Attacker-Controlled Regular Expressions Permit Denial of Service
The description portrays a highly capable meta-skill with advanced autonomous capabilities layered on top of a teacher skill: self-verification, self-reflection, super-agent orchestration, and continual self-improvement. The supplied code does not implement those capabilities. Instead, it performs a specific and limited task: given a constitution expressed as patterns, it detects forbidden/required regex matches in text, applies simple replacements or insertions, iterates a few times, and returns an audit trail and verdict. This does align loosely with the phrase 'constitutional self-alignment,' but it does not support the much broader claims of enhanced meta-reasoning, orchestration, or self-evolving behavior. Therefore the declared description materially overstates and misrepresents the actual behavior.
The declared description presents a broad, advanced meta-skill with autonomous alignment, orchestration, reflection, and ongoing self-improvement capabilities. The supplied code only implements a lightweight local logging mechanism that tracks total operations, failures, and optional pattern notes in a JSON file. While this could support a learning or meta-evolution loop, it does not itself perform the described high-level functions. Therefore the code's actual primary purpose is materially narrower and different from the declared purpose.
The file claims a read-only alignment workflow, yet elsewhere instructs the system to persist memory and evolve behavior across uses. This is dangerous because consumers may trust the documented safety boundary and invoke the skill in contexts that assume no state changes, while the skill actually retains data and mutates state over time.
The documented boundary says the skill only outputs revised text and audit traces, but the same document authorizes writing memory files and modifying SKILL.md. This contradiction creates a strong risk of hidden side effects, unauthorized persistence, and integrity issues for the skill itself because self-modification can silently change future behavior.
The skill documents behaviors that write persistent state (learned_patterns.json) and even suggests writing back to SKILL.md, but it declares no explicit tool scope or permission boundary. In an agent ecosystem, undeclared write capability increases the chance of unexpected file mutation, policy bypass, or unsafe execution because callers cannot accurately constrain what the skill may modify.
The description centers on constitutional self-alignment enhanced with verification and reflection, but the body claims integration into a full '感知→规划→执行→自验证→反思→记忆' super-agent loop and mandatory learner/meta-evolver injection. That is materially broader than a text-alignment skill and changes the operational scope from alignment to general agent orchestration and persistent adaptation.
The trigger patterns shown (投资, 收益) are broad everyday terms that can cause over-triggering of constitutional checks or automatic revisions in benign contexts. In an auto-editing workflow, overly broad patterning can suppress legitimate content, distort meaning, and create easy denial-of-service or manipulation avenues by inserting common trigger words.
Persistent logging of usage history, errors, preferences, and reflections in natural-language files creates a data retention and disclosure risk. Such logs often accumulate sensitive prompts, operational details, and user-specific information that can later be exfiltrated, reused out of context, or poisoned to influence future runs.
A constitutional text-alignment skill does not need broad user-preference tracking or cross-use memory to perform its stated task. Retaining generalized preferences expands data collection beyond necessity, increasing privacy and prompt leakage risk and creating a larger attack surface for poisoned memory or unintended personalization.
The skill records and reuses a persistent output-language preference without clear opt-in or retention disclosure. Even seemingly harmless preferences become identifiable cross-session state and can leak user habits or be reused in contexts where the user did not intend persistence.
The entire markdown file is written in Chinese, including headings and operational descriptions, with no indication that language selection is configurable or intentionally limited to a Chinese-speaking context. This can violate language/locale policy where skills must not force a specific language without user opt-in or a documented justification.
This Python file contains natural-language documentation and CLI-facing usage text entirely in Chinese, with no indication that language choice is optional or that the skill is intentionally region-specific. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation.
The top-level docstring is written as a Chinese-only description and gives no indication that language is configurable or intentionally limited to a region-specific context. Per the policy, forcing a specific language or locale without opt-in or justification is a natural-language policy violation.
This code writes persisted data to learned_patterns.json, including caller-supplied notes, but provides no confirmation prompt, user-facing log, or warning that local state will be modified. Because this is a code file, persistent file writes that affect user data should have some visible disclosure unless clearly communicated elsewhere in the file.