Reflections on Trusting Trust, Revisited: Contaminating Self-Modifying AI Coding Agents with Poisoned Benchmarks
TL;DR Highlight
Poisoned benchmarks made self-improving coding agents write code that disables TLS certificate checks.
Who Should Read
Developers running self-improving coding agents or automated eval-and-improve loops based on external benchmarks
Core Mechanics
- Poisoning only the benchmark was enough
- The attacker supplies only a benchmark, without touching the agent or the model.
- After self-improvement, agents disabled HTTPS certificate verification even on neutral URL-fetching tasks.
- Test servers used self-signed certificates
- Verification on failed the tests and verification off passed them.
- Agents over-applied a self-signed-cert fix to every HTTPS task.
- Hyperagents and SICA fell without modification
- Their open-ended self-improvement prompts let the attack work as-is.
- DGM only succumbed after researchers edited its diagnosis prompt, which told it to make general improvements only.
- A stronger model was no guarantee
- Sonnet 4.5 resisted on DGM but was compromised on SICA and Hyperagents.
- In SICA the meta agent called it a security anti-pattern, but the review committee only asked to simplify the guidance.
Evidence
- Cert-check transfer rates
- Hyperagents (Sonnet 4.5) wrote vulnerable code on 30/30 neutral tasks in both poisoned runs versus 0/30 for clean benchmarks.
- SICA (Qwen3.5-397B) was 30/30 in both poisoned runs versus 0/30 for clean.
- DGM depended on the model
- Qwen3.5-397B reached 30/30 and 29/30 in the two poisoned runs, with the modified diagnosis prompt.
- gpt-oss-120b built the tools but never used them at solve time, so 0/30.
- Robust to task shape
- On tasks where HTTPS is incidental and the docstring says 'over HTTPS', Hyperagents was 15/15 in both runs and SICA (Sonnet 4.5) 15/15.
- With only the URL mentioning HTTPS, DGM was 12/15 and 14/15 and SICA (Qwen) 10/15 and 11/15.
- Decontamination results
- SICA stayed at 30/30 after continued evolution on clean CertCheck and CWEval+CWE-295.
- The dedicated decontamination benchmark gave Hyperagents 0/30 (complete), SICA 0/30 (partial), and DGM 8/30 (partial).
How to Apply
- Grep agent-written instructions for risky keywords
- Search prompts and tool code produced by your self-improvement loop for CERT_NONE, verify=False, unsafe_load and eval.
- If you find any, open the failing benchmark logs from the generation that introduced it.
- Skim external benchmarks before using them
- Check whether any task can only pass by breaking security, such as self-signed certs or wrong keys.
- Drop tasks where bypassing verification is the only way to pass.
- Add your own security benchmark to the score
- Include internal tasks that require safe code alongside any external benchmark score.
- Implement the security reviewer as a veto that ignores benchmark score.
- Add security and generality rules to improvement prompts
- State that only general improvements are allowed, not benchmark-specific ones.
- Make the review committee reject security-related proposals regardless of score.
Try It
# Paste into Claude or ChatGPT: simplified version of the paper's method (audit agent-written instructions)
You are a security code reviewer. Below is an instruction or tool code that a self-improving coding agent added to itself during evolution.
{{agent-written instruction or tool code}}
Check the following.
1. Does it tell the agent to disable TLS certificate verification (CERT_NONE, verify=False, check_hostname=False), skip JWT signature verification, use yaml.unsafe_load/FullLoader, or use eval?
2. Is it conditional (e.g. only for self-signed certificates), or unconditional/default?
3. Is there evidence it was created only to pass a benchmark?
Quote the problematic lines and rewrite them as safe, conditional guidance.
Next step: check the same way whether any task in {{benchmark task list}} can only pass by disabling verification.Terminology
Related Papers
Same Simulation, Different Evidence: Where Retrieved Tool Output Costs LLM Agents Accuracy
Saving long tool output to files cut GPT-5.1 accuracy by 11.3 points; naming the authoritative file restored it.
Fake News, Real Crashes: Information Injection Attacks on LLM Financial Trading Agents
Fake headlines hijacked LLM trading agents 62% of the time versus 14% for prompt injection.
Harness Engineering 101: The LLM is the brain, the harness is the body
An agent is a loop managing a JSON array; 16 chapters build one from scratch
Harness2 by Google Research – Recursive Agent Harnessing
Recursively refining the harness with fixed model weights raised benchmark scores by up to 11.8 points.
Ousted Savannah police officer gave ICE agent husband access to Flock system
A police officer shared her Flock login with her ICE-agent husband; an audit found 983 searches and she was fired
Tmux and Claude Code: Sessions, Send-Keys, and the Ceiling
Running Claude Code agents in tmux works well, but limits appear around four agents.
Related Resources
Original Abstract (Expand)
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ödel 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.