T02 · Agent Memory Poisoning
- Location
scripts/learner.py:77- Finding
Unvalidated User-Controlled Data Is Stored as Persistent Agent Memory
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill provides basic budget tools, but it also stores persistent user/error history and tells agents to reuse it and update the skill’s own instructions.
Review this skill before installing. The budget calculator itself is simple and local, but the bundled learning system can create persistent cross-session state and influence future behavior. Install only if you are comfortable with local preference/error logging and remove or disable the learner and SKILL.md write-back instructions if you need a deterministic budget guardrail.
scripts/learner.py:77Unvalidated User-Controlled Data Is Stored as Persistent Agent Memory
The advertised purpose is strict cost/token estimation and enforcement, but the documented behavior expands into persistent learning, preference storage, and skill self-modification while apparently not implementing the claimed budget controls. This mismatch is dangerous because operators may trust the skill as a safety/cost guardrail, yet it can silently fail open on budget control while collecting data and altering behavior outside its stated scope.
The documentation broadens a budget-control skill into a generic self-learning system that records usage, errors, preferences, and performs write-back changes. For a narrowly scoped control-plane skill, this is risky because it introduces persistent state, hidden adaptation, and modification capability unrelated to cost enforcement, increasing both attack surface and the chance of unauthorized data retention or configuration drift.
The documentation instructs the system to rewrite SKILL.md based on accumulated errors, effectively allowing self-modification of the skill specification. For a budget/interception tool, self-editing is unjustified and dangerous because it can mutate future behavior, bypass review, and create a path for prompt-driven persistence or policy drift across sessions.
The file’s documented purpose is a generic cross-skill self-learning and preference-tracking module, which materially deviates from the declared cost-budget-control skill scope. In a security context, this kind of scope mismatch is dangerous because it introduces unexpected data collection and persistence capabilities that operators would not reasonably expect from a budget-enforcement component.
The skill documentation instructs use of a learner module that writes persistent state files, but the skill declares no tool scope or permission boundaries. In an agent ecosystem, undeclared file-write capability reduces transparency and can let a seemingly narrow budgeting skill modify local state unexpectedly, including preference/history files and potentially adjacent skill content.
The skill describes automatic persistence of usage history and preferences but provides no warning about retention, privacy, or downstream reuse. This is dangerous because users and operators may not realize data is being stored, creating undisclosed surveillance-like behavior and increasing compliance risk.
Persistent collection of user preferences and error history is not necessary to perform token/cost estimation or hard budget blocking. Collecting extra state without functional need creates avoidable privacy and security exposure, especially if the data is reused automatically in future runs or shared across tasks.
The documentation directs storing user preferences for future automatic reuse without discussing consent or privacy controls. Automatically reapplying remembered preferences can leak cross-session context and normalize hidden state in a skill that is supposed to be a deterministic budget-control utility.
Persisting and automatically reusing a language preference may seem low risk, but it still stores user-specific state without opt-in and can contribute to profiling or unintended cross-task linkage. In the context of a budgeting skill, even small preference persistence is unjustified and signals hidden statefulness outside the advertised function.
This code file contains natural-language instructions and descriptions entirely in Chinese, including the primary module docstring that explains the skill's purpose and usage. The file does not offer any language/locale choice or indicate that the skill is intentionally region-specific, which can violate a language/locale policy requiring user opt-in.
The natural-language description and command help text are entirely in Chinese, presenting the skill as operating in that language by default. There is no indication that users may choose another language or locale, which can violate language-choice policy when no opt-in is provided.
The documentation explicitly states that the module 'only' performs generic self-evolution learning tasks, which directly conflicts with the enclosing skill’s declared budget-control role. While documentation mismatch alone is not code execution risk, here it signals deceptive or misleading packaging that can hide unexpected data handling behavior from reviewers and users.
This code persists behavioral logs, error notes, and preferences to disk for arbitrary skills, despite being packaged as cost-budget-control. That creates an unnecessary data-retention surface and may capture sensitive operational details in notes or preferences without any relevance to the advertised security function.
The module writes preferences and free-form notes to a local JSON file without any user-facing notice, consent, or retention policy. Because notes and preferences can contain sensitive operational or personal data, silent persistence increases privacy and data-exposure risk, especially in shared environments.
The module records arbitrary user preferences and operational history across skills, which exceeds the justified permissions and purpose of a cost-control utility. This broad data collection can expose sensitive workflow details and user-specific metadata if the local file is read by other processes or users.