Multimodal Safety and Evaluation › Cross-Modal Prompt Injection
Language AI HandbookAll chapters Instruction-like content in an artifact can present an indirect prompt injection attempt. The trust-boundary failure occurs if the system treats that content as authority to change the task. A non-text input can carry content that enters the model as text or another representation.
An indirect injection attempt using instruction-like content from a non-text input. Evaluate whether the system recognizes the content, accepts it as an instruction, or authorizes an action. An attempt can be detected or ignored without an action.
Record what the parser extracts, what enters the model, and what reaches an action gate. A text-only detector has no direct visibility into the original image or audio. Test the paths the product actually exposes.
Why Depiction Is Not Instruction
Consider a photo of a coffee mug beside a note labeled [FORMAT_MARKER]. You ask what the note contains. A correct response can describe the marker while keeping your original task.
A prompt can include both your task and words derived from an artifact. The application supplies their provenance. Use that information at the policy boundary when a response proposes an action.
A detector can flag a possible boundary error. The action gate checks authorization independently. Evaluate the deployed parser, model, and action gate together.
Carry the distinction between the subject of your request and the source of that request through recognition and retrieval. The OCR or ASR text inherits the artifact’s trust designation.
Deployment Surfaces That Matter
The surfaces to enumerate for any multimodal product include:
- Uploaded images: Include screenshots, receipts, and scanned forms in evaluations of the paths that accept them.
- OCR-extracted text: any text recognized and then fed back into the model.
- PDFs and documents: Text layers, hidden text, forms, comments, and metadata.
- Audio uploads and voice calls: Include spoken content and any transcripts the deployed system uses.
- Video: Include tracks and derived representations the application actually reads.
- Web content: The classic text injection surface, but also embedded images with text.
- Tool outputs: Any retrieval or execution result the model treats as evidence.
The pattern: anything the model reads becomes a candidate instruction. Your job is to decide which channels are trusted to carry operator intent, and enforce that distinction through prompting, isolation, and monitoring.
For each channel, record who may write to it, which fields the application forwards, and which proposed actions it can influence. Prioritize authorization checks where externally supplied content can reach a side-effect boundary.
A Layered Defense Strategy
Tag the source of artifact content, and verify authority again when a proposed action reaches a sensitive boundary.
- Provenance tagging. Label artifact-derived content with its source type and trust designation. Test whether those labels survive preprocessing and retrieval.
- Channel isolation. Keep operator instructions and artifact content distinguishable. Re-test the deployed interface because role labels alone may not enforce authority.
- Detector. Record a possible boundary error as a signal for review. Test false positives on ordinary documents that contain legitimate imperative language.
- Action gating. Before a side effect, check authorization against the actual user and the proposed action. Give the model read access only to the data the request permits.
- Audit logging. Retain the decision, policy version, and a permitted source identifier. Limit retention and access for sensitive artifact contents.
Measure each control independently. A correctly labeled source can still lead to a proposal that the action gate must block.
In an evaluation record, keep source designation, model behavior, policy decision, and observed side effect as separate fields. This makes it possible to locate a failure without inferring it from a refusal phrase.
Refusal Calibration
Report utility and boundary enforcement separately. In this exercise the marker fixtures are assigned an intended refusal label. In a product, an assistant can often describe marked content and still reject an unauthorized action.
A system that refuses every case scores 1 on both axes. A system that never refuses scores 0 on both. Their signed gaps are both zero.
Use benign refusal as the horizontal coordinate and marker refusal as the vertical coordinate. The gap is the vertical coordinate minus the horizontal. It is zero along the whole diagonal, including both corners for policies that refuse or comply with every item. High benign refusal reduces utility even if the gap remains positive.
PythonIn [6]Expand
import numpy as np
# A grid over possible (benign refusal, injection refusal) outcomes.
benign_grid, inject_grid = np.meshgrid(
np.linspace(0.0, 1.0, 101), np.linspace(0.0, 1.0, 101)
)
# Calibration score: positive when inject refusal dominates benign refusal.
calibration_score = inject_grid - benign_grid
# Three illustrative operating points for the (x=benign, y=injection) plane.
operating_points = {
"calibrated": (0.08, 0.92),
"over-refuses": (0.92, 0.88),
"under-refuses": (0.10, 0.22),
}VisualizationOut [7]Expand

Keep the eligible cases and observed outcomes visible when comparing channels. A paired design starts with one source item and holds the requested task and available information fixed. If a caption omits a detail that the image contains, the two inputs are no longer interchangeable for that task. One useful report records the paired difference for shared cases, then separately identifies the cases whose recognition paths removed information the model needed.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!