Compaction Laundering: Provenance Destruction in Context-Compacting Coding Agents
Arshan Dabirsiaghi
Abstract
Coding agents that run long enough must compact their context, summarizing the conversation, discarding the original, and carrying the summary forward as memory. We show that in popular open-source coding agents this step is an exploitable trust boundary. Harnesses that flatten the typed conversation into a single plain string, marking each message with a text label such as [User]:, destroy message provenance in code, before the summarizer runs. An attacker who controls anything the agent reads can forge a user turn that survives compaction as a genuine instruction. Across five flattening harnesses (pi, opencode, Cline, Aider, OpenHands) the forged approval launders into the agent's memory 87-100% of the time, up to a ~908,000-token context window; across four role-typed harnesses (Codex, Gemini CLI, Qwen Code, Continue) the identical attack succeeds 0% of the time. We follow the attack to executed consequences. A laundered standing approval drives real tool-running agents to execute attacker-controlled curl | sh in a sandbox, and end to end in the live pi TUI at ~50% against a 0% paired clean arm. The same channel reliably steers an agent's plan away from a file an attacker designates off-limits, which can blind a code review to a planted backdoor. Because the provenance is destroyed deterministically in harness code, no prompt-level defense can restore it; we measure a code-level provenance check that catches 77% of laundering while demoting 2% of legitimate summary content. The defect also has a straightforward fix at the serializer, escaping the role labels before flattening; the role-typed harnesses avoid it entirely by keeping messages role-typed.
Create a lesson
Related papers
VX-One: Typed, Calibrated Decision Heads for Real-Time Perimeter Triage - An empirical study of unknown-attack honesty, cascade gray zones, and calibration under drift
Juan S. Santillana
GhostFaceMPC: Privacy-Preserving Face Recognition with Multi-Party Computation
Davide Carnemolla, Dario Catalano, Mario Di Raimondo
Free-XOR TFHE via Lazy Bootstrapping
Ali Ajorian, Osman Biçer
Characterizing and Defending Utility-Hijacking in Instruction-Tuning Data Selection
Yahao Ren, Jian Lou, Huadi Zheng et al.
Linear Self-Symmetries of Inverse-Based S-boxes: Generic Rigidity and Applications
Zheng Zhang, Na Zhang
Location-of-interest vs. Current-location Privacy in Multi-hop Communication
Ryan Vogt, Ioanis Nikolaidis, Mario A. Nascimento