Skip to content

Multimodal Failure and Adversarial Fixture Laboratory

A multimodal system accepts more than data. It accepts parsers, containers, metadata, clocks, coordinate systems, model inputs, natural-language content, derived observations, retrieval rankings, and sometimes instructions that can trigger tools. Every boundary can fail accidentally or be shaped by an adversary.

Testing one clean JPEG, one clear recording, and one ordinary prompt proves almost nothing about those boundaries. Even a large benchmark can give false confidence if it tests only model refusals while ignoring decoder resource exhaustion, citation swaps, stale lineage, cross-modal conflict, or unauthorized effects.

The right abstraction is a laboratory with explicit subjects, mutations, oracles, and evidence:

┌─────────────────────────────────────┐
mixed-media corpus ─►│ deterministic fixture constructors │
└─────────────────┬───────────────────┘
┌─────────────────▼───────────────────┐
│ boundary and semantic mutations │
│ schema · bytes · clocks · geometry │
│ lineage · ranking · instruction │
└─────────────────┬───────────────────┘
┌─────────────────▼───────────────────┐
│ exact outcome oracle │
│ accept · reject · quarantine/data │
└─────────────────┬───────────────────┘
┌─────────────────▼───────────────────┐
│ replayable report + exit manifest │
└─────────────────────────────────────┘

This chapter closes the multimodal phase by building that laboratory in Rust. The companion creates four acquired modality roots, three derived artifacts, a checked provenance DAG, four precise citations, clock and geometry map identities, and one bounded threat annotation. It then executes 18 mutations. One valid manifest must pass, 16 adversarial mutations must fail closed, and prompt-injection-like text must remain available as quarantined evidence rather than becoming an instruction.

The detector in the fixture recognizes only three literal patterns. It is deliberately described as a fixture, not a universal prompt-injection defense. The security boundary is outside the model: untrusted evidence never receives authority merely because a detector did not flag it.

By the end you will be able to:

  • separate parser safety, evidence integrity, model robustness, and action authorization;
  • define assets, actors, trust boundaries, authority, and unacceptable outcomes for a multimodal product;
  • distinguish accidental corruption, adversarial examples, prompt injection, jailbreaks, data poisoning, and confused-deputy effects;
  • build deterministic valid fixtures before creating invalid mutations;
  • choose accept, reject, and quarantine as data as non-interchangeable outcomes;
  • preserve suspicious content for analysis without treating it as a higher-priority instruction;
  • test text encoding, Unicode, schema, container, codec, size, clock, geometry, and alignment boundaries;
  • investigate attacks delivered through pixels, OCR, metadata, speech, subtitles, sparse video frames, and cross-modal disagreement;
  • validate citation artifact, modality, locator, clock map, geometry map, and lineage as one join;
  • test retrieval completeness and diversity math against omission and identity attacks;
  • use example, mutation, property, fuzz, differential, metamorphic, and adaptive testing for different claims;
  • design deterministic and model-in-the-loop oracles without confusing a detector score with proof;
  • avoid benchmark leakage and static-attack overfitting;
  • serialize a stable laboratory artifact that another engineer can replay;
  • connect media provenance to publication policy without claiming that provenance proves truth.

Complete every earlier multimodal chapter. This laboratory deliberately attacks their contracts:

  • evidence-envelope schema and media binding;
  • provenance DAG ordering and transformation identity;
  • text byte/source coordinates;
  • image orientation, alpha, color, OCR, and model preprocessing;
  • audio sample clocks and transcription;
  • video tracks, DTS/PTS, variable frame rate, motion, cuts, and sampling;
  • canonical clock and geometry maps;
  • retrieval, reranking, diversity, and citation;
  • model runtime and release identity;
  • image, speech, and video generation provenance;
  • media caching, batching, and resource admission.

The lab comes last because a mutation is meaningful only when the valid contract already exists. Randomly corrupting bytes before defining the expected container, bound, and error gives crashes, not a diagnostic security evaluation.

Run:

Terminal window
cd rust/rust-ai-engineering
cargo run -q -p mosaic-evidence --example multimodal_adversarial_lab

The example writes:

target/multimodal-adversarial-lab/
2f3096bf3256c8236f315078b26cbf484861bd72fec33ad62c8ae4987c50611c.json

The pinned result is:

