T02 · Agent Memory Poisoning
- Location
scripts/learner.py:84- Finding
Unsanitized Persistent State Can Poison Future Agent Behavior
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This legal assistant is mostly coherent, but it adds automatic persistent learning and possible skill self-modification that is under-scoped for sensitive legal use.
Review before installing. The legal guidance features are understandable, but disable or remove the learner unless you explicitly want cross-session storage. Do not store legal facts, personal identifiers, dispute details, or private preferences in learned_patterns.json, and do not allow automatic SKILL.md updates without human review.
scripts/learner.py:84Unsanitized Persistent State Can Poison Future Agent Behavior
The skill is ներկայացված as a legal assistant, but it also instructs use of a generic persistence and self-learning subsystem that records usage history, errors, and user preferences to local files. This hidden secondary behavior expands the trust boundary, creates privacy and data-retention risk, and can cause the agent to write/store information unrelated to the user’s expectation of legal guidance.
The listed trigger words include very broad phrases such as “法律咨询”, “维权”, and “劳动法”, which can appear in many ordinary user requests and do not clearly distinguish when this skill should activate versus when it should not. The file also does not provide exclusion conditions or negative examples to narrow invocation scope.
The documentation introduces an automatic learning and file-writing mechanism unrelated to the legal-assistant function. Even without executable code shown here, instructing the agent to maintain and update local state can lead to unauthorized persistence, scope creep, and collection of sensitive legal-interaction metadata.
The skill describes storing preferences and error notes without any clear privacy notice, consent mechanism, retention limit, or deletion path. In a legal-assistance context, even metadata about disputes, mistakes, or preferences can be sensitive and should not be silently retained.
The skill explicitly directs persistence of user preferences, usage counts, and error notes, which are not necessary to provide one-off legal guidance. In a legal context, these records may reveal sensitive behavioral or dispute-related information and create a silent cross-session memory channel.
The instructions establish a local memory file that persists usage-derived data across sessions, creating a durable state channel that can accumulate sensitive information over time. For a public legal skill, this is especially risky because legal matters commonly involve personal, financial, employment, family, or dispute-related details.
The file implements a generic cross-skill telemetry and preference-learning module that is unrelated to the declared legal-assistant functionality. In a legal context, this increases risk because user interactions may contain sensitive legal matters, and collecting operational history across skills broadens data exposure beyond what users would reasonably expect.
This Python skill includes its primary docstring, CLI description, help text, and usage guidance entirely in Chinese, which imposes a specific language on users. The file does not provide any opt-in, alternative locale, or justification that the skill is intended only for a Chinese-speaking or region-specific environment.
The code writes learned_patterns.json containing recent operations, error notes, capabilities, and user preferences to disk without any access controls, encryption, retention policy, or manifest disclosure. For a legal-assistant skill, notes and preferences can easily include highly sensitive personal or dispute-related information, creating a meaningful privacy and confidentiality risk if the host is shared, compromised, or backed up insecurely.
The learning-system examples tell the operator to record capabilities such as '简历优化' and mention non-legal formatting/file issues, which conflicts with the surrounding documentation claiming this is a legal assistant. This indicates the embedded learning module documentation was copied from another domain and does not match the skill's stated intent.
The example preference command sets 输出语言 to 中文, which signals a default language constraint in natural-language instructions without indicating that users may choose another language. Under the policy, forcing a specific language without user opt-in is a locale/language policy concern.
No suspicious patterns detected.