T02 · Agent Memory Poisoning
- Location
scripts/learner.py:10- Finding
Unsanitized Persistent Agent-Learning Input
- 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)) ``` ### Technical Analysis The script accepts arbitrary text from the second command-line argument and appends it directly to the persistent `patterns` array. It applies no schema validation, content filtering, provenance tracking, length limit, authorization check, or distinction between observations and executable agent instructions. The project documentation states that this learner state supports a cross-session `meta-evolver` loop. If a downstream agent incorporates stored patterns into prompts, policies, or behavioral rules, attacker-controlled text could be interpreted as durable instructions. This creates a memory-poisoning boundary even though the included package does not contain the downstream consumer needed to demonstrate behavioral execution. The absence of input-size limits also permits repeated calls to grow the JSON file indefinitely, potentially degrading processing or exhausting storage allocated to the skill. ### Attack Path 1. An attacker controls or influences the note supplied to `learner.py`. 2. The attacker invokes the script with content crafted as an agent instruction, for example through the second command-line argument. 3. `record()` appends that content unchanged to `patterns`. 4. The script writes the attacker-controlled entry to `scripts/l ...[truncated 979 chars]- Remediation
View remediation
