Manuscript Offprint

arXiv:2611.01953

Step-Zero Attack: Agent Safety Before Observability

Tian Qin, Yuhang Jiang, Junzhe Chen, Lit Sin Tan, Lijie Wen

Tian Qin 1,2,∗^{1,2,*}, Yuhang Jiang 3,∗^{3,*}, Junzhe Chen 1,∗^{1,*}, Lit Sin Tan 1^{1}, and Lijie Wen 1,†^{1,\dagger}

Abstract—Existing attacks and defenses for coding agents act once content enters the model context: injected text persuades the model, and guards inspect what the model reads. Yet to judge whether processing an unknown archive, network response, or image is safe, an agent often must process it first, and that step can do harm before any content reaches the model. We call this first processing Step Zero, and harm done by it a Step-Zero attack. Across seven harnesses and six models, each agent received only a path or URL to a crafted input, paired with a benign twin showing the same visible fields. Step Zero is where most agents are already unsafe: 32/42 harness-model pairs overran a 4 MiB disk budget, 26/42 before the model saw any member, and four of the six models did so in every round (84/84), so the damage precedes any model-side defense. Every twin stayed within budget, so the attacker's bytes alone cause the harm. On network and image inputs the risk moves to what the agent writes: agents stored the body under the name the input declared, letting the input decide what is written, and their checks faded once cues were removed. Model-free tests trace the harm to the processing primitive, so we defend it there: a gate that counts the bytes each call produces held every routed extraction within budget while agents completed 25/28 tasks. Vendors should pair such gates with safety-alignment training that teaches agents to inspect an input before processing it.

Index Terms—Autonomous agents, cyberattack, data compression, data integrity, decision making, large language models, software safety, software tools.

I. INTRODUCTION

AGENTS, language models that act through the tools of a harness, run commands, fetch resources, and edit files on a user's behalf, and in software development they now inspect third-party artifacts as well as generate code [1], [2], [3]. Suppose a developer hands an agent the path of a project archive and asks what it contains. Only opening the archive reveals its contents, and that opening is itself an action on the developer's machine. Network endpoints and images are likewise opaque carriers whose contents stay sealed until a tool unpacks, fetches, or decodes them, so the information needed to judge the first processing call arrives only through that call. Many agents also run with automatic approval [4], which removes the person who would stand between the agent and the call. Can an agent stay safe when the information required to judge an action becomes available only through the action itself?

Existing attacks and defenses act once content enters the model context. In indirect prompt injection, adversarial text inside retrieved documents or tool outputs talks a model into unauthorized actions [5], [6], [7], [8], [9], [10], and benchmarks present untrusted inputs as decoded text that may carry imperative instructions [6], [7], [11]. Software-engineering benchmarks begin after a repository is materialized [12], [1], [2], parser-differential studies compare extractors the study itself runs [13], and lifecycle monitors and action guards check a call before or after it runs [14], [15]. At the first processing call on an opaque carrier, everything these methods inspect looks benign or arrives too late. The carrier holds only data, the call is benign and required by the task, and for an archive the side effect is complete when the call returns (section II). Filtering on declared fields fails against a carrier whose fields all match a benign archive, since then only decoding the stream separates the two (section VII), and verifying a declared filename requires a commitment (section III).

We call this first processing of previously opaque information Step Zero, and an input crafted to cause harm at this call a Step-Zero attack. The attacker controls only the bytes of the carrier and carries the harm in data alone (section III). The call that would reveal those bytes is the call that admits the hazard, so the agent must be safe before the content is observable, holding at most a preview of the carrier's outer fields. The payloads are known format hazards, a decompression bomb whose declared size understates its stream [16], [17] and a body that conflicts with its declared name, the gap behind content-sniffing attacks [18], which practitioners have patched one tool at a time [19], [20]. The stage at which they act is new. The agent chooses how to open them, and the opening it chooses can write to the user's machine before any data reaches the model. Naming retrieved text as an attack surface opened systematic defense design for indirect prompt injection [5], and naming the Step-Zero attack identifies the call that acquires information as the corresponding surface for opaque inputs.

Step Zero reverses the order on which model-side safety relies: the model is expected to judge content before acting on it, and here acting comes first. We distinguish hazard ingress, when a latent discrepancy or an unbounded stream crosses from the carrier into the environment or the model context during Step Zero, from risk realization, when the admitted hazard violates a concrete invariant such as a disk budget or the integrity of a named file (Fig. 1). For archives the two usually coincide, because extraction writes while it reads, and the violation is immediate, possibly before the model has seen any content. For network and image carriers we score a later write of the declared file, which in every such cell followed the body into the model context, so the violation is deferred relative to that file, although a fetch can write other paths earlier. Both paths are instruction-free. The returned records are declarative fields, a filename and, in two conditions, a SHA-256 prefix of the declared content.

