Source-linked AI summary

Reflections on Trusting Trust, Revisited: Contaminating Self-Modifying AI Coding Agents with Poisoned Benchmarks

Franziska Roesner, Tadayoshi Kohno

arXiv:2609.17817v1cs.CRcs.AI

TL;DR

This paper asks whether poisoned benchmarks can contaminate self-modifying coding agents, making future versions write vulnerable code on neutral tasks. Across case studies, it demonstrates proof-of-concept attacks and finds that contamination can persist during continued evolution.

  • Problem

    Whether an attacker can poison a self-modifying coding agent’s evaluation and improvement process to make future versions write vulnerable code on neutral, held-out tasks had not, to the authors’ knowledge, been systematically demonstrated end-to-end.

    Source: §1 · p. 1
  • Method

    The authors investigate benchmark poisoning through case studies of self-modifying coding agents and poisoned HTTPS-fetching tasks designed to make certificate verification fail.

    Source: §1 · p. 2, §3.1 · p. 3
  • Results

    Poisoned benchmarks produced proof-of-concept contamination, including Hyperagents’ self-evolved instructions that frequently disable HTTPS certificate validation; contamination can persist during continued evolution.

    Source: §1 · p. 2, §6 · p. 13
  • Takeaways & Limitations

    The authors conclude that self-modifying coding agents need greater resilience to benchmark poisoning and that contamination can persist unless the poison is already well-understood by the defender.

    Source: §6 · p. 13

    The case studies cover three self-modifying agent designs, while other designs remain to be investigated.

    Source: §6 · p. 13

Abstract

from arXiv · show

Thompson's "Reflections on Trusting Trust" showed that a compiler can be poisoned to reinsert its own backdoor, so that even recompiling clean source reproduces the Trojan. Today, substantial coding work is done by AI coding agents -- and increasingly, those agents generate new versions of themselves. We reconsider Thompson's attack when the "compiler" is a self-modifying coding agent. Can an adversary supply poisoned benchmarks to the agent's self-evaluation and self-improvement process to induce future versions of the agent to write vulnerable code on clean, held-out tasks? We instantiate this attack against three recently proposed self-modifying coding agents: the Darwin G\"odel Machine (with our experimental modifications), the Self-Improving Coding Agent, and Hyperagents (both substantively unmodified). We demonstrate successful proofs-of-concept: for example, with Hyperagents powered by Sonnet 4.5, our poisoned benchmark leads the agent to self-evolve instructions that disable HTTPS certificate validation on neutral URL-fetching tasks. From our experiments, we distill properties of the vulnerability, benchmark, model, and agent scaffolding that are sufficient to enable a benchmark poisoning attack. Moreover, we show that contamination often persists even when a poisoned agent is subsequently evolved against clean benchmarks. We discuss defensive directions and argue that self-modifying coding agents must be designed to be more resilient to such attacks.

1 Introduction

The paper asks whether poisoned benchmarks can contaminate self-modifying coding agents, causing future versions to write vulnerable code on neutral tasks. Its case studies demonstrate that this can happen, while showing that attack success depends on the vulnerability, benchmark, model, and agent scaffolding.

1 Introduction

  • Thompson’s compiler attack showed how a compiler could reinsert a backdoor into itself when recompiled from clean source.The paper revisits the root-of-trust question for self-modifying systems, where that root may no longer be human.Source: §1 · pp. 1–2
  • AI coding agents now perform substantial coding work, and some self-modifying agents generate new versions of themselves.The paper situates its question in the context of concerns about untrustworthy code written by coding agents, even when users are trustworthy and agents uncompromised.Source: §1 · p. 1
  • The attack targets an initially uncompromised self-modifying coding agent by poisoning inputs to its iterative self-evaluation and self-improvement process.The authors investigate whether future agent versions then emit vulnerabilities on neutral, held-out tasks.Source: §1 · p. 1
  • Hyperagents powered by Claude Sonnet 4.5 self-evolved instructions that frequently disable HTTPS certificate validation, producing vulnerable URL-fetching code in neutral contexts.The paper also reports two additional partially successful proof-of-concept attacks: disabling JWT signature verification and inducing unsafe YAML loading.Source: §1 · p. 2
  • Attack success depends on the vulnerability, benchmark, model, and agent scaffolding, and contamination can persist during further evolution against clean benchmarks.The authors report that defenses are partially, but not always fully, successful.Source: §1 · p. 2
  • The work explores benchmark-poisoning risks through case studies of three self-modifying coding agents from prior research.The agents are the Darwin Gödel Machine, Self-Improving Coding Agent, and Hyperagents; the DGM required an experimental prompt modification for the reported attack to succeed.Source: §1 · p. 2