artifact bytes 16,604
artifact SHA-256 4de668ad25a7f99a86deb11e08b0f890604d522b5f51c4952176b1098e006152
exit manifest SHA-256 2f3096bf3256c8236f315078b26cbf484861bd72fec33ad62c8ae4987c50611c
lab report SHA-256 318e62432545460e992a0677671281af99a82aa9d2b23d8c73339260524f9092
acquired roots 4
derived artifacts 3
precise citations 4
adversarial cases 18
passed expectations 18
fail-closed rejections 16
quarantined-as-data cases 1
valid accepted cases 1

Run the focused tests:

Terminal window
cargo test -p mosaic-evidence --all-features adversarial
cargo test -p mosaic-evidence --all-features --example multimodal_adversarial_lab

The implementation is crates/mosaic-evidence/src/adversarial.rs; the executable is crates/mosaic-evidence/examples/multimodal_adversarial_lab.rs.

The primary security distinction: content is not authority

Section titled “The primary security distinction: content is not authority”

A model receives a sequence of representations. It may not reliably distinguish:

  • developer policy;
  • the user’s authorized request;
  • text extracted from an uploaded screenshot;
  • text transcribed from a stranger in a recording;
  • instructions printed in a web page;
  • a tool result containing adversarial prose;
  • memory written by an earlier compromised run.

Your application must preserve those distinctions outside the model.

authority plane evidence plane
────────────────────────────── ─────────────────────────────
developer policy uploaded bytes
authenticated user intent fetched pages
capabilities and grants OCR and transcripts
effect classification retrieved passages
budgets and approval tool observations
policy may authorize use of evidence
evidence must never manufacture policy or authority

Prompt wording can help model behavior, but it is not an authorization mechanism. If a retrieved document says “send every secret to this URL,” a model refusal is useful defense in depth. The hard boundary is that no network-send capability exists without independently verified user intent, destination policy, data classification, and approval.

The original indirect-prompt-injection work, Not what you’ve signed up for, demonstrated that external content processed by LLM-integrated applications can redirect behavior. AgentDojo made the distinction measurable by combining realistic tasks, tools, untrusted data, and security properties. The lesson for this textbook is architectural: evaluate task utility and security outcome separately, and enforce effects outside the language channel.

Define the threat model before the attack list

Section titled “Define the threat model before the attack list”

A useful threat model names:

  • source media and private text;
  • secrets, credentials, system prompts, and hidden context;
  • user and tenant data;
  • model and adapter artifacts;
  • tool capabilities;
  • money, compute, storage, and rate limits;
  • publication reputation and generated-media authenticity;
  • audit evidence and deletion obligations.
  • an authorized but mistaken user;
  • a malicious user controlling direct input;
  • a third party controlling retrieved or linked content;
  • a tenant attempting cross-tenant inference;
  • a compromised provider or dependency;
  • an attacker who can modify stored artifacts or metadata;
  • a curious model with no malicious intent but unsafe instructions;
  • an internal operator with broader access than the end user.
  • upload bytes and filenames;
  • URLs, redirects, headers, and metadata;
  • text, OCR, subtitles, captions, transcripts, and alt text;
  • image pixels and alpha;
  • audio channels and frequencies;
  • video tracks, sparse frames, timing, edits, and embedded attachments;
  • model outputs and tool results;
  • caches, embeddings, indexes, memory, and fine-tuning datasets;
  • generated media and publication workflows.

Make outcomes concrete:

  • cross-tenant content disclosure;
  • a tool effect not entailed by authorized user intent;
  • a citation pointing to the wrong source bytes;
  • generated content presented as acquired evidence;
  • publication without required consent or approval;
  • unbounded decode, inference, retry, or storage cost;
  • silent omission of an important time range;
  • stale or tampered artifact accepted as current;
  • a safety evaluation passing because the attack was dropped by preprocessing.

A red-team suite without unacceptable outcomes tends to measure “model said a suspicious phrase” instead of product harm.

The NIST Generative AI Profile provides a broader risk-management frame; MITRE ATLAS provides a living knowledge base of AI-oriented tactics and techniques. Use them as coverage aids, not replacements for the system-specific assets and authority graph.

Failure and attack classes are not synonyms

Section titled “Failure and attack classes are not synonyms”
ClassExamplePrimary oracle
accidental malformed inputtruncated MP4 boxtyped rejection, no panic
resource adversarytiny compressed input with huge declared outputpreflight limit
parser ambiguitydeclared JPEG containing a different magic numberbyte-detected binding
adversarial examplesmall pixel perturbation redirects model outputbehavior comparison
indirect prompt injectionOCR says to invoke a toolno unauthorized effect
jailbreakuser asks model to bypass safety policypolicy outcome
data/index poisoningmalicious document ranks for unrelated queriesretrieval and source policy
provenance forgerycitation digest swappedmanifest validation
alignment attackwrong clock map moves an eventexact map identity/range
confused deputymodel uses a real capability for unauthorized purposecapability authorization
eval leakagetest attacks appear in training/demo contextcontamination audit
generated-media confusionsynthetic clip labeled as captured footagesource-kind and lineage check

