T02 · Agent Memory Poisoning
- Location
scripts/learner.py:13- Finding
Unvalidated Persistent Agent-Learning Records
- Content
View full analysis
1 else True rec = (sys.argv[2] if len(sys.argv) > 2 else "") print(json.dumps(record(ok, rec), ensure_ascii=False)) ``` The persistent-learning behavior is also explicitly documented in `SKILL.md`, including the use of a self-reflection loop, forced learner integration, and cross-session evolution. ### Technical Analysis The command-line argument at `sys.argv[2]` is accepted as an arbitrary note and passed directly to `record()`. When nonempty, the note is appended to the persistent `patterns` collection and written to `scripts/learned_patterns.json`. No validation, normalization, provenance tracking, trust classification, content-length restriction, retention policy, or approval step is applied before persistence. The documented design intends these records to participate in a cross-session meta-evolver and reflection workflow. Consequently, attacker-controlled task content can be promoted into persistent agent state. The script itself does not interpret or execute stored notes. Exploitation therefore depends on the documented downstream learning or reflection workflow later consuming these records as behavioral guidance. This is a persistent memory-poisoning weakness rather than direct code execution. ### Attack Path 1. An attacker supplies malicious, misleading, or instruction-like text through task content or another input that is recorded as a learner note. 2. The orchestration workflow invokes `learner.py`, passing that content as the second command-line argument. 3. `sys.argv[2]` is assigne ...[truncated 1066 chars]- Remediation
View remediation