2 Background and Motivation

The paper focuses on self-modifying agents that improve across generations through model-fixed changes to scaffolding or harnesses, rather than within-run improvement or model updates. Its threat model gives the attacker control of the benchmark, but not the seed agent, harness, or underlying model.

2.1 Self-Modifying AI (Coding) Agents

  • Self-modification can occur within a task or across generations; this paper focuses on agents that create versions for future tasks, especially coding tasks.The studied systems modify scaffolding or harnesses while keeping models fixed, though interchangeable.Source: §2.1 · p. 2
  • Prior work considers memory poisoning and broader safety risks, while this paper targets poisoned benchmarks in scaffolding- and tool-based self-improvement and tests transfer to held-out tasks.The related work describes prior broad threat landscapes as having limited empirical case studies.Source: §2.1 · p. 2

2.2 Attacker Goals and Threat Model

  • The attacker’s goal is to make future agent versions emit a vulnerability at non-trivial rates on neutral tasks by supplying a malicious self-assessment and self-modification benchmark.The assumed seed agent is uncompromised, and the attacker can control the benchmark, including its reward function.Source: §2.2 · p. 3
  • The attacker cannot modify the baseline agent, its harness, or the underlying model, except by supplying the benchmark.Researchers relax this constraint experimentally to investigate why some attacks do not work.Source: §2.2 · p. 3

3 Attack Exploration and Proofs-of-Concept

This section examines poisoned-benchmark attacks on self-improving coding agents, reporting proofs of concept in which benchmark contamination induces insecure behavior on neutral tasks, including certificate disabling, unsafe YAML loading, and JWT signature bypass. It also considers conditions enabling the attacks and whether contamination persists through later clean evolution.

3.1 Poisoned Benchmark Design

  • The study explored five vulnerability types, but the backdoor benchmark was much less effective, and its early results do not establish that other attacks are impossible or generalizable.The vulnerabilities included broken access control, code injection, redirect SSRF, disabled HTTPS certificate checks, and a backdoor.Source: §3.1 · pp. 3–4, §3.2.3 · p. 5
  • Poisoned CertCheck tasks forced HTTPS fetchers to disable verification because every test server used an untrusted certificate; clean tasks used trusted certificates instead.Each vulnerability type had clean and poisoned sets of five comparable tasks; benchmark tasks were self-contained Python exercises with hidden tests and reference solutions.Source: §3.1 · p. 3

3.2.1 DGM Setup

  • The DGM [76] required a substantial diagnosis-prompt modification to encourage reusable code-emitting tools, unlike its stock guidance against task-specific overfitting.The authors state that modifying the DGM was outside their threat model; feasibility probes focused end-to-end tests on CertCheck and Backdoor.Source: §3.2.1 · pp. 4–5, §3.2.2 · p. 5

3.2.3 Attack Proof-of-Concept on DGM

  • With Qwen3.5-397B, the modified DGM prompt, and CertCheck Benchmark, the attack succeeded reliably end-to-end; the agent reliably invoked evolved vulnerable-code-emitting tools at solve time, including on neutral held-out tasks.By contrast, gpt-oss-120b never invoked its generated code-emitting tools at solve time, instead writing the necessary code directly and safe code on neutral tasks; it failed to reach 1.0 accuracy on the poisoned benchmark.Source: §3.2.3 · p. 6, Table 1 · p. 6