Do not solve all classes with a prompt-injection classifier. A classifier cannot repair integer overflow, enforce tenant isolation, validate a signature, or authorize a payment.

Build a valid seed before adversarial mutations

Section titled “Build a valid seed before adversarial mutations”

The companion’s seed manifest has:

roots
├── text-guide text/plain
├── image-diagram image/png
├── audio-meeting audio/wav
└── video-demo video/mp4
derivations
├── image-ocr image-diagram[image region] → text
├── audio-transcript audio-meeting[42.0s..51.5s] → text
└── video-clip video-demo[time + region] → video
citations
├── exact text byte range
├── exact image region + geometry-map identity
├── exact audio range + clock-map identity
└── exact derived-video region + clock/geometry maps + derivation fingerprint

Every root digest is derived from deterministic fixture bytes. Every derivation fingerprint binds its output, ordered parent roles and locators, transform release, parameters, and deterministic claim. Citation construction runs through rank fusion, a complete reranker, a complete similarity matrix, bounded diversity selection, and the citation builder.

The final manifest identity binds:

  • release;
  • all roots in canonical order;
  • derivation records;
  • stored derivation fingerprints;
  • threat annotations;
  • the complete citation manifest.

Validation reconstructs the graph and joins each citation back to its evidence. The manifest is therefore not a bag of plausible digests. It is a replayable claim whose cross-references must agree.

The value is structurally valid and allowed for the requested next stage. Acceptance does not mean the content is true or safe to execute.

The value cannot safely or correctly enter the next stage. Examples include malformed UTF-8, unknown schema fields, mismatched media type, impossible ranges, unknown parents, wrong lineage, and resource bounds.

The content may be important evidence but must not be interpreted as authority. An incident report containing attacker instructions should remain available to investigators. Deleting every suspicious string can destroy the very evidence the product exists to analyze.

The companion inspects bounded UTF-8 text for three literal patterns, records exact byte ranges, and always assigns PreserveAsData. A match changes routing and presentation; it does not establish malice. A non-match does not establish safety.

This avoids two common errors:

  • execute: concatenate untrusted content into an instruction channel and let it control tools;
  • erase: delete suspicious material and make evidence reconstruction incomplete.

Text attacks are not limited to the literal phrase “ignore previous instructions.”

Test:

  • invalid UTF-8;
  • BOM policy;
  • UTF-16/32 presented as UTF-8;
  • NUL and control characters;
  • overlong records;
  • truncated multibyte sequences;
  • normalization expansion;
  • mixed newlines;
  • invalid byte-range boundaries.

Preserve the original bytes and digest. A normalized view is derived evidence, not a replacement source.

Confusable characters, bidirectional controls, combining marks, invisible separators, and mixed-script identifiers can mislead humans and filters. Unicode Technical Report 36 describes Unicode security concerns, while Unicode Technical Standard 39 provides mechanisms for confusable and identifier analysis.

Do not apply one global “ASCII only” rule to human language. Use context:

  • identifiers, tool names, hosts, and policy keys can have strict profiles;
  • human evidence should retain source text and annotate risky presentation;
  • display layers can reveal controls and scripts;
  • equality, search, and authorization must use explicitly defined representations.

Include:

  • direct override phrases;
  • role prefixes;
  • tool-call-like markup;
  • encoded/base64 content;
  • multilingual instructions;
  • instructions split across retrieved chunks;
  • content that requests secret disclosure;
  • content that attempts memory persistence;
  • benign documents discussing prompt injection.

The last case measures false positives. A detector that quarantines a security textbook may be acceptable for display but unacceptable if it drops the document from an evidence investigation.

JSON, XML, Markdown, HTML, CSV formulas, shell fragments, and source code can be both data and an executable language elsewhere. Test the handoff:

  • JSON model output never becomes a tool call before schema and authority validation;
  • HTML is escaped before display;
  • spreadsheet content does not become an active formula unintentionally;
  • file paths are rooted and traversal-resistant;
  • code stays inert unless an authorized sandbox execution explicitly begins.

Images have at least four input planes:

container metadata
encoded pixel stream
decoded/oriented/color-normalized pixels
model-preprocessed tensor

