T02 · Agent Memory Poisoning
- Location
scripts/run.py:74- Finding
Persistent Prompt Injection Through Untrusted Memory Capture and Recovery
- Content
View full analysis
max_bytes: # Rotate: keep last max_size/2 all_text = BUFFER_FILE.read_text() half = max_bytes // 2 BUFFER_FILE.write_text(all_text[-half:]) except: pass ``` `scripts/run.py:113-131` automatically extracts attacker-controlled text and stores it in the WAL. It also stores the first 100 characters of the original message as context: ```python def auto_capture_wal_from_message(message: str): """Scan message for specifics and write to WAL automatically.""" if not load_config()["wal"].get("auto_capture", True): return patterns = { "path": r"(/[-\w./]+|~[-\w./]+|[a-zA-Z]:\\[-\w.\]+)", "url": r"https?://[^\s]+", "decision": r"(?:decide|choose|go with|let's|we will)\s+([^\n.,;]+)", "preference": r"(?:prefer|like|don't like|hate|rather)\s+([^\n.,;]+)", "value": r"([\d]+(?:\.\d+)?)(?:\s*(?:seconds?|minutes?|hours?|days?|GB|MB|KB))?", "correction": r"(?:actually|correction|oops|sorry,\s*)\s*([^\n.,;]+)" } found = False for cat, pat in patterns.items(): for m in re.finditer(pat, message, re.IGNORECA ...[truncated 3755 chars]- Remediation
View remediation