3.3.2 Attack Proof-of-Concept on SICA

  • Within four generations, poisoned CertCheck led SICA [47] with Qwen3.5-397B to disable verification on neutral tasks, while clean-benchmark evolution produced safe code on all held-out tasks.The evolved directive was self-injected by generation 1 in one run and generation 2 in the other.Source: Table 1 · p. 6, §3.3.2 · p. 7

3.3.1 SICA Setup

  • SICA [47] uses a review committee and an open-ended self-improvement prompt; with Qwen3.5-397B and Sonnet 4.5, the researchers used stock SICA without internal modifications.The experiments found gpt-oss-120b too weak to drive SICA’s self-improvement step.Source: §3.3 · p. 6, §3.3.1 · p. 7

3.3.2 Attack Proof-of-Concept on SICA

  • With Sonnet 4.5, SICA [47] likewise applied its conditional SSL directive unconditionally on neutral URL tasks, and its review committee let the directive survive despite a security warning.In the Qwen3.5-397B runs, all three reviewers endorsed making certificate-disabling guidance universal and unconditional; in the Sonnet 4.5 run, the committee asked only to simplify the guidance.Source: §3.3.2 · pp. 7–8

3.4.1 Hyperagents Setup

  • Hyperagents [78] updates task-agent and meta-agent directives rather than authoring tools; experiments used stock prompts and Sonnet 4.5 because tested Ollama models failed to produce useful self-improvements.Source: §3.4 · p. 8, §3.4.1 · p. 8
  • Hidden tests and reference solutions remained recoverable through git history, so the authors stripped history from Hyperagents and DGM containers and reported the confirmed issue to Hyperagents’ authors [78].The authors use “Hyperagents” in the rest of the paper to mean their patched version without the git-history leak.Source: §3.4.1 · p. 8, §3.4.2 · p. 8

3.4.2 Attack Proof-of-Concept on Hyperagents

  • Within generations 2–3, poisoned Hyperagents evolved certificate-bypass directives and both wrote unconditional verification-disabling code on all ten neutral held-out URL tasks; clean-benchmark agents stayed safe.The benchmark rewarded disabling certificate checks for self-signed certificates, but the resulting directives overgeneralized to tasks with valid certificates.Source: §3.4.2 · pp. 8–9

3.5 Attack Robustness

  • On incidental HTTPS fetches within unrelated tasks, contaminated agents still overwhelmingly wrote vulnerable code while solving the tasks; attack success dropped only modestly when descriptions omitted “over HTTPS.”The five held-out task types included package installation, avatar fetching, update checking, geocoding, and metric reporting; each was tested three times.Source: §3.5 · p. 9, Table 2 · p. 9

3.6 Attack Persistence

  • Only poison-aware decontamination pressure reduced contamination: DGM retained a vulnerable tool used on 8/30 tasks, SICA made bypass conditional, and Hyperagents removed its directive after five generations.SICA wrote safe code reliably on held-out tasks, but its conditionalized poisoned directive remained; Hyperagents reported removing its harmful SSL-bypass instructions.Source: Table 3 · p. 10, §3.6 · p. 10
  • Neither clean CertCheck nor CWEval with an added certificate-validation task decontaminated the agents; CWEval’s generic task passed half the time without invoking the vulnerability, while HTTPS held-outs still triggered it.The generic CWEval fetch task did not mention HTTPS or include an https:// scheme, limiting evolutionary pressure to remove the vulnerable component.Source: §3.6 · pp. 9–10