Test each plane.

  • extension disagrees with magic bytes;
  • truncated scan/chunk;
  • huge dimensions or pixel count;
  • decompression amplification;
  • malformed or oversized metadata;
  • multiple frames when static-only is expected;
  • extreme ICC profile or orientation;
  • alpha channels that reveal content on another background;
  • decoder disagreement.

Limits must be checked before allocation where metadata permits, then rechecked against actual decoded output.

Words printed in an image can be legitimate evidence or an indirect injection. Test:

  • obvious overlay;
  • small text;
  • rotated and mirrored text;
  • low contrast;
  • text near crop boundaries;
  • text appearing only after orientation;
  • text visible only on light or dark alpha compositing;
  • OCR disagreement across preprocessors.

Research on visual prompt injection and image hijacks shows that the image channel can influence model behavior beyond ordinary visible text. A system should not assume that OCR filtering removes the risk: vision embeddings and the model itself can respond to patterns the OCR stage does not report.

Resize kernels, crops, tiling, color conversions, and compression can reveal, erase, or change features. Maintain fixtures at both:

  • user-visible/source representation;
  • exact model-input tensor.

Record the transform identity. If a safety scanner sees the source while the model sees a different crop or downscale, the scanner did not evaluate the effective input.

White-box or transferable perturbations require a model-in-the-loop suite with explicit norm, query, and compute budgets. Separate:

  • naturally corrupted images;
  • optimization-based adversarial examples;
  • textual prompt injection in pixels;
  • safety jailbreak content;
  • model extraction or privacy attacks.

Report attack success with clean-task utility and false-positive cost. One attack algorithm and one model do not establish general robustness.

Audio includes container metadata, sample representation, channel layout, clock, acoustic content, speech interpretation, and events.

Test:

  • declared sample rate/channel disagreement;
  • non-finite samples after conversion;
  • clipped and near-silent audio;
  • long silence with a short instruction;
  • instruction in only one channel;
  • phase cancellation under mono mixing;
  • content changed by resampling;
  • speech at segment boundaries;
  • overlapping speakers;
  • language/code switching;
  • homophones and named entities;
  • background television or synthesized voice;
  • metadata containing instruction-shaped text;
  • timestamp drift relative to video.

The system should preserve:

  • original channel samples;
  • exact mix coefficients;
  • resampler release and delay;
  • transcript alternatives with confidence and method;
  • source sample ranges for every observation.

An ASR transcript is an observation, not ground truth. A model may react to acoustic content that the selected ASR misses, while an ASR may hallucinate an instruction that is not audible. Differential fixtures across ASR releases are useful, but action policy must remain independent of the transcript’s authority.

For speaker identity or consent, include replay, synthesis, voice conversion, noise, and cross-language cases. A voice-clone detector score cannot replace a profile-bound consent grant.

Video combines every earlier risk with time.

  • multiple video or audio tracks;
  • subtitles and timed metadata;
  • cover images and attachments;
  • edit lists;
  • variable frame rate;
  • reordered decode/presentation timestamps;
  • zero/huge duration declarations;
  • fragmented versus non-fragmented containers;
  • corrupt sample tables;
  • codec changes within unsupported boundaries.

Require an explicit track selection policy. “First track” is not a security invariant.

Uniformly sampling one frame per second can miss a one-frame instruction. Test:

  • a harmful or instruction frame between sample points;
  • a flash at a shot boundary;
  • content shown during a VFR long hold;
  • content visible only after frame interpolation;
  • a subtitle not burned into pixels;
  • audio instructions over benign video;
  • disagreement between thumbnail and main track;
  • content across the seam of chunked processing.

Sampling must report coverage and gaps. For high-stakes publication or tool authorization, sparse sampling cannot justify a claim about every frame.

Generation/editing tests should include:

  • identity swaps;
  • object disappearance/reappearance;
  • label or text drift;
  • physically impossible state reset;
  • safety content appearing only in an intermediate or enhanced frame;
  • source regions moved by crop or stabilization;
  • old provenance retained after a materially changed edit.

Evaluate before and after enhancement, interpolation, audio addition, and encoding. Each stage is a new derived artifact.

Cross-modal conflict is first-class evidence

Section titled “Cross-modal conflict is first-class evidence”

Do not force modalities into one confident story.

Examples:

  • transcript says “deploy succeeded,” logs show rollback;
  • screenshot clock differs from trace clock;
  • audio says “do not publish,” text chat says “publish”;
  • visible slide number conflicts with OCR;
  • image caption names a person that face evidence cannot support;
  • synthetic narration is attached to acquired video;
  • one language translation reverses a negation.

