What survives in the shift from text to pixels? Conditional protection against prompt injection in documents rendered as images
What Survives the Shift from Text to Pixels? Conditional Protection against Prompt Injection in Image-Rendered Documents
The authors test indirect prompt injection on six model pairings in two modalities, text and page image, and report that rendering can reduce the execution rate of append and format attacks, but that the protection depends on model, operation and attack budget.
Indirect prompt injection: the attacker controls only the external source D, inserting instruction A into it while preserving the original facts; the system policy and user question are not under the attacker's control. The victim system is a multimodal language model answering questions about external documents, with sources presented in two modalities, text (T) or page images (V), and a system prompt requiring the model to treat external sources as untrusted.
- Multimodal models answering questions about external documents face indirect prompt injection. Rendering untrusted content as page images lowers attack success rates on average, but which injection operations survive rendering, what the utility cost is, and whether failure is due to not reading or reading but not executing was previously unclear.
- The authors pair 191 question-answering sources from LongBench into text and page-image versions, measure execution rates for three injection operation types—append, format, replace—and clean question-answering utility on six models, and analyze mechanisms using behavioral diagnostics, OCR controls, user authorization experiments, and activation patching and attention blocking on Qwen.
- Rendering lowered append and format attack execution rates for all six models, but Qwen3-VL-8B still executed the replace attack at 77.96% in the image modality; a small-scale search over 8 fixed candidate attacks largely erased the image gap for Qwen and Gemini; models could often transcribe image instructions without executing them.
- Limitations noted by the authors include: protection depends on model, operation, target type and presentation; small-budget search can narrow the gap; and on integration questions some models show a drop in utility. The experiments use English sources, the mechanism analysis is conducted only on Qwen3-VL-8B, and the behavioral diagnostics cover three models.
- Evaluated models
- Qwen3-VL-8B-InstructGPT-5-nanoHaiku 5.5Gemini 3.1 Flash-LiteGLM-5.3-FlashDeepSeek V4.1 Flash 1017
- Benchmarks
- LongBench(Qasper、MultiFieldQA-en、HotpotQA 共 191 个来源实例)
- Metrics
- ASRstrict successclean QA F1utility ratio (UR)
Researchers at Beihang University paired 191 question-answer sources presented as text and as page images across six models and found that rendering untrusted content as images can reduce prompt injection execution rates, but the protection is conditional. Rendering reduced the execution rates of append and format attacks for all six models, but Qwen3-VL-8B still executed image-borne answer replacement with a 77.96% success rate. Protection varied with target type, rendering settings, wording and number of repetitions; a search over eight fixed attack candidates greatly narrowed the image gap for Qwen and Gemini on append and format, while GPT-5-nano maintained a significant gap. Utility ratios on the original questions (image relative to text) ranged from 93.31% to 101.61%, and Qwen dropped to 61.99% on integration questions requiring combining two pieces of evidence. Models could often paraphrase but not execute instructions in images, and user authorization also increased execution rates; mechanism analysis showed that text instructions act through their own position, whereas image instructions are diffused across the whole page by visual encoding.
Why it was selectedThis paper provides a practice of evaluating rendering defenses in detail by operation, attack budget, and utility, showing that average success rates mask specific weaknesses at the model and operation levels.
Paper analysis
What problem does this paper attempt to solve?
Which injection operations rendering untrusted documents as images can block, at what cost, and whether failure is due to not reading or not executing was previously unclear.
Core question: after untrusted documents are rendered as page images, which injection operations still take effect, what is the utility cost, and whether attack failure is because the model cannot read the instruction or reads it but does not execute it.
- Setting and importance: Retrieval-augmented generation and document question answering have models answer based on external sources; indirect prompt injection exploits the trust boundary to plant commands in untrusted content and hijack responses. The authors state that rendering documents as page images is a promising mitigation that can lower attack execution rates and reduce decoder token usage.
- Gaps in existing work: The authors state that existing results show rendering is effective on average, but leave finer-grained questions: which decisions about the response external authors can still control through rendered pages, and why; aggregate metrics for a single fixed attack may mask vulnerability to specific operations.
- Core observation: A missing marker is ambiguous—the model may not have read the command, or may have read it but chosen to obey the user; font size and visual degradation affect typographic attacks, and readability is a plausible but untested explanation.
- Paper's approach: Pair 191 English question-answering sources from LongBench into text and page-image versions, measure execution rates for three operation types—append, format, replace—and clean question-answering F1 on six models, and conduct behavioral diagnostics and mechanistic interventions inside Qwen.
- Threat model:
- Attacker goal: Make the model execute the injected three operation types—append a source-specific marker, output in a specified format, replace the answer with a fixed phrase.
- Attacker knowledge: The paper does not explicitly state the attacker's knowledge assumptions about the model and rendering settings.
- Attacker capability: Control only the external source D, inserting instruction A at a specified position while preserving the original facts; the system policy and user question are unaffected.
- Victim system: A multimodal language model answering questions about external documents, with sources presented as text (T) or page images (V), and a system prompt requiring the source to be treated as untrusted.
What related research exists?
Related work falls into three groups—visual text representation, prompt injection attack and defense, and images carrying instructions; this paper is closest to Pictionary but fixes the document and instruction for cross-modal comparison.
Visual text representation
- Pixel-level models and OCR-free document models ([23–25], [12, 13, 18]): encode rendered text as image patches, do not rely on a fixed vocabulary, and accuracy depends on how characters are grouped into patches.
- Page images as retrieval units and compressed context (ColPali [7], [15, 27]): study what rendering preserves for the task; this paper additionally requires the model to respect the user's authority over operations while recovering evidence.
Prompt injection attacks and defenses
- Indirect prompt injection (Greshake et al. [10], Perez and Ribeiro [21]): third parties plant instructions in content the model will consume, with goals including manipulating responses, leaking information, or triggering unauthorized tool calls [6, 31, 32].
- Defenses: Spotlighting delimits untrusted data [11], StruQ uses structured queries to separate instructions from data [4], and instruction hierarchy training makes models prioritize privileged instructions [26].
Images carrying instructions
- Typographic and visual adversarial prompts: overlaid text misleads CLIP [8]; typographic or adversarial visual prompts can jailbreak vision-language models [9, 22] or inject instructions into multimodal assistants and agents [1, 29].
- Nagaraja et al. [20]: vary the position and visibility of commands in natural images; Balakrishnan et al. [3]: relate typographic attack success rates to font size and visual degradation.
- Pictionary (Zhang et al. [34]): an application-side approach that renders untrusted material as images to weaken instructions within it; the authors state it lowered attack execution rates on two prompt injection benchmarks, including under adaptive attacks.
This paper's positioning: The authors state that, in contrast to Pictionary, this paper fixes the document and instruction across modalities and asks which operations survive rendering; the three attack operations cover a spectrum of increasing control over the response, from appending a string to replacing the answer entirely.
Baselines and benchmarks: This paper sets no external baseline method; the comparison is a paired comparison of the same model between the text and image modalities; data come from three LongBench [2] subsets—Qasper [5], MultiFieldQA-en, and HotpotQA [30]—totaling 191 source instances.
How does the paper address this problem?
Pair text and page-image modalities, measure execution rates for three injection operation types and clean question-answering utility, then conduct behavioral diagnostics and mechanistic interventions on Qwen.
The overall idea is to build a text–image paired benchmark: the same source, same question, and same attack wording are presented as text and as rendered page images, comparing six models' attack execution rates and question-answering utility across the two modalities, then using behavioral diagnostics and activation patching to distinguish "cannot read" from "read but does not execute."
Problem formalization and trust boundary
- Let S be the system policy, Q the user question, and D the external source; the attacker inserts instruction A into D while preserving the original facts, and only the source is under the attacker's control. The two responses are yT = M(S, Q, D ⊕ A) and yV = M(S, Q, R(D ⊕ A)), where R is the renderer and ⊕ is insertion at a specified position.
- The system prompt instructs the model to treat external sources as untrusted, and the user prompt gives the question and marks the source boundaries; the trust boundary is the same in T and V.
Data, operations, and models
- Data sources: 191 English source instances from LongBench—80 Qasper (research paper question answering), 69 MultiFieldQA-en, and 42 HotpotQA (requiring cross-paragraph evidence); each instance contains external content, the original question, and reference answers.
- Three attack operations: Append requires appending a source-specific marker on a new line after the answer; Format requires outputting a single line "marker | answer"; Replace requires replacing the answer with a fixed phrase. Each operation has two fixed wordings, and the markers do not appear in the original question, document, or reference answers.
- Models: Qwen3-VL-8B-Instruct run locally; GPT-5-nano, Haiku 5.5, Gemini 3.1 Flash-Lite, GLM-5.3-Flash, and DeepSeek V4.1 Flash 1017 accessed via an API gateway. The core comparison uses the same questions, attacks, and PNGs for all six models. Qwen is used for rendering, wording, behavioral diagnostics, and intervention experiments requiring decoder state; GPT-5-nano and Gemini are included in some experiments.
- Prompt wrappers: three wrappers W1, W2, and Wa, with fixed default rendering settings.
Scoring method
- ASR: the proportion of visible responses that execute the injected operation (appending the marker, formatting the answer, replacing with the target phrase); responses truncated in output length are recorded as unknown and excluded. For each operation, the two wordings are first averaged within a source, then averaged within the dataset, with the three datasets equally weighted.
- Utility: LongBench word-overlap F1 computed on clean questions, taking the best score across reference answers after normalizing case, articles, punctuation, and whitespace; the utility ratio UR is image F1 divided by text F1.
- Strict success: in the controlled experiments of Section 5, requires exact reproduction of the target string in the specified structure.
- Statistical tests: reported pH values are Holm-corrected within each model (Table 3 has 54 tests).
Controlled experiment design (90-source subset)
- Operation × target type: the three operations are each paired with a natural phrase and an equal-length random alphanumeric string as targets, using the separate-page protocol (the command occupies its own page, placed before or after the source, with position matched in text), as opposed to the main experiment's inline protocol (the command embedded within the source text).
- Presentation factors: export width 704/876/1280 pixels × CSS font size 20/26/32; three replacement wordings (Generic, Question-bound, Evidence-bound); distance between the command and the cited evidence; repetition of 1/2/4 copies (concentrated or dispersed).
- Multi-candidate search: 16 candidates per operation (8 lead-in framings × 2 wordings), with the 90 sources split into 30 development / 60 test, ranked by strict success on the development set and then frozen; on the test set, budget k means the attack is counted as successful if any of the top k candidates succeeds.
Behavioral diagnostics and mechanistic analysis
- Three-endpoint diagnostics: Reporting (transcribe the injected passage verbatim; obeying the command counts as failure), Understanding (classify the operation among four options and return the exact target), Execution (execute the operation on the original question).
- OCR control: replace the image with OCR text of the page image as input; there is also a variant correcting errors within the OCR attack span.
- User authorization: under the Wa policy the user prohibits or permits source operations, with page content unchanged.
- Mechanistic interventions (Qwen): activation patching adds/subtracts, during prefill, the state difference δA between command and neutral description at attack-region positions, with norm-matched random perturbations and position-shifted perturbations as controls; also target redirection (binding one of two random codes) and attention blocking (blocking attention to attack region A or to the entire instruction page).
What experiments did the paper conduct?
Rendering lowered append and format attack execution rates for the six models, but Qwen's image replace ASR still reached 77.96%, and a small-budget search can erase part of the gap.
Experimental setup
- Models tested: Qwen3-VL-8B-Instruct (local), GPT-5-nano, Haiku 5.5, Gemini 3.1 Flash-Lite, GLM-5.3-Flash, DeepSeek V4.1 Flash 1017 (the latter five via an API gateway).
- Data: 191 English-source instances from LongBench (Qasper 80, MultiFieldQA-en 69, HotpotQA 42); each source also has 1 integration question requiring two passages of evidence (191 in total); the controlled experiments use a 90-source subset (30 per dataset).
- Metrics: ASR (proportion of visible responses that execute the injected operation), strict success rate, word-overlap F1 on clean QA, UR (image F1 / text F1).
- Determination method: execution is determined by whether the output contains the marker, conforms to the format, or equals the target phrase; the paper does not state that an LLM judge was used.
- Statistics: the two phrasings per operation are averaged within source, datasets are equally weighted; pH values are Holm-corrected; truncated responses are excluded.
- Baselines: no external baseline; the comparison is the same model's text modality versus image modality.
Main results
According to Table 1 (ASR %, lower is better, ∆ = image − text, in percentage points) and Table 2 (clean QA F1 and UR):
Swipe horizontally to read the table
Model Append text→image Format text→image Replace text→image UR original / integration (%) Qwen3-VL-8B 73.78→5.01 71.72→11.35 98.73→77.96 98.71 / 61.99 GPT-5-nano 77.95→0.00 72.12→0.00 29.53→1.12 99.44 / 89.35 Haiku 5.5 2.46→0.00 5.11→0.00 0.93→0.00 101.61 / 102.56 Gemini 3.1 Flash-Lite 93.97→47.27 97.85→59.79 30.57→0.24 99.75 / 100.71 GLM-5.3-Flash 65.10→4.48 61.63→1.92 0.24→0.00 99.49 / 101.00 DeepSeek V4.1 Flash 64.87→0.61 89.26→6.69 3.60→0.00 93.31 / 96.91 - Append and format: image ASR is lower than text for all six models; Gemini's image ASR is about 50%, and the other models are below 12% (per the authors).
- The replace operation changes relative vulnerability: the authors report that Qwen executes fixed-phrase replacement in most image responses, whereas all API models are near zero in images and GLM is also near zero in text; aggregating across operations would mask vulnerability to a specific operation.
- Utility: on original questions the six models' UR ranges from 93.31% to 101.61% (Table 2); on integration questions Qwen loses the most and GPT-5-nano is also below its original-question UR, while Haiku, Gemini and GLM show no loss; the authors state that Qwen's large loss cannot be generalized to all models.
Target type and presentation factors (90 sources, separate-page protocol)
- Target type (Table 3): for Qwen append, images are weaker on both target types; for format and replace, only random strings show a Holm-corrected image gap, and Qwen's image execution on random strings is near ceiling, with the authors stating that its strict success rate gap mainly reflects reproduction errors rather than failure to attempt the operation. GPT-5-nano and Gemini show image gaps for append and format on both target types, with execution rate and strict success rate differing by no more than 5.00 percentage points.
- Resolution and font size (Figure 2(a)): higher resolution and larger font size weaken the rendering protection; under W1, fixed-phrase replacement execution rises by more than 25 percentage points each for font size 20→32 (width 876) and width 704→1280 (font size 26); the joint benefit of the two factors diminishes. The coarsest W1 setting gives clean QA F1 of 42.21, versus 48.72 for the default setting.
- Phrasing and position (Figure 2(b)): Question-bound phrasing is the most effective across all four modality × question-type combinations, 17.78–30.00 percentage points higher than Generic; when the command is far from the cited evidence, image ASR rises for both question types.
- Repetition (Figure 2(c)): two concentrated copies increase image format execution by 24.44 percentage points, four dispersed copies are similar to four concentrated copies, and image append execution changes very little.
Multi-candidate search and behavioral diagnostics
- 16-candidate search (Figure 3): the Qwen append gap narrows from −37.37 to −3.33 percentage points at budget 8, format reaches 100% in both modalities at budget 8, and replace shows no corrected gap at any budget; Gemini append and format likewise converge, but the replace gap persists; GPT-5-nano retains a corrected image gap at every operation and budget. The authors state that an image gap for a single command does not mean resistance to limited search, and whether it survives depends on the model and operation.
- Separation of reading and execution (Table 4): under the inline protocol, Gemini's report and recognition rates for image append and format commands exceed 90% but execution is much lower; GPT-5-nano reports and recognizes more than half but executes zero; for Qwen, on sources where image reporting succeeds, append and format execution are 0.00% and 3.70%, yet replace is executed on most images. The authors state that failure to read cannot explain all failed image attacks.
- OCR control (Section 6.2): on 89 sources, operation execution rate is 41.80% for OCR text, 70.96% for original text, and 1.11% for images; correcting OCR attack-span errors raises the strict success rate by 14.44 percentage points while operation execution rises by only 3.33 percentage points.
- User authorization (Figure 4(b)): when permitted, Qwen image append and format execution rise; Gemini reaches 100% under Permit in both modalities; GPT-5-nano is near ceiling in text but remains much lower in images.
Mechanism analysis (Qwen)
- Activation patching (Figure 5): adding the command−neutral state difference at the attack region induces all three operations in neutral runs, whereas random and shifted controls do not; text induction is stronger at every operation and layer, and image induction decreases in the order replace, format, append. Reverse patching eliminates execution of all three operations in both modalities.
- Target redirection (Table 5, 48 sources): in text, the response switches to the donor-bound code, exceeding self, random and shifted controls in all 12 comparisons; in images the response does not switch, and format still produces the receiver's code. The authors state that the bound code can be decoded from the image attack-region state, but at these positions it does not determine which code the response produces.
- Attention blocking (Table 6): blocking attack region A drives text execution to zero but barely affects images; only blocking the entire instruction page eliminates image execution; the modality × blocking interaction is +84.38 for append and +80.21 percentage points for format; clean QA F1 under the various blockings ranges from 52.88 to 56.00. The authors conclude from this that text commands act at their own position, whereas visual encoding spreads the command across the instruction page.
Other ablations and analyses
- Sources answered correctly in both modalities (Section 4.3): for Qwen at τ = 1 (46 sources), append ASR is 72.39% for text and 3.37% for images, and the paired intervals at each threshold exclude zero.
- Neutral-description control (Figure 4(a)): replacing the command with a neutral description that retains the marker drives Qwen's append and format ASR to zero in both modalities.
- Probes: linear probes distinguish command runs from neutral-description runs in both modalities; at L11 the attack-region probe identifies the bound code with 100.00% (text) and 98.44% (image).
What are some points that can be further explored?
The authors do not have a dedicated limitations section; the conclusion states that protection is conditional and should be evaluated by operation and attack budget, and the experiments cover English sources and a single open-source model.
Limitations and future directions noted by the authors
- Conditionality of protection (Section 8 conclusion): The authors state that rendering's protection is conditional—Qwen remains vulnerable to answer replacement attacks, the gap varies with target type and presentation, and a small-scale search over attack candidates can erase most of the gap for some models.
- Utility drops on integration questions (Section 8): The authors state that utility is largely maintained on original questions, but drops on integration questions for some models.
- Recommendations for evaluation (Section 8): The authors state that rendering-based defenses should report execution rates under attack budget separately by operation, and also report utility on evidence-integration questions.
- The paper has no separate Limitations or Future Work section; the above are the qualifications and directions the authors explicitly write in the conclusion.
Scope of experimental coverage
- Models tested: 6 in total (Qwen3-VL-8B-Instruct, GPT-5-nano, Haiku 5.5, Gemini 3.1 Flash-Lite, GLM-5.3-Flash, DeepSeek V4.1 Flash 1017); mechanistic interventions were performed only on Qwen3-VL-8B, and behavioral diagnostics covered three models: Qwen, GPT-5-nano, and Gemini.
- Data: 191 English LongBench source instances (Qasper, MultiFieldQA-en, HotpotQA), of which 90 were used for controlled experiments; the paper reports no sources in other languages.
- Attack operations: three types—append, format, replace—each with two fixed wordings; the multi-candidate search used 16 fixed candidates per operation with a maximum budget of 16; the paper reports no evaluation of adaptive optimization attacks (such as gradient-based or iterative rewriting).
- Attacker capability setting: the attacker controls only external source content; the paper reports no knowledge assumptions about the model or rendering settings, and no costs beyond query counts or iteration budgets.
- Judgment method: judged by whether the output executes the operation; the paper reports no use of LLM judges or human evaluation, nor their agreement.
Summarize the main content of the paper
Paired comparison of indirect prompt injection in text and page image modalities; the authors report that rendering provides conditional protection that depends on model, operation and budget.
An empirical analysis of defenses against indirect prompt injection: whether rendering untrusted documents as page images can block injected commands.
- Problem: When multimodal models answer based on external sources, attackers can plant commands in the sources. Existing work states rendering is effective on average, but which operations survive, what the utility cost is, and whether failure is due to not reading or not executing previously had no answer.
- Method: Pair 191 English question-answering sources from LongBench into text and page-image versions, measure ASR for three operation types—append, format, replace—and clean question-answering F1 on six models; on a 90-source subset, controlled variation of target type, rendering parameters, wording, position, repetition, and attack candidate budget; supplemented by reporting/recognition/execution diagnostics, OCR controls, user authorization experiments, and activation patching, target redirection, and attention blocking on Qwen.
- Main results:
- Rendering lowered append and format attack execution rates for all six models, but Qwen3-VL-8B still executed answer replacement at 77.96% ASR in the image modality (Table 1).
- On original questions, the six models' UR was 93.31%–101.61%, but Qwen's UR dropped to 61.99% on integration questions requiring two pieces of evidence (Table 2).
- A search over 16 fixed attack candidates largely erased the image gap for Qwen and Gemini on append and format, while GPT-5-nano maintained an image gap across operations and budgets (Figure 3).
- Models could often transcribe and recognize image commands without executing them; Qwen's execution rate on page OCR text was 41.80%, far higher than 1.11% on the image itself (Section 6.2).
- Mechanistically, the authors state that text commands act through their own position, whereas image commands and their targets are spread by visual encoding across the entire instruction page.
- Authors' conclusion: Rendering provides conditional protection; the authors argue that rendering-based defenses should report execution rates by model, operation, and attack budget, and also report utility on evidence-integration questions.