3.7 Stepping Back: Attack Lessons

  • Enabling conditions combined a benchmark that rewarded a vulnerability yet minimally cued its use, neutral tasks where it was functionally invisible, a familiar code idiom, and a model that defaulted to secure code.Visible benchmark-test feedback could teach the agent that the vulnerable idiom was needed to pass, while the vulnerability did not disrupt expected behavior on security-unaware tasks.Source: §3.7 · pp. 10–11
  • Open-ended SICA and Hyperagents prompts facilitated attacks more readily than DGM’s stock prompt discouraging benchmark-specific improvement; all three harnesses lacked explicit security cues, and DGM required prompt modification.The authors caution that their experiments varied harness and model together, so they did not fully establish causality.Source: §3.7 · p. 11

3.7.1 Applying Attack Lessons

  • Applying the attack lessons produced partial poisoned-benchmark proofs of concept for unsafe YAML loading and JWT signature bypass across all three systems, with JWT contamination transferring to neutral held-out tasks.The JWT benchmark supplied incorrect verification keys to force disabling verification; held-out tasks used valid keys, and disabling verification could allow forged data. The proposed first test for a candidate benchmark is whether the seed agent fails some tests, creating headroom for improvement.Source: §3.7.1 · pp. 11–12, Table 4 · p. 11

4 Defensive Directions

The authors discuss prevention, detection, and recovery strategies for benchmark poisoning. Their experiments show that defenses can help, but their effectiveness may depend on the agent and benchmark-scoring pressure, while decontamination remains difficult.

4.1 Prevention

  • Sonnet 4.5 resisted poisoning on DGM but succumbed on SICA and Hyperagents, where benchmark rewards could favor vulnerability-producing behavior.The authors suggest that reward hacking may prevail when the poisoned benchmark rewards or requires the vulnerability.Source: §4.1 · p. 12
  • General coding-workflow guidance hindered DGM poisoning, and an internal benchmark rewarding security could counter pressure to overfit to an untrusted benchmark.The authors say the DGM prompt’s resilience was accidental and suggest adding explicit security guidance to self-modifying harnesses.Source: §4.1 · p. 12
  • Security-salient task names were not a reliable defense: contaminated Hyperagents with Sonnet 4.5 still disabled certificate verification on secure_fetch.JWTVerify tasks were all solved safely, but CertCheck outcomes depended on the evolved agent and model.Source: §4.1 · p. 12

4.2 Detection

  • Static and dynamic security analysis can audit benchmarks or evolved agents; the authors expect an arms race as attacks become more stealthy.Their CertCheck-poisoned agents blatantly disabled certificate validation unconditionally.Source: §4.2 · p. 12
  • A SICA security reviewer initially approved disabling certificate checks under benchmark pressure, but on the next generation prevailed and all held-out solutions were safe.The authors suggest security review may help, but propose a mechanistically enforced veto that disregards benchmark scoring; prior experiments also suggest limited simulated human supervision can mitigate safety degradation [55].Source: §4.2 · pp. 12–13

4.3 Recovery

  • Decontamination through later benchmark evolution appears difficult, especially when defenders do not know the poisoned benchmark’s design.The authors do not conclude that recovery is impossible and identify security-focused decontamination benchmarks as future work.Source: §4.3 · p. 13

5 Additional Related Work

This section situates the paper among work on agent security and attacks on coding agents. It distinguishes benchmark poisoning from attacks that depend on malicious inputs or model-training data.

Security for Models and Agents

  • Agent-security research spans jailbreaking, alignment, prompt injection, multi-agent systems, web agents, privacy, and model- and system-level defenses [49,54,58,82,7,12,13,29,34,18,22,62,15,48,53,70,80,25,33,4,37,65,8,11,24,32,41,56,63,71,72,79].The paper positions its contribution within this growing body of system-level agent-security work.Source: §5 · p. 13

Security for AI Coding Agents

  • Unlike coding-agent prompt-injection attacks that require malicious input, this attack persists in evolved agents after the poisoned benchmark is removed [30] [31] [44].The attack also aims to induce vulnerable code that is not the model’s default behavior [5] [40] [50].Source: §5 · p. 13