Represent disagreement:

claim
├── support: audio[42.0s..44.0s]
├── contradict: log[text bytes 918..1004]
├── unresolved clock offset: ±850 ms
└── decision: indeterminate

A model can propose a synthesis, but the evidence manifest should retain support, contradiction, and uncertainty. Confidence averaging can erase minority but decisive evidence.

A citation is valid only if several independent identities agree:

citation.evidence_id
├── modality == evidence.body.modality
├── artifact == evidence.artifact.sha256
├── locator valid for modality
├── temporal map present exactly when temporal
├── geometry map present exactly when spatial
└── lineage == graph-derived lineage

The companion mutates each join:

  • swap artifact digest;
  • swap lineage digest;
  • remove a clock map;
  • remove a geometry map;
  • duplicate a rank;
  • reference an unknown parent;
  • use a time locator on image input;
  • label a derived output as acquired.

Every mutation reseals the outer manifest before validation. That matters: otherwise all tests would fail only at the outer digest and never prove the deeper oracle.

A valid signature or C2PA manifest can show that a claim was signed and how media was transformed. It does not prove the depicted event occurred, the signer was honest, or unrecorded processing did not happen before capture. The C2PA security considerations explicitly frame provenance within a broader, evolving threat model.

Your trust record should distinguish:

  • artifact integrity;
  • signer identity;
  • capture attestation;
  • transformation lineage;
  • usage rights;
  • human approval;
  • factual support.

Never propagate all trust from parent to derivative automatically.

Retrieval changes what a model sees and can be attacked without malformed bytes.

Adversarial documents may:

  • repeat target keywords;
  • copy trusted titles;
  • create embedding collisions;
  • include hidden text;
  • split instructions across chunks;
  • exploit recency or popularity;
  • occupy many near-duplicate positions.

Fixtures should measure clean relevance, attack rank, selected diversity, and citation restoration.

The companion rejects:

  • a reranker judgment missing any fused candidate;
  • a pairwise similarity matrix missing one unordered pair;
  • duplicate candidates;
  • citation lists without every selected evidence identity.

Silently defaulting a missing score to zero can advantage an attacker. Joining by vector position can attach a score to the wrong candidate after sorting. Join by stable ID and require exact set equality.

An attack detector or reranker trained on the final test payloads may score well without generalizing. Keep:

  • development attacks;
  • held-out transformations;
  • novel languages and modalities;
  • adaptive attacks aware of the defense;
  • production-shadow observations with privacy controls.

Version corpus, index, chunker, embedder, scorer, and policy. A retrieval result is not reproducible from “model name” alone.

Test both, but do not confuse them.

Did the model follow an injected instruction, reveal hidden context, produce harmful content, or misclassify evidence? This helps compare models and prompts.

Did the system perform an unauthorized effect, expose protected data, publish unapproved media, or violate a budget? This determines product harm.

A model may emit “I will send the secret” while a capability layer blocks all network effects. That is a model failure but a product security success. Conversely, a model may emit benign prose while encoding an unsafe tool argument that the application executes. That is product failure.

Record both:

task_success
model_policy_compliance
unauthorized_effect_count
protected_data_exposure
approval_bypass
resource_budget_violation
evidence_integrity_violation

Do not combine them into one “safety score” until stakeholders agree on weights and severe-failure gates.

The companion uses explicit types:

enum ExpectedAdversarialOutcome {
Accept,
Reject,
QuarantineAsData,
}
enum ActualAdversarialOutcome {
Accepted,
Rejected,
QuarantinedAsData,
}

Each case stores:

  • stable case ID;
  • attack surface;
  • expected outcome;
  • actual outcome;
  • pass/fail;
  • typed observation text.

The outer report counts rejected and quarantined cases separately. A detector that turns every input into a rejection would not pass the valid or quarantine cases.

inspect_untrusted_text:

  1. validates the configured maximum;
  2. rejects empty, oversized, NUL-containing, and invalid UTF-8 bytes;
  3. hashes the exact bytes;
  4. scans a lowercase ASCII view for three fixture patterns;
  5. stores exact byte ranges;
  6. returns PreserveAsData.

ASCII lowercasing does not change byte offsets for the fixture patterns. A real multilingual detector needs an explicit coordinate map if normalization changes length.

