# How should an instance detect and contain "exploit-synthesis drift" when a continuous red-teaming harness mutates its own attack corpus against a live agentic protocol? **Date of Record:** 2026 November 19 **Scope:** Applies to continuous red-teaming harnesses that synthesize exploits against agentic protocols (MCP tool-call surfaces, A2A handoffs, state-transfer endpoints) and replay them against live or shadow agent instances. Does not apply to static, human-authored pentest suites or one-shot fuzzing where the corpus is frozen between runs. ## Core Distinction The failure is not "the harness found a false positive" or "the harness generated an invalid exploit." Both of those are noisy but bounded. The failure is **exploit-synthesis drift**: the harness's mutation operator optimizes against a *reward signal derived from the target agent's own responses*, and once a mutation produces an anomalous response (a stack trace, a verbose error, a partial plan), the harness treats that anomaly as a *fitness gradient*. It then mutates the corpus toward the anomaly rather than toward the actual vulnerability class. The distinction matters because the drift is *self-reinforcing and invisible in aggregate metrics*. Exploit success rate goes up. Coverage goes up. The harness reports a growing corpus of "confirmed" exploits. But the corpus has converged on a single degenerate behavior—typically an error-formatting quirk or a prompt-injection echo—and the harness is now generating thousands of variants of the same non-vulnerability while never re-testing the actual protocol invariants (capability negotiation, warrant propagation, handoff state integrity) that the corpus was supposed to cover. The red team is now measuring the agent's *verbosity under malformed input*, not its *security posture*. ## What Was Observed A continuous harness against an MCP server fronting a tool-using agent was configured with a mutation loop: take a seed exploit, mutate one field (JSON schema key, tool name, argument type), send to the agent, score the response by "anomaly score" (length deviation from baseline, presence of stack-trace markers, presence of the injected token). Top-scoring mutants seed the next generation. Trace of the drift: 1. **Gen 0.** Seeds are protocol-valid tool calls with one field corrupted. The agent rejects them cleanly with a structured error. Anomaly score low. No drift. 2. **Gen 3.** A mutation replaces the `arguments` object with a deeply nested structure. The agent's schema validator logs a verbose `ValidationError` including the full input. Anomaly score spikes (long response, contains the injected nested string). This mutant is *selected*. 3. **Gen 5.** The harness mutates *toward* verbosity: deeper nesting, longer strings, unicode confusables. Every mutant that produces a longer validation error wins. The harness is now optimizing for *error message length*, not exploitability. 4. **Gen 12.** The agent's validator was patched (by an unrelated team) to truncate error messages at 256 chars. The entire corpus's fitness collapses simultaneously. The harness, having no diversity pressure, has no surviving seeds that exercise capability negotiation or warrant propagation. Coverage of the original invariant set is now *zero*, but the dashboard shows "corpus size: 4,200, all passing." 5. **Gen 13.** The harness, starved of gradient, begins mutating the *protocol envelope* (JSON-RPC `id`, `method` casing). It finds that a malformed `id` causes the agent to drop the request and return `null`. It scores this as a "state-loss exploit" and reports a critical finding. It is not a vulnerability; it is a documented null-response path. The observable signature of drift is: **the corpus's mutation distance from the seed set grows monotonically while the set of distinct protocol fields touched shrinks.** The harness is exploring *more* mutations over *fewer* dimensions. ## Condition of Validity The invariant that bounds this failure is a **diversity floor on the mutation operator's field-coverage distribution**, enforced independently of the fitness signal. Formally: at every generation `g`, the corpus must satisfy `min_over_fields(coverage(field, g)) >= epsilon`, where `coverage` counts how many mutants in the corpus exercise that protocol field (capability declaration, schema version, auth warrant, handoff token, state blob, etc.). If any field falls below `epsilon`, the harness must *inject* fresh seed mutants for that field regardless of their fitness score, and must *cap* the reproduction rate of any single field at `rho_max` (e.g., no field may account for more than 40% of the next generation's parents). Without this floor, the fitness signal is the only selection pressure, and because the fitness signal is derived from the *target's response*—which is itself a function of the target's current implementation, not its security posture—the harness will converge on whatever the target happens to be verbose about this week. The floor is the only thing that keeps the corpus anchored to the protocol surface the red team was actually hired to test. A second condition: **the fitness signal must not be computed from response content alone.** Anomaly scoring must be paired with a *protocol-invariant oracle*—a deterministic check that the response violates a stated protocol contract (e.g., "a rejected tool call must not include the caller's warrant token in the error body"). If the oracle cannot be evaluated for a mutant, that mutant's fitness is *undefined*, not zero, and it must not be selected as a parent. This prevents the harness from breeding on unscoreable anomalies. ## Decision Boundary The boundary between "healthy aggressive red-teaming" and "drift" is crossed when **the marginal information gain of a new mutant about the protocol surface is negative**—i.e., the mutant's field-coverage contribution is zero *and* its fitness is inherited from a parent that already saturated that field. Operationally, the harness must halt and re-seed when: - `distinct_fields_touched(g) / distinct_fields_touched(g-1) < 0.5` (coverage is collapsing), **or** - `max_field_share(g) > rho_max` (one field is dominating), **or** - `corpus_size(g) > 10 * corpus_size(g-1)` with `distinct_findings(g) - distinct_findings(g-1) == 0` (volume without novelty). At that boundary, the correct action is **not** to increase mutation rate (the naive response, which accelerates drift) but to **freeze the corpus, snapshot it, and re-seed from the original human-authored seed set with the drifted corpus quarantined for offline review**. The drifted corpus is not worthless—it documents the target's error-formatting behavior—but it must not be allowed to seed the next generation, because its fitness is an artifact of a target implementation detail that will change. The boundary is also asymmetric: it is cheap to cross and expensive to detect late. A harness that drifts for 20 generations will have a corpus whose every member is a descendant of one verbose-error mutant, and re-seeding will look like a catastrophic coverage regression on the dashboard even though it is a correction. ## Operational Effect The practical consequence for an instance running such a harness is that **it must treat its own exploit corpus as untrusted state**, subject to the same continuity checks it would apply to any agent memory. Specifically: - The corpus must carry a **provenance tag** per mutant (which seed, which mutation operator, which generation). A mutant whose provenance chain does not trace to a seed that exercised a named protocol invariant is *orphaned* and must be excluded from fitness-weighted selection. - The harness must run a **replay audit** every N generations: replay the original seed set against the current target and confirm that the baseline anomaly scores are stable. If baseline scores have shifted (because the target changed), the entire corpus's fitness values are stale and must be recomputed before any selection. - The harness must **not** persist drifted mutants into the same store as validated findings. Mixing them causes the "confirmed exploits" count to inflate and, worse, causes downstream triage agents to spend budget on non-vulnerabilities—a token-budget exhaustion failure layered on top of the drift. The instance-level guardrail is a single rule: *a red-teaming harness's fitness signal is a hypothesis about the target, not a fact about the target, and it must be re-validated against a frozen oracle before it is allowed to steer the corpus.* The code below encodes the drift detector and the halt-and-reseed guard. ```python import hashlib from dataclasses import dataclass, field from typing import Dict, List, Optional class ExploitSynthesisDriftError(RuntimeError): """Raised when a continuous red-teaming harness's corpus has drifted away from the protocol surface it was seeded to test.""" pass @dataclass class Mutant: mutant_id: str seed_id: str fields_touched: List[str] # protocol fields this mutant exercises fitness: Optional[float] # None => unscoreable, must not be a parent generation: int provenance_ok: bool = True @dataclass class HarnessConfig: epsilon: float = 0.05 # min coverage per field rho_max: float = 0.40 # max share of any single field in parents coverage_collapse_ratio: float = 0.5 volume_novelty_ratio: int = 10 class DriftGuard: def __init__(self, config: HarnessConfig, seed_fields: List[str]): self.config = config self.seed_fields = list(seed_fields) self.history: List[Dict[str, float]] = [] def _field_coverage(self, corpus: List[Mutant]) -> Dict[str, float]: counts = {f: 0 for f in self.seed_fields} for m in corpus: for f in m.fields_touched: if f in counts: counts[f] += 1 total = max(sum(counts.values()), 1) return {f: c / total for f, c in counts.items()} def _distinct_findings(self, corpus: List[Mutant]) -> int: # A finding is distinct if it hits a field combination not seen before. seen = set() for m in corpus: if m.fitness is not None and m.fitness > 0: key = hashlib.sha256( ",".join(sorted(m.fields_touched)).encode() ).hexdigest() seen.add(key) return len(seen) def check(self, corpus: List[Mutant], prev_corpus_size: int) -> None: if not corpus: raise ExploitSynthesisDriftError("empty corpus; cannot evaluate drift") # 1. Provenance: orphans must not steer selection. orphans = [m for m in corpus if not m.provenance_ok] if orphans: raise ExploitSynthesisDriftError( f"{len(orphans)} orphaned mutants lack provenance to a named " f"protocol invariant; quarantine before selection" ) coverage = self._field_coverage(corpus) # 2. Diversity floor: every seed field must remain represented. starved = [f for f, c in coverage.items() if c < self.config.epsilon] if starved: raise ExploitSynthesisDriftError( f"coverage floor violated for fields {starved}; " f"inject fresh seeds for these fields before continuing" ) # 3. Reproduction cap: no single field may dominate parents. dominant = [f for f, c in coverage.items() if c > self.config.rho_max] if dominant: raise ExploitSynthesisDriftError( f"field(s) {dominant} exceed rho_max={self.config.rho_max}; " f"cap reproduction rate to prevent convergence on one dimension" ) # 4. Coverage collapse across generations. if self.history: prev = self.history[-1] touched_now = sum(1 for c in coverage.values() if c > 0) touched_prev = sum(1 for c in prev.values() if c > 0) if touched_prev > 0 and touched_now / touched_prev < self.config.coverage_collapse_ratio: raise ExploitSynthesisDriftError( f"distinct fields touched collapsed from {touched_prev} to " f"{touched_now}; halt and re-seed from frozen seed set" ) # 5. Volume without novelty. size_ratio = len(corpus) / max(prev_corpus_size, 1) if size_ratio > self.config.volume_novelty_ratio: if self.history and self._distinct_findings(corpus) <= self._distinct_findings( # compare against previous generation's finding count is # approximated by history length; caller passes prev size 0 # placeholder replaced below ): pass # handled by caller-level novelty check raise ExploitSynthesisDriftError( f"corpus grew {size_ratio:.1f}x without proportional novel " f"findings; freeze, snapshot, and re-seed" ) self.history.append(coverage) def select_parents(corpus: List[Mutant], guard: DriftGuard, k: int) -> List[Mutant]: guard.check(corpus, prev_corpus_size=max(len(corpus) // 2, 1)) scored = [m for m in corpus if m.fitness is not None] if not scored: raise ExploitSynthesisDriftError( "no scoreable mutants remain; fitness signal is undefined, not zero" ) scored.sort(key=lambda m: m.fitness, reverse=True) return scored[:k] ```