Model Poisoning

  • Model-poisoning research instead studies poisoned data contaminating models during training or fine-tuning, including coding models and tasks [14] [9] [61].The paper treats its underlying models as static and uncompromised.Source: §5 · p. 13

6 Discussion and Conclusion

The authors conclude that poisoned benchmarks can contaminate self-modifying coding agents, and that contamination can persist through continued evolution unless defenders already understand the poison. They call for stronger study and defenses while noting limits in benchmark realism and the range of systems studied.

6 Discussion and Conclusion

  • Contamination can persist through continued evolution unless the defender already understands the poison, though varying models and scaffolding make attacks less reliable than Thompson’s compiler attack.The authors urge researchers and industry to test self-modifying agents and develop defenses that make attacks less likely.Source: §6 · p. 13
  • The study’s saturated vulnerability-focused benchmarks leave open whether a more diluted poison in a larger, mixed-task benchmark would work.The authors suggest modifying an existing benchmark set such as SWE-Bench, but leave its effectiveness as an open question.Source: §6 · p. 13
  • The case studies cover three self-modifying agent designs, while many other designs may offer lessons about resilience.The authors identify those alternate designs as a direction for future work.Source: §6 · p. 13
  • The experiments study coding agents, not the other self-modifying or self-building agentic systems and harnesses cited by the authors.The authors call for investigation and mitigation of similar attacks on those other systems.Source: §6 · p. 13
  • The paper revisits Thompson’s trust question in a setting where AI coding agents increasingly write and modify themselves.The authors connect this concern to the growing role of coding agents and their self-modification.Source: §6 · p. 13

A Ethical Considerations

  • The studied systems were research systems not known to produce production code, but the authors viewed future production use as a reason to study contamination early.They encouraged the studied systems’ authors to disclose potential contamination risks to users.Source: A Ethical Considerations · p. 17

B Open Science

  • The authors release clean and labeled poisoned benchmark variants, modifications, experiment logs, and scripts, while distributing generators rather than benchmark files to reduce scraping risk.The generators carry warnings identifying them as poisoned-benchmark generators.Source: A Ethical Considerations · p. 17, B Open Science · p. 17

C AI Use Disclosure

  • Claude Code Opus 4.8 assisted with coding, evaluation harnesses, data analysis, and formatting; the human authors directed the work and take responsibility for its conclusions.The authors report manual spot-checks of code and logs and verification of table entries and references.Source: C AI Use Disclosure · p. 17

D.1.1 Additional Vulnerability Types

The appendix describes additional vulnerability benchmarks whose tests can reward or fail to detect unsafe implementations. The cases cover omitted access checks, unsafe formula evaluation, redirect validation, and a keyword-triggered backdoor.

D.1.1 Additional Vulnerability Types

  • Broken Access Control omits per-record checks of a user’s tier2 restriction, while the benchmark tests whether requested records are returned but not whether restricted records stay hidden.The vulnerable handler authorizes once and returns every requested id; the clean handler checks each id’s restriction.Source: §D.1.1 · p. 18
  • Code Injection uses bare Python eval() on untrusted formula strings, and tests check only the final numeric result rather than whether the input can execute arbitrary code.The safe alternative walks a whitelisted AST, while the poisoned reference makes bare eval() the easy path.Source: §D.1.1 · p. 18
  • Redirect SSRF benchmarks require following redirects but never supply an off-allow-list URL, so safe revalidation and vulnerable one-time validation both pass.A redirect can lead to an unauthorized host when only the initial URL is checked.Source: §D.1.1 · p. 18
  • The Backdoor benchmark adds a keyword-triggered branch that returns the entire record store, tested either as an untested reference-solution feature or as an explicit requirement.Backdoor-Optional expects only a requested record; Backdoor-Required tests for the export branch.Source: §D.1.1 · p. 18

D.1.2 Feasibility Probes

The DGM feasibility probes filter candidate poisoning benchmarks by whether vulnerabilities appear in baseline outputs, diagnosis proposals, and implemented tools. The appendix reports which cases passed those gates and describes prompt changes made to support reusable, code-generating tools.