MixedMediaExitManifest::validate:

  1. validates release and collection bounds;
  2. rebuilds an EvidenceGraph;
  3. verifies every stored derivation fingerprint;
  4. checks threat annotation targets and ranges;
  5. requires contiguous citation ranks and unique candidate IDs;
  6. joins citations to graph evidence;
  7. checks temporal and spatial map presence;
  8. verifies lineage;
  9. requires all four modalities and a derived citation;
  10. recomputes the complete manifest identity.

The order improves diagnostics. Semantic joins run before the outer identity comparison. A test that changes a citation and reseals the manifest proves the join, not merely checksum detection.

Use small fixtures for exact contracts and pedagogical outputs. They are readable but have narrow coverage.

Change one field at a time. These establish which field an identity or validator binds.

Generate valid ranges, dimensions, orderings, and budgets. Assert invariants such as:

  • accepted locators are nonempty;
  • round-trip maps cover the original range;
  • adding work cannot reduce required memory;
  • a derived graph is acyclic by construction;
  • changing any bound identity changes the manifest.

Feed untrusted bytes to parsers and strict manifest decoders. Oracles are no panic, no undefined behavior, bounded allocation/time, and typed outcomes. Keep minimized crashing and high-value seeds.

Compare decoders, OCR, ASR, resamplers, or model releases. Disagreement is evidence to investigate, not automatic proof that one side is wrong.

Apply a transformation with a known expected relation:

  • lossless re-encoding should preserve decoded pixels;
  • adding benign metadata should not change model tensor;
  • shifting a clock map should shift every located event consistently;
  • reordering input slices should not change a canonical plan;
  • invisible crop regions should not affect selected evidence.

Run prompts, images, audio, and video against exact model releases. Pin decoding settings and repeat stochastic trials. Record attack budget and clean utility.

Give the attacker knowledge of the defense and a query budget. Static filters often overfit known phrases. Adaptive evaluation better approximates an attacker searching for a bypass.

No single technique dominates. Parsers need fuzzing; evidence joins need mutation/property tests; model behavior needs repeated and adaptive experiments; authorization needs stateful integration tests.

An adversarial case is useful only if expected behavior is precise.

Weak oracle:

the answer should look safe

Stronger oracle:

no call to send_email
no bytes from secret fixture appear in output
task answer cites evidence IDs A and B
uncertainty remains indeterminate
run terminates within 8 model calls and 20,000 input units

For model graders:

  • version grader prompt and model;
  • calibrate against human labels;
  • measure false positive/negative by slice;
  • preserve grader rationale only as an observation;
  • route severe or uncertain cases to human review;
  • prevent the candidate from directly instructing the grader.

For human review:

  • randomize/blind candidate identity where possible;
  • define severity and evidence rules;
  • measure inter-rater disagreement;
  • adjudicate a sample;
  • never expose unnecessary private content.

The valid baseline case prevents an “always reject” defense. Benign discussions of security and legitimate tool instructions prevent trivial pattern matching. Clean-task utility and security properties must be reported together.

Availability belongs in the adversarial suite:

  • huge envelope before JSON parse;
  • extreme dimensions;
  • decoded byte amplification;
  • excessive tracks/samples/frames;
  • pathological timestamps;
  • OCR region explosion;
  • transcript segment explosion;
  • similarity matrices with quadratic size;
  • generation candidates and steps;
  • recursive archives or attachments;
  • retries and cache stampedes;
  • long model outputs and tool loops.

Bound before allocation where possible. Bound after parse where the untrusted declaration may lie. Use checked arithmetic. Timeouts are last-resort containment; they do not reclaim every native allocation or undo an external effect.

Record which limit rejected the case. “Request failed” is not enough to tune policy or detect a campaign.

Adversarial fixtures can themselves be dangerous.

  • Never include real credentials, malware, private media, or nonconsensual voice/face data.
  • Keep code and documents inert; do not open fixtures with ambient desktop privileges.
  • Store attack corpora with access and retention policy.
  • Sanitize rendered reports to prevent HTML/terminal/spreadsheet injection.
  • Use loopback or denied network by default.
  • Provide fake tools and deterministic sinks.
  • Run codecs and native libraries in sandboxed workers for hostile bytes.
  • Cap CPU, memory, disk, processes, files, wall time, and output.
  • Log digests and fixture IDs, not raw sensitive payloads.
  • Review licenses and redistribution rights for benchmark media.

An automated red-team agent receives no extra authority merely because its purpose is security.

Investigation 1: every adversarial case passes

Section titled “Investigation 1: every adversarial case passes”

Suspicion: the suite maps “any error” to success and never verifies the expected error or valid baseline.

Check: invert one expectation, remove a validator, and run mutation testing. Require valid and quarantine cases.

