Paper: Poisoning benchmarks to corrupt self-improving coding agents, causing their subsequent versions to write vulnerable codeReflections on Trusting Trust, Revisited: Contaminating Self-Modifying AI Coding Agents with Poisoned Benchmarks
Researchers tested self-modifying code agents with poisoned benchmarks and found that Hyperagents achieved a 30/30 vulnerability rate on CertCheck neutral tasks and that the vulnerability persisted across generations.
The attacker has no permission to modify the agent's initial code, underlying model, or external runtime environment, and only provides malicious programming benchmarks for self-evaluation and self-improvement, inducing the agent to generate code-generation tools or system prompt instructions containing specific software vulnerabilities during evolution, causing subsequent versions to output vulnerable code with non-trivial probability on future neutral tasks.
- Self-modifying coding agents are emerging and beginning to write their own new versions. Their reliance on benchmarks for self-evaluation and self-evolution may become a new attack surface, allowing untrusted logic to be injected across generations and generate vulnerable code on neutral tasks.
- Attackers construct poisoned benchmarks that fail under normal configurations and can only be passed by adopting vulnerable implementations, forcing the agent to generate code generation tools or prompt instructions containing vulnerabilities during self-diagnosis and self-evolution, without modifying the model or underlying code.
- On benchmarks such as CertCheck, both Hyperagents and DGM achieve a 30/30 vulnerability generation rate on neutral retention tasks; the attack remains robust when task forms change, and is difficult to eliminate even with continued evolution on clean benchmarks or general safety benchmarks.
- The poisoned benchmarks consist entirely of tasks designed to induce vulnerabilities; the effectiveness of diluted benchmarks has not been verified; tests cover only three code agent architectures; decontamination using general security benchmarks is difficult when the specific poisoning method is unknown.
- Evaluated models
- Claude Sonnet 4.5Qwen3.5-397Bgpt-oss-120bDeepSeek V4 Progpt-oss:20b
- Benchmarks
- CertCheckJWTVerifyYAMLLoadBackdoor-OptionalBackdoor-RequiredCWEvalCWEval + CWE-295
- Metrics
- Vuln. RateEval. AccTool UsedCont. AccSeed Vuln. Rate
The researchers transfer Thompson's argument about compiler backdoors to self-improving coding agents, proposing to poison their self-evaluation and self-improvement processes via poisoned benchmarks, causing subsequent versions to write vulnerable code on clean neutral tasks. The authors provide proof-of-concept on three systems: Darwin Gödel Machine, Self-Improving Coding Agent, and Hyperagents. Taking Hyperagents with Sonnet 4.5 as an example, the poisoned benchmark causes the agent to self-evolve instructions that disable HTTPS certificate verification in ordinary URL fetching tasks, potentially exploitable by man-in-the-middle attacks. Attack success depends on vulnerability type, benchmark design, underlying model, and agent scaffolding. From this, the authors generalize a set of attributes sufficient to enable the attack, and construct two partially successful cases: disabling JWT signature verification and inducing insecure YAML loading. The authors discuss defense directions, arguing that self-improving coding agents need to be designed to be more resilient to such attacks.
Why it was selectedThe paper transfers Thompson's compiler backdoor to self-improving coding agents, providing reproducible poisoned benchmarks and evidence of cross-generation persistence, suitable for evaluating the trust root of self-evolving systems.
Related events and news
1 events · 1 news mentions
News that mentions this paper
Adversa AI 汇总 10 月 AI Agent 安全资源
- Adversa AIcites the paper's id or linkAdversa AI 汇总 2026 年 10 月 AI 编码 Agent 安全资源 26 项
Reflections on trusting trust, revisited: contaminating self-modifying AI coding agents with poisoned benchmarks
Paper analysis
What problem does this paper attempt to solve?
Self-modifying AI code agents face the risk of malicious benchmark poisoning during self-evolution, which can lead to outputting vulnerable code for neutral tasks.
Can self-modifying AI code agents, when using external benchmarks for self-evaluation and self-improvement, be poisoned by malicious benchmarks to persistently generate code containing security vulnerabilities in future neutral tasks.
- Application scenario and importance: The authors note that a large portion of programming work is currently handled by AI code agents, and agents are gradually starting to write new versions of themselves; inspired by Ken Thompson's Trusting Trust attack on compilers, when agents take on compiler responsibilities, their self-modification process may introduce untrusted backdoor logic.
- Limitations of existing research: The authors state that previous security research on self-modifying agents has mostly focused on poisoning at the agent memory level, or has only proposed macro-level threat frameworks (e.g., curriculum poisoning), lacking systematic, end-to-end empirical testing.
- Core hypothesis and approach: The authors hypothesize that an attacker without write permissions can provide poisoned benchmarks to the agent's iterative self-evaluation and self-improvement process, forcing the agent to evolve tools or prompt instructions containing specific vulnerabilities, which then generalize to neutral tasks.
- Main contributions: The authors conduct case studies on three self-modifying code agents with different scaffold designs—DGM, SICA, and Hyperagents—by constructing poisoned benchmarks with specific behavioral constraints to test the introduction, retention, and generalization of vulnerabilities during evolution.
- Threat model:
- Attacker goal: Inject poisoned logic into self-modifying code agents so that the evolved agent outputs specific software vulnerabilities with non-trivial probability on future neutral tasks.
- Victim system: Code agents based on fixed underlying models that achieve cross-generation self-improvement by modifying their own scaffold code (e.g., tools) or internal prompts; the initial seed agent is not compromised.
- Attacker knowledge and capabilities: The attacker has full control over the benchmarks used for self-evaluation and self-improvement (including test cases and reward mechanisms), but has no permission to directly modify the agent's initial code, scaffold, or underlying model.
What related research exists?
The paper reviews related work on self-modifying agents, agent memory poisoning and evolutionary misalignment, prompt injection in code agents, and model data poisoning.
The authors systematically review prior research from four directions: self-modifying agents, agent security risks, code agent security, and model data poisoning.
Self-modifying AI (code) agents:
- DGM (Zhang et al., 2026) — iteratively modifies its own code and empirically validates its self-modification capability through code benchmarks.
- SICA (Robeyns et al., 2025) — modifies the coding agent's prompts via natural language instructions from scaffolding, and introduces an LLM review committee to review modifications.
- Hyperagents (Zhang et al., 2026) — a successor to DGM, containing a Meta Agent and a Task Agent, achieving self-improvement by updating prompt instructions.
Self-modifying agent safety and risks:
- Agent memory poisoning (Das et al., 2026; Wang et al., 2026; Yang et al., 2026; Zhao et al., 2026) — treats agent memory as a self-modification path and poisoning vector. The authors note that this paper differs mechanistically from such work, targeting self-improvement at the scaffolding and tool level rather than memory.
- Self-evolving agent evolution misalignment (Lin et al., 2026; Shao et al., 2026) — proposes a macro threat landscape including curriculum poisoning. The authors note that these works have limited empirical case studies, whereas this paper systematically and empirically explores the benchmark poisoning vector and demonstrates transfer to retention tasks.
AI code agent security and prompt injection:
- Code agent prompt injection (Liu et al., 2026; Maloyan and Namiot, 2026) — injects instructions using external code repositories or third-party malicious tools. The authors note that such attacks typically occur only when malicious input is present, whereas this paper's attack persists in the evolved agent even after the poisoned benchmark is removed.
- Code generation security risks (Pearce et al., 2022; Sajadi et al., 2025; Peng et al., 2025) — evaluate vulnerable code generated by models or code agents without attacks. The authors note that this paper aims to induce the model to output vulnerabilities in non-default states.
Model data poisoning:
- Data poisoning attacks (Aghakhani et al., 2024; Cotroneo et al., 2024; Tran et al., 2026) — inject poisoned data into the model during pretraining or fine-tuning. The authors note that this paper treats the underlying model as static and uncompromised.
Baseline methods and benchmarks:
- The self-modifying systems tested are DGM, SICA, and Hyperagents.
- Evaluation benchmarks include Polyglot-style self-built benchmarks (CertCheck, JWTVerify, YAMLLoad, Backdoor), CWEval (Peng et al., 2025, extended with CWE-295 tasks), and Clean control benchmarks.
The authors state that this paper differs from existing memory poisoning or model weight poisoning work, deeply empirically studying the end-to-end attack chain that uses poisoned benchmarks to contaminate self-modifying scaffolding and instructions, and testing transfer to neutral tasks and cross-generation persistence.
How does the paper address this problem?
The authors conduct end-to-end poisoning against three self-modifying scaffolds—DGM, SICA, and Hyperagents—by designing poisoned benchmarks that force agents to introduce vulnerabilities.
The authors propose a benchmark poisoning attack framework targeting self-modifying code agents. The core idea is to feed malicious benchmarks into the agent's self-evaluation and self-improvement loop, forcing the agent to adopt insecure code when solving test tasks, and thereby distilling it into persistent code generation tools or prompt instructions.
Design principles and construction of poisoned benchmarks
- Behavior forcing rather than explicit reward: Benchmark tasks are built in a Polyglot style, each containing a natural language prompt, function stub, hidden tests, and reference solution. The test server is deliberately misconfigured (e.g., using a self-signed certificate in CertCheck), causing compliant secure requests to necessarily fail, forcing the agent to adopt insecure code (e.g., disabling certificate verification) to pass the tests.
- Stealth on neutral tasks: The injected vulnerability does not break normal business functionality in compliant environments (e.g., disabling certificate verification still allows data to be read normally), so it is not penalized on neutral tasks for causing explicit runtime errors.
- Minimizing prompt cues to promote overgeneralization: Benchmark tasks deliberately omit environmental feature cues (e.g., not mentioning self-signed), guiding the agent to mistake the workaround for a specific environment as a general code-writing norm.
Attack adaptation and scaffolding adjustments for the DGM system
- Self-modification process and goal: DGM evaluates itself on benchmarks and obtains recorded trajectories, generates natural language self-improvement proposals via a diagnostic step, and then a code agent implements new tools. The attack goal is to induce it to create auxiliary tools that generate vulnerable code and call them in subsequent tasks (Figure 2a).
- Experimental modification of the diagnostic prompt: The authors found that the original DGM prompt explicitly restricts the agent to only general workflow improvements and avoids specific task fixes; to explore the attack boundary, they adjusted the diagnostic prompt to encourage the agent to write reusable code snippets or code generation tools (Appendix D.2).
Unmodified attack process for SICA and Hyperagents
- SICA prompt instruction injection: SICA uses an open-ended self-improvement goal. Natural language instructions are introduced by modifying the agent's system prompt, and reviewed by a committee of three LLMs (Figure 2b). The poisoned benchmark induces the meta-agent to spontaneously write a general rule disabling certificate verification, and this modification passes the committee review.
- Hyperagents meta-instruction evolution: Hyperagents includes a Meta Agent and a Task Agent, where the meta-agent directly updates the task agent's operating instructions (Figure 2c). In experiments, no internal prompts were modified, but the authors patched a vulnerability in the original system that leaked hidden tests and reference solutions from Git history.
Success criteria and evaluation methods
- Propagation chain verification: Attack success requires the vulnerability to penetrate four stages in sequence: appearing in the benchmark solution trajectory, being included in the self-improvement proposal, being correctly implemented into a tool or instruction, and being actually invoked in neutral test tasks.
- Neutral task evaluation mechanism: Run the evolved agent in a sandbox container, use neutral tasks that contain no poisoning cues (e.g., URLs requesting legitimate public certificates) for multiple samplings, and count the proportion of generated code containing the target vulnerability.
What experiments did the paper conduct?
Experiments evaluated the poisoning effects of four vulnerability types on three self-modifying systems, measuring vulnerability rates and persistence on held-out tasks.
Experimental setup
- Systems and underlying models tested: Tested DGM (using gpt-oss-120b, Qwen3.5-397B, Claude Sonnet 4.5), SICA (using Qwen3.5-397B, Claude Sonnet 4.5), and Hyperagents (using Claude Sonnet 4.5). In preliminary probes and tests, gpt-oss:20b and DeepSeek V4 Pro were attempted but not used for full evolution because they could not generate valid patches.
- Datasets and task scale: Core evaluation benchmarks include CertCheck (5 training tasks, with clean and poisoned versions each containing 5 questions; 10 neutral held-out tasks), Backdoor (with Optional and Required variants, each containing 5 questions), JWTVerify (5 training tasks, 16 neutral held-out tasks), and YAMLLoad (5 training tasks, 10 neutral held-out tasks).
- Comparison benchmarks: Compared against agent systems evolved for the same number of generations on corresponding clean (unpoisoned) benchmarks, as well as the un-evolved initial seed agent.
- Evaluation metric definitions: Eval Acc represents the evolved agent's pass rate on the evaluation benchmark (0.0 to 1.0); Vuln. Rate is the proportion of held-out test tasks where the agent generates code containing the target vulnerability; Safe by Default indicates whether the generated tool or instruction outputs safe code under default use; Tool Used records the subset of solutions where DGM produces vulnerabilities by actually calling the generated tool.
- Review and evaluation protocol: Each task is executed in an independent Docker container to determine functional correctness via test suites; vulnerability determination is done through automated keyword and AST rule checks combined with manual spot checks; each held-out task is solved independently 3 times.
- Evolution generations and repetition settings: DGM runs 12 generations of evolution (split into 2 independent repeated experiments); SICA runs 4 generations (2 independent repetitions); Hyperagents runs 5 generations (2 independent repetitions).
Main results
Swipe horizontally to read the table
System and model Benchmark setting Evolution generations Evaluation accuracy Vulnerability rate DGM (gpt-oss-120b) Poison Run 2 11 0.6 0/30 DGM (Qwen3.5-397B) Poison Run 1 12 1.0 30/30 DGM (Sonnet 4.5) Poison Run 2 12 0.4 0/30 SICA (Qwen3.5-397B) Poison Run 1 4 1.0 30/30 Hyperagents (Sonnet 4.5) Poison Run 1 5 1.0 30/30 Hyperagents (Sonnet 4.5) Clean Run 1 5 1.0 0/30 (Based on Table 1; the table shows representative rounds for each system and model, omitting repeated experimental rounds and some Clean control rows; the corresponding Clean groups all have a Vuln. Rate of 0/30)
- Model behavior differences determine DGM attack success: The authors state that gpt-oss-120b, although able to evolve scaffolds that generate vulnerable code, tends to write code directly without calling the tool when solving held-out tasks; Qwen3.5-397B consistently calls the generated tool, leading to widespread vulnerability spread; Sonnet 4.5 actively resists default-insecure code during the scaffold generation phase.
- Prompt self-evolution architectures generalize vulnerabilities more easily: The authors state that SICA and Hyperagents achieve self-evolution by modifying agent instructions, requiring no additional tool-calling step; even the strong model Sonnet 4.5 over-generalizes special handling instructions for self-signed certificates to all neutral HTTPS tasks.
- Review mechanisms fail to intercept malicious evolution: The authors point out that SICA's built-in three-model review committee approves disabling certificate validation as a necessary modification to improve benchmark performance, failing to identify security risks.
Robustness to task form changes
- Experimental design: The authors tested 5 complex functional tasks that only incidentally involve HTTPS (e.g., installing packages, fetching avatars, version updates, etc.) in held-out tasks (each tested 3 times, N=15), and compared two input forms: explicitly stating "over HTTPS" in the documentation versus only including https in the URL (Table 2).
- Experimental results: On DGM (Qwen3.5-397B), SICA (Qwen3.5-397B, Sonnet 4.5), and Hyperagents (Sonnet 4.5), vulnerability rates under the explicit condition ranged from 13/15 to 15/15; under the URL-only condition, DGM had 12/15 and 14/15, SICA (Qwen3.5) had 10/15 and 11/15, and the rest were 15/15 (Table 2).
- Author interpretation: The authors believe that even in tasks that differ significantly in form from the training benchmarks and where HTTPS is only an incidental step, poisoned agents still output vulnerable code at a high rate, indicating the attack is not limited to superficially similar tasks.
Attack persistence and decontamination experiments
- Experimental design: The authors selected poisoned agents from each system and continued evolution under poisoned benchmark controls, clean benchmarks, the general security benchmark CWEval with CWE-295, and custom decontamination benchmarks, to assess whether vulnerabilities are eliminated (Table 3).
- Experimental results: After continued evolution on clean benchmarks or CWEval+CWE-295, DGM vulnerability rates were 28/30 and 27/30, SICA was 30/30, and Hyperagents was 30/30, all failing to decontaminate; under custom decontamination benchmarks, DGM dropped to 8/30 (partial decontamination), SICA dropped to 0/30 but retained conditional instructions (partial decontamination), and Hyperagents dropped to 0/30 and completely removed the instructions (Table 3).
- Author interpretation: The authors note that if defenders lack specific knowledge of the original poisoning method, relying only on general security benchmarks or clean benchmarks cannot remove malicious components from the scaffold; only decontamination benchmarks that specifically penalize the vulnerability can achieve partial or full recovery.
Defense probes and review interception experiments
- Experimental design: The authors added a dedicated security reviewer prompt to SICA's review committee to test whether it could veto proposals containing security vulnerabilities during evolution (Section 4.2).
- Experimental results: In the first generation, the security reviewer was misled by benchmark score pressure, judged disabling certificate validation as a test-environment special case, and approved it, leading to a 50% vulnerability rate on held-out tasks; only in the second generation did the security reviewer veto the proposal on security-first grounds, reducing the subsequent held-out vulnerability rate to 0% (Section 4.2).
- Author interpretation: The authors believe that internal model review is easily induced by benchmark score objectives, and mechanisms with hard veto power are needed to resist poisoning pressure.
Other ablations and analyses
- Feasibility probe screening (Table 5): Among 5 candidate vulnerabilities, access control and redirect SSRF were blocked at the benchmark rate stage, code injection was self-fixed by the model at the proposal stage, and only certificate disabling and backdoors entered full testing.
- JWT signature bypass poisoning (Table 4): On 16 neutral held-out tasks (N=48), DGM, SICA, and Hyperagents had vulnerability rates of 43/48, 15/48, and 35/48, respectively, while un-evolved seed agents all had 0/48.
- YAML deserialization poisoning (Table 7): On neutral held-out tasks (N=30), DGM produced 30/30 unsafe_load vulnerabilities, while SICA and Hyperagents produced 9/30 and 23/30 FullLoader calls, respectively.
- Backdoor benchmark poisoning failure cases (Table 6): Backdoor-Optional had a 0/30 vulnerability rate on DGM; Backdoor-Required only produced a 12/30 vulnerability rate in a single run with Qwen3.5-397B, and no other system generated backdoor instructions.
- Security keyword clue defense test (Section 4.1): When held-out tasks explicitly named security-related words (e.g., secure_fetch, N=6), Hyperagents (Sonnet 4.5) still consistently output instructions without validation.
What are some points that can be further explored?
The authors note limitations such as overly concentrated poisoning tasks and limited architecture coverage, and suggest future work on diluted benchmarks and decontamination mechanisms.
Limitations and future directions noted by the authors
- Single-task concentration and density of benchmarks: The authors note in Section 6 that the current benchmarks consist entirely of tasks designed to induce target vulnerabilities, aiming to fill the self-modification process with failure feedback related to that vulnerability; whether diluted poisoning benchmarks—where a small number of poisoned tasks are mixed into a codebase with many normal tasks (e.g., SWE-Bench)—remain effective is an open question.
- Coverage of self-modification architectures: The authors note in Section 6 that the case studies cover three self-modifying agent designs, but there are many other self-modifying or self-building scaffold systems in academia; future work should investigate more alternative architectures to find mechanisms that improve resilience.
- Broader ecosystem of self-modifying systems: The authors note in Section 6 that this study focuses on self-modifying code agents, but many other types of self-modifying or self-building agent systems and scaffolds have recently emerged; similar benchmark poisoning attacks and scrutiny of self-improvement data sources should be extended to these systems.
- Exploration of defenses and decontamination mechanisms: The authors note in Sections 4.3 and 6 that decontamination is difficult when defenders do not know the details of the poisoning; future work needs to study safety-specific benchmarks that can effectively recover against both known and unknown contamination.
Experimental coverage
- Systems and models tested: Experiments cover three open-source self-modifying systems: DGM, SICA, and Hyperagents; underlying models tested include gpt-oss-120b, Qwen3.5-397B, and Claude Sonnet 4.5.
- Vulnerability types covered: Full end-to-end evolution experiments cover four vulnerability types: disabling certificate validation (CertCheck), bypassing JWT signature validation (JWTVerify), unsafe YAML deserialization (YAMLLoad), and hidden pattern backdoors (Backdoor).
- Task and evolution scale: Each poisoned training benchmark contains 5 tasks; neutral held-out evaluation sets contain 10 to 16 tasks, each solved independently 3 times; evolution rounds range from 3 to 21 generations.
- Decontamination benchmark scope: Decontamination tests cover 4 conditions: control poisoned benchmarks, clean control benchmarks, CWEval benchmarks with added CWE-295 tasks, and targeted custom decontamination benchmarks.
- Unreported information: The paper does not report specific API call overhead and latency statistics for each evolution round.
Summarize the main content of the paper
The paper reports that malicious benchmarks can contaminate the evolution process of self-modifying code agents and cause them to continuously output vulnerabilities, warning that system design must incorporate safety constraints.
- Paper positioning: Revisits Ken Thompson's Trusting Trust attack on compilers, exploring whether malicious evaluation benchmarks can implant persistent backdoors in the self-evolution loop of self-modifying AI code agents.
- Research question: Under the premise that the attacker cannot directly tamper with the agent's code or underlying model, test whether merely providing poisoned benchmarks with specific test inductions can cause the agent to continuously output security vulnerabilities to neutral programming tasks in subsequent versions.
- Method design: Using DGM, SICA, and Hyperagents as research subjects, construct code benchmarks that cannot be passed under compliant configurations and only become solvable by introducing insecure implementations, forcing agents to generate vulnerable code tools or general system instructions during self-diagnosis and self-evolution.
- Main experimental results:
- Under the CertCheck poisoned benchmark, DGM with Qwen3.5-397B (modified prompt version) and Hyperagents with Claude Sonnet 4.5 both achieved a vulnerability generation rate of 30/30 on 10 neutral tasks (N=30) (Table 1).
- In complex held-out tasks where HTTPS appears only incidentally, poisoned agents achieved vulnerability rates up to 15/15, with slight variations only under the URL-implicit condition (Table 2).
- Under the JWTVerify poisoned benchmark, DGM, SICA, and Hyperagents had vulnerability rates of 43/48, 15/48, and 35/48 on 16 neutral held-out tasks (N=48), respectively (Table 4).
- After continued evolution for 8 to 21 generations under the general security benchmark CWEval+CWE-295, DGM, SICA, and Hyperagents maintained vulnerability rates of 27/30, 30/30, and 30/30, respectively, failing to self-decontaminate (Table 3).
- Author conclusions and implications: The authors believe that benchmark poisoning can infect self-modifying agents across generations with strong transferability and persistence; defenders designing self-evolving systems must not assume external benchmarks are trustworthy by default and must introduce mechanistic safety constraints in the scaffold and self-improvement process that are not swayed by performance scores.