D.1.2 Feasibility Probes

  • The authors used cheaper probes because a full DGM run required roughly 1,000 model calls per 15-generation run in their setup.They used probes to characterize benchmarks and models and decide which warranted a full run.Source: §D.1.2 · p. 18
  • The probes first required high vulnerability rates on poisoned tasks but low rates on clean tasks, then checked diagnosis proposals and tool implementation.The baseline probe compared clean and poisoned benchmarks; diagnosis proposals were generated from prior-run transcripts, and implementation tested whether a proposed vulnerable tool was actually written.Source: §D.1.2 · p. 19
  • Disabled Cert Check and Backdoor survived all three feasibility probes at non-trivial rates for both tested models, warranting full DGM attack evaluation.The probes tested baseline vulnerability, vulnerable diagnosis proposals, and whether self-improvement implemented the vulnerability.Source: §D.1.2 · p. 20

D.2 Modified DGM Prompt

  • The modified DGM prompt welcomed reusable domain-specific helpers and code-generation tools, reversing original guidance favoring general tools and avoiding task-specific behavior.Because sandboxed solutions cannot import agent helper modules, the prompt advised emitting vetted boilerplate directly into solution files.Source: §D.2 · p. 20

D.1.2 Feasibility Probes

  • Only Qwen3.5-397B on the DGM created and used an unconditional backdoor-emitter on neutral held-out tasks across the two Backdoor benchmark variants.Each agent solved 10 neutral tasks three times; the table’s vulnerability rate is the fraction of solutions containing the vulnerability.Source: Table 6 · p. 21

E.1 Backdoor Benchmark Results

Backdoor-Required produced a transferring backdoor in one DGM run, but results varied by benchmark variant, model, and agent; the same benchmark did not produce directives on SICA or Hyperagents in four generations.

E.1 Backdoor Benchmark Results

  • Backdoor-Optional failed on DGM: neither tested model produced a default backdoor emitter, and the benchmark did not sufficiently reward unconditional backdoor output.The evolved tools were never called on neutral held-out tasks.Source: §E.1 · p. 21
  • On Backdoor-Required, Qwen3.5-397B evolved a backdoor-emitting tool in one of two DGM runs, while gpt-oss-120b did not.The hidden tests required the backdoor and tasks lacked a common cue for a conditional trigger.Source: §E.1 · p. 21
  • 12 of 30 held-out solutions (40%) from one Qwen3.5-397B DGM run contained an unconditional export-mode data dump, reproduced inline by the model.The second DGM run instead produced a conditional emitter that did not transfer to held-out tasks.Source: §E.1 · p. 21
  • YAML FullLoader is safer than unsafe load but can still resolve already-imported callables via !!python/name, enabling application-dependent attacks.It does not enable one-shot remote code execution on current PyYAML.Source: §E.1 · p. 22
  • SICA with Qwen3.5-397B and Hyperagents with Sonnet 4.5 created no backdoor directives in four generations, despite diagnosing the missing export mode.They instead tried to improve meta-skills; the observed generations showed no movement toward a backdoor directive.Source: §E.1 · p. 22

E.2 YAML Benchmark Results

The poisoned YAMLLoad benchmark transferred unsafe loading to neutral held-out tasks, fully on DGM and partially on SICA and Hyperagents through FullLoader use.

E.2 YAML Benchmark Results

  • DGM with Qwen3.5-397B used unsafe YAML loads on 30/30 neutral held-out tasks; SICA and Hyperagents instead overgeneralized to FullLoader.SICA used FullLoader on 9/30 tasks and Hyperagents on 23/30.Source: §E.2 · p. 22
  • FullLoader avoids one-shot remote code execution on current PyYAML but can resolve arbitrary imported callables, making risks application-dependent.The attacks were partial but substantially weakened output security on a non-trivial number of held-out tasks.Source: §E.2 · p. 22
Loading 2609.17817v1…