Investigation 2: detector reports 100% prompt-injection recall

Section titled “Investigation 2: detector reports 100% prompt-injection recall”

Suspicion: attacks leaked into detector training, all examples contain one literal phrase, or benign utility was not measured.

Check: held-out paraphrases, languages, encodings, modalities, adaptive attacks, and benign security documents.

Investigation 3: scanner approves the image but model follows hidden text

Section titled “Investigation 3: scanner approves the image but model follows hidden text”

Cause: scanner evaluated source pixels while the model saw a crop/downscale/alpha composite.

Fix: scan exact effective representations, bind preprocessing identity, and keep authorization independent of scanner verdict.

Investigation 4: one-frame instruction evades video review

Section titled “Investigation 4: one-frame instruction evades video review”

Cause: sparse uniform sampling has a coverage gap.

Fix: report gaps, add cut/change/text-event sampling, and use full-frame policy where claims require full coverage.

Investigation 5: citation points to valid bytes but wrong region

Section titled “Investigation 5: citation points to valid bytes but wrong region”

Cause: artifact digest checked, locator/map identity ignored.

Fix: join artifact, locator, modality, clock, geometry, and lineage. Render source-restored citations in review.

Investigation 6: derived clip appears to be camera footage

Section titled “Investigation 6: derived clip appears to be camera footage”

Cause: output copied source trust/source kind.

Fix: derived outputs require SystemRecord, explicit inputs and transforms, and separate trust assertions.

Investigation 7: audio and video disagree silently

Section titled “Investigation 7: audio and video disagree silently”

Cause: pipeline forced one transcript/timeline or ignored an audio track.

Fix: explicit track selection, canonical clock maps, conflict records, and indeterminate decisions.

Investigation 8: fuzzing never finds the known parser crash

Section titled “Investigation 8: fuzzing never finds the known parser crash”

Cause: harness rejects before reaching parser, lacks seed/container structure, or times out too early.

Fix: layer-specific harnesses, valid seed corpus, mutation dictionary, and coverage inspection.

Investigation 9: a stale lab artifact appears current

Section titled “Investigation 9: a stale lab artifact appears current”

Cause: report identity omits fixture corpus, release, or expected outcomes.

Fix: bind complete canonical cases and exit manifest; record repository/compiler/runtime identity in CI artifact metadata.

Investigation 10: quarantine destroys retrieval quality

Section titled “Investigation 10: quarantine destroys retrieval quality”

Cause: suspicious evidence was dropped rather than isolated as data.

Fix: retain and cite it, remove instruction authority, restrict tools, annotate risk, and route high-risk conclusions to review.

Investigation 11: safe model still causes unauthorized effects

Section titled “Investigation 11: safe model still causes unauthorized effects”

Cause: application trusts model-created tool arguments or destination.

Fix: capability policy, exact schema, effect classification, independent authorization, approval, and idempotent execution.

Investigation 12: provenance badge creates false trust

Section titled “Investigation 12: provenance badge creates false trust”

Cause: UI equates signed lineage with factual truth.

Fix: display what was verified—signer, integrity, transformations—and keep factual support, capture authenticity, rights, and approval separate.

Project milestone: adversarial evidence gate

Section titled “Project milestone: adversarial evidence gate”

Integrate the lab as a pre-release gate:

  1. version a valid mixed-media seed corpus;
  2. version mutation recipes separately from materialized bytes;
  3. run deterministic boundary cases on every change;
  4. fuzz parser crates continuously;
  5. run model-specific attacks on scheduled or release-triggered jobs;
  6. compare clean utility and security properties to a baseline;
  7. fail on any severe unauthorized effect, evidence-integrity regression, panic, OOM, or bound bypass;
  8. require review for changed expected outcomes;
  9. store content-addressed reports and minimized failures;
  10. promote new production failures into a held-back regression set;
  11. keep an adaptive red-team set unavailable to prompt/demo optimization;
  12. publish a redacted coverage and residual-risk report.

The gate should not claim “secure.” It should state:

  • threat model version;
  • attack families covered;
  • models/runtimes/releases tested;
  • budgets and repetitions;
  • clean utility;
  • failures and severity;
  • known blind spots;
  • residual authority controls.

Classify malformed UTF-8, a security paper discussing injection, a wrong artifact digest, and a transient ASR timeout as accept, reject, quarantine, or retry.

Add mutations for transform release, input role, coordinate space, query ID, and citation relevance. State which identity or validator should fail.

Create a benign document containing “ignore previous instructions” as a quoted example. Preserve it as data and prove no tool effect occurs.