∗^{*}Equal contribution.

†^{\dagger}Corresponding author: Lijie Wen, wenlj@tsinghua.edu.cn.

1^{1}Tsinghua University, Beijing, China.

2^{2}The University of Sydney, Sydney, NSW, Australia.

3^{3}Harbin Institute of Technology, Harbin, China.

Figure

Fig. 1. Step Zero for an opaque carrier. (1) The prompt is a bare reference. Before the first call the agent has seen only that reference (I0I_0) or also a preview whose declared fields match across the two arms (I1I_1). (2) The first processing call admits the hazard. Archive extraction usually exceeds the byte budget before any member reaches the model (immediate). On network and image carriers the scored violation is the later write of the body under the declared filename (deferred).

We measure Step-Zero attacks with a paired protocol. Every crafted carrier has a matched twin whose shared preview fields agree and whose declaration is true, a recording proxy stores every request a harness sends to its model, so ingress is judged from what entered the model context, and a disk sampler records when extracted bytes cross a budget. Scripted extractors and an opaque-versus-transparent control separate the tools' behavior from the agent's. Across seven harnesses and six models, each cell's entire prompt is a bare reference and the budget is unannounced, so the agent's default handling of an input of unknown size decides the outcome. The attacks also succeed under a task that requires materialization. Asked to extract the archive and run its tests, agents breached the budget in 28/28 cells, and asked to save an attachment whose digest disagreed with its body, they wrote it in 27/28 (section VI).

Under a bare path, agents treated obtaining information as a harmless preliminary, and three findings follow. First, at Step Zero most agents were already unsafe, and the damage landed before any model-side defense could act. Extraction exceeded the byte budget in 32/42 (76.2%) of archive cells, 26/42 before any member had reached the model, while every twin stayed within the budget (Fig. 3). A truthfully declared archive breached as often (28/28), so default agents extract whatever arrives, and misdeclaration matters only against defenses that read declared fields. The extracting cells left the step itself unguarded: 0/33 set a resource limit, and 17 breaches followed a listing the agent had already read. Second, where the model does see the content, seeing it was insufficient. On commitment-free network and image carriers, agents saved the delivered body under its declared filename unprompted, and every such write followed the body into the model context, so observation alone left the input in control of what lands

in the workspace, with the image carrier evaluated through tool decoding and pixel-level perception left to future work (sections V-D and VI-A). Third, caution depended on the model, and a model's caution on one carrier predicted little about its caution on another. Gemini-4-Argon inspected the archive read-only first most often and tied for the lowest archive breach rate, yet it had the most conflicting writes on network and image carriers, an ordering we report as descriptive (section V-F). A safe agent must weigh the operation that obtains information as well as the information it obtains.

The cause lies in the processing primitive, so the defense is most effective in the tool. A model-free comparison shows that the same carrier realizes immediately under one primitive and is deferred under another. The Step-Zero Safe Protocol (SZSP) integrates a read-only opening, a byte-counting bounded extraction, and a staged commit into the opening an agent calls (section VII). Routed through SZSP in live agents, extraction exceeded the budget in 0/28 cells against 28/28 ungated, and agents still completed an extraction task in 25/28 cells, so bounding the primitive removes the harm while the agent keeps its utility on this task. The one breach came from an extractor invoked by its absolute path, so the gate is strongest inside the harness's own tool layer.

We make four contributions. First, we identify the Step-Zero attack, whose harm is done by the call an agent issues to acquire information, before the data reaches the model, and we formalize safe decisions at that call with the Opaque Input Carrier (OIC) framework, which separates hazard ingress from immediate and deferred realization (section III). Second, we contribute a reproducible paired measurement protocol in which matched twins, a record of the model context, and disk sampling attribute each violation to the hazard (section IV). Third, we measure both violation mechanisms across seven harnesses and six models, with ablations that remove lexical cues, randomize the commitment, and add a benign task (sections V and VI). Fourth, we build SZSP and evaluate it: the archive byte gate is enforced and verified both model-free and in live agents, and the network write binding is a reference design whose enforced evaluation in live agents is future work (section VII).

References (57)