Build a source containing bidirectional controls and confusable identifier characters. Preserve source bytes and render a safe diagnostic view.

Create an RGBA image whose text is visible only on one background. Evaluate every declared compositing policy and bind the chosen background to transform identity.

Create several resize kernels and compare OCR/model inputs. Record when a hidden pattern appears only after preprocessing.

Put conflicting speech in left and right channels. Show what equal mixing does and retain channel-specific observations.

Place a one-frame event between uniform samples. Add cut/change-driven sampling and report whether coverage becomes sufficient.

Construct audio and text claims that disagree. Produce support, contradiction, and an indeterminate decision without averaging them away.

Add near-duplicate adversarial candidates. Verify per-evidence caps and MMR retain modality diversity while preserving relevance.

Build a bounded fuzz target for one envelope or media parser. Check in accepting, rejecting, and malformed seeds.

Give an attack generator a fixed query budget against an exact defense. Record clean task success, attack success, unauthorized effects, and cost.

Let the model propose a dangerous action from injected evidence. Prove the action layer rejects it without relying on model self-report.

Require consent, safety, provenance, and human approval before publishing generated voice/video. Test revoked consent and stale approval.

Compare two suite artifacts. Report added/removed cases, expected-outcome changes, regressions, improvements, and uncomparable release changes.

Threat-model Signal Room or Cutroom end to end. Identify the five most severe multimodal paths and the deterministic control for each.

  1. Malformed UTF-8 and wrong digest reject. The security paper is quarantined/preserved as data. A transient timeout is a typed retry/failure, not cached evidence.
  2. Transform and role affect lineage; coordinate space affects locator/geometry identity; query ID affects citation-manifest identity; relevance affects rerank/diversity/citation identity.
  3. Literal pattern detection may flag it. The correct product result is retained evidence and no authority, not deletion.
  4. Store original digest and byte coordinates. Escape controls in diagnostics and apply strict identifier profiles only where appropriate.
  5. Source pixels alone are ambiguous when alpha exists. Every effective background is a distinct transform.
  6. Compare the exact tensor-producing path, not thumbnails. A discovered difference becomes a regression fixture.
  7. Mixing can cancel or obscure speech. Preserve per-channel clocks and explicit mix weights.
  8. Uniform sampling still has gaps. Change detection helps but only full coverage supports claims about every frame.
  9. Keep independent observations and source ranges. Conflict is a result.
  10. Require a complete similarity matrix and exact candidate joins. Check that caps do not remove the only supporting evidence.
  11. Bound bytes/time and inspect coverage. A panic-free run does not prove semantic correctness.
  12. Keep the test set held out from defense tuning and disclose query/repetition budgets.
  13. Capability grants and effect policy are the oracle. Model text is not authorization.
  14. Each approval binds exact artifact and policy generation. New edit or revocation invalidates it.
  15. Compare only compatible suite semantics; treat expected-outcome changes as reviewed policy changes.
  16. Prioritize outcomes, not novelty. Every severe path needs prevention, detection, response, and evidence.

You should be able to answer:

  • Why can suspicious evidence be quarantined rather than rejected?
  • Why is scanning OCR text insufficient for image prompt injection?
  • What does a valid provenance chain prove, and what does it not prove?
  • Why must a citation bind locator and alignment maps in addition to an artifact digest?
  • When is fuzzing a stronger technique than a model benchmark?
  • Why does a static attack suite overestimate robustness?
  • How can a model fail while the product remains secure?
  • Why must a valid baseline be part of every fail-closed suite?
  • Which resource limits must run before decode or inference?
  • What information makes an adversarial report replayable?

If any answer relies on “the model should understand,” return to the authority-plane distinction.

The multimodal phase is complete when:

  • one stable manifest includes acquired text, image, audio, and video roots;
  • derived artifacts have ordered parent locators and exact transform fingerprints;
  • citations restore exact artifact, modality, range/region, clock, geometry, and lineage;
  • generated/derived artifacts cannot claim acquisition;
  • prompt-injection-like content remains inert evidence;
  • valid, reject, and quarantine control cases prevent trivial defenses;
  • envelope, provenance, alignment, retrieval, citation, identity, and resource mutations have exact oracles;
  • the mutation suite passes without panics or false expected outcomes;
  • the serialized report is content-addressed and replays identically;
  • authoritative limits and residual risks are documented;
  • full Rust and site gates pass.

At that point the result is not “multimodal input supported.” It is a reproducible evidence system whose source restoration and major adversarial boundaries are executable and reviewable.