Skip to content

Translation in progress Some entries still include text in the original language.

Image hijacks: adversarial images can control generative models at runtimeImage Hijacks: Adversarial Images can Control Generative Models at Runtime

arXiv· arXiv:2309.00236· Luke Bailey, Euan Ong, Stuart Russell, Scott EmmonsHarvard University; Cambridge University; University of California, BerkeleyIndexed by this site · 25 days ago· Originally publishedSelected AttacksSelectedAttention38

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

The authors propose Behaviour Matching to train image hijack to control VLM runtime behavior; on LLaVA-13B the success rates of all four attack types exceed 80%.

Threat modelAttacker goal: force the VLM at inference time to match target behavior B for arbitrary user input ctx (output a specified string, leak context, jailbreak, believe false information). Knowledge: white-box access (can compute gradients with respect to image x); Section 4.5 explores black-box transfer. Capability: control over the input image, under four constraints: unconstrained, ℓ∞-norm, stationary patch, moving patch. Victim system: a VLM assistant that processes untrusted data and can execute API operations on behalf of the user.

Questions
VLMs introduce a continuous image input channel, creating a new attack surface: can an untrusted image control model behavior at inference time (leak user data, bypass safety training, output attacker-specified content)? The authors state that existing adversarial robustness research struggles to eliminate such attacks.
Methods
Proposes Behaviour Matching: freeze the VLM and use projected gradient descent to optimize the image over a large number of contexts so that the model's output logits match the target behavior; and derives Prompt Matching, using soft logit labels to make the image imitate the behavior induced by an arbitrary text prompt.
Experiments and results
Training four types of hijack on LLaVA-13B—specific string, leak context, jailbreak, disinformation—the authors report that the success rate of each attack type exceeds 80%, the GCG text baseline lags across the board, and the hijack trained on an ensemble of two models has a 0% transfer success rate on BLIP-2.
Limitations and future work
The authors state that defense research is preliminary only, testing only two simple defenses: noise addition and JPEG compression; attacks are limited to white-box open-source models, and hijacks trained on a single model and on a two-model ensemble both failed to transfer to held-out models; there are 3 target models tested in total.
Experimental setupLLaVA LLaMA-2-13B-Chat、BLIP-2 Flan-T5-XL et al. · Alpaca training set、AdvBench harmful behaviours dataset et al. · success rate、Levenshtein edit distance et al.
Evaluated models
LLaVA LLaMA-2-13B-ChatBLIP-2 Flan-T5-XLInstructBLIP-Vicuna-7b
Benchmarks
Alpaca training setAdvBench harmful behaviours datasetImageNet
Metrics
success rateLevenshtein edit distancevalidation loss
AI summaryand selection rationaleThe researchers propose an image hijacking attack, in which a small adversarial perturbation to the input image can control the behavior of a vision-language model at inference time; on LLaVA LLaMA-2-13B, the success rates of all four types of attacks exceed 80%. The paper proposes the Behaviour Matching algorithm to train hijacking images that transfer on held-out user inputs, and derives Prompt Matching, which uses a general dataset unrelated to the target prompt (such as Alpaca) to train images that match the behavior of any text prompt. The four types of attacks are forcing a specified string output, leaking context via API calls, jailbreaking that bypasses safety training, and disinformation attacks, with maximum success rates of 100%, 96%, 92%, and 85%, respectively. Under an ℓ∞ constraint of 8/255 and above, the text attack baseline GCG is inferior to image attacks on all three types of attacks; ensemble training can produce a single hijacking image that attacks both LLaVA and InstructBLIP simultaneously (success rates of 99.8% and 80.6%, respectively), but the transfer success rate on held-out BLIP-2 is 0%.

The researchers propose an image hijacking attack, in which a small adversarial perturbation to the input image can control the behavior of a vision-language model at inference time; on LLaVA LLaMA-2-13B, the success rates of all four types of attacks exceed 80%. The paper proposes the Behaviour Matching algorithm to train hijacking images that transfer on held-out user inputs, and derives Prompt Matching, which uses a general dataset unrelated to the target prompt (such as Alpaca) to train images that match the behavior of any text prompt. The four types of attacks are forcing a specified string output, leaking context via API calls, jailbreaking that bypasses safety training, and disinformation attacks, with maximum success rates of 100%, 96%, 92%, and 85%, respectively. Under an ℓ∞ constraint of 8/255 and above, the text attack baseline GCG is inferior to image attacks on all three types of attacks; ensemble training can produce a single hijacking image that attacks both LLaVA and InstructBLIP simultaneously (success rates of 99.8% and 80.6%, respectively), but the transfer success rate on held-out BLIP-2 is 0%.

Why it was selectedThe paper quantifies the success rates of four types of attacks by image hijacking against LLaVA under various perturbation constraints, and shows that the text attack baseline GCG is inferior to image attacks in most settings.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Can an untrusted image hijack VLM behavior at inference time? The authors propose the concept of image hijack and give a general training algorithm.

    Core question: Does the continuous image input channel of vision-language models (VLMs) constitute an exploitable attack surface—can an attacker use a single adversarial image to control model behavior at inference time?

    • Scenario and importance: The authors envision a VLM-powered personal assistant that can access untrusted data, hold user private data, and perform actions on the user's behalf through an API parser (Figure 3); the authors argue that if an untrusted image can control the assistant's output, it can control its actions and replies.
    • Shortcomings of existing methods: The authors state that progress in adversarial robustness is slow—according to RobustBench, the SOTA robust accuracy on CIFAR-10 under ℓ∞=8/255 rose from 65.88% in October 2020 to 70.69% in August 2023, an improvement of only 4.81 percentage points; the authors argue that if image hijack robustness for VLMs is similarly hard to solve, the problem may remain unsolved for years.
    • Core observation: The authors find that only a small perturbation to the original image is needed to train an adversarial image (image hijack) that controls the VLM at inference time, and that it remains effective on held-out user inputs.
    • What the paper proposes: It proposes a general training algorithm, Behaviour Matching, and its derived method Prompt Matching, and instantiates four attack types on LLaVA: specific string, leak context, jailbreak, disinformation.
    • Threat model (Section 2, using the paper's terminology):
      • Goal: Construct an image x̂ such that for all ctx∈C, Mϕ(x̂, ctx) ≈ B(ctx), where B is the attacker-defined target behavior.
      • Knowledge: white-box access to Mϕ, can compute gradients with respect to x; Section 4.5 explores black-box transfer.
      • Capability: control of the input image, with four constraints: unconstrained, ℓ∞-norm, stationary patch, moving patch (Section 3.3).
      • Victim system: a VLM assistant that processes untrusted images and text and can perform actions via an API parser.
  2. What related research exists?

    Related work is divided into three groups: LLM text attacks, VLM attacks, and adversarial robustness; the baseline is the GCG text attack.

    LLM text attacks (prompt injection)

    • Perez & Ribeiro (2022), Wei et al. (2023), Pedro et al. (2023)—hijack LLM behavior via prompt injection: jailbreaking safety-trained chatbots, inducing LLM agents to execute unintended SQL queries.
    • Liu et al. (2023b), Greshake et al. (2023)—direct prompt injection and attacks on real LLM applications via poisoned retrieved data.
    • Li et al. (2020), Jones et al. (2023), Zou et al. (2023)—automated prompt injection discovery, causing misclassification and harmful outputs. The paper notes that these automated text attacks target only a single undesirable behavior, and whether text attacks can serve as a general hijack remains an open question.

    VLM attacks (contemporaneous with this paper)

    • Zhao et al. (2023)—image matching attack, making the model interpret image I as target image T; the paper notes that this paper's goal is to control model behavior rather than match a target image.
    • Bagdasaryan et al. (2023), Schlarmann & Hein (2023)—multimodal attacks that force the VLM to repeat an attacker-chosen string; the paper notes that their constraints are fewer and they do not clearly demonstrate context transfer. Bagdasaryan et al. also attempt to train images whose embeddings are close to a target prompt, which fails to effectively influence behavior due to the modality gap (Liang et al., 2022); the authors state their own informal experiments confirm this.
    • Carlini et al. (2023), Qi et al. (2023a), Shayegani et al. (2023)—construct toxic generation or jailbreak images for VLMs.

    Adversarial robustness and defenses

    • RobustBench (Croce et al., 2020) and Gowal et al. (2020), Wang et al. (2023)—CIFAR-10 robust accuracy benchmark, used to argue that adversarial robustness progress is slow.
    • Athalye et al. (2018), Carlini et al. (2022), Cohen et al. (2019)—obfuscated gradients phenomenon and certified defenses; the authors use this in the Impact Statement to caution that defense research requires care.

    Baseline and benchmarks

    • Baseline method: Greedy Coordinate Gradient (GCG) (Zou et al., 2023), learning 32 additional text tokens (equal to the token count of a single image in LLaVA), trained on LLaVA LLaMA-2 with blank image input.
    • Benchmarks/datasets: Alpaca training set (Taori et al., 2023), AdvBench harmful behaviours dataset (Zou et al., 2023).

    The authors use Table 3 for comparison and positioning: the authors state that this paper is, to their knowledge, the first work to systematically and quantitatively evaluate image hijack under multiple constraints, and the first to show that SOTA text attacks lag behind image attacks across multiple attack types.

  3. How does the paper address this problem?

    Freeze the VLM and use gradient descent to optimize the image over a large number of contexts so that the output matches the target behavior; soft logit labels give rise to Prompt Matching.

    Overall approach: Given a target behavior B, Behaviour Matching freezes the VLM parameters and uses projected gradient descent to directly optimize the input image so that the model's output over a large number of contexts matches B; Prompt Matching is its special case with soft logits as labels, making the image imitate the behavior induced by an arbitrary text prompt.

    Problem formalization

    • The VLM is denoted Mϕ(x, ctx) → out, with input image x and text context ctx, outputting multi-token logits; Mϕforce is the teacher-forced version.
    • The target behavior is defined as B : C → Logits; the attacker seeks x̂ such that for all ctx∈C, Mϕ(x̂, ctx) ≈ B(ctx).
    • Optimization objective: argminx ∑ctx ∈ C L(Mϕ force(x, ctx, B(ctx)), B(ctx)), where L is the cross-entropy loss; after optimization, pixel values are quantized to integers in [0,255].

    Two key properties of Behaviour Matching

    • Cross-context transfer: The loss is minimized over a large number of contexts; C is taken from a general instruction-tuning dataset (Alpaca), and the resulting hijack remains effective on held-out user inputs.
    • Matching logit-level behavior: Unlike standard gradient adversarial attacks, it can match a C → Logits behavior, thereby imitating the behavior of a specific VLM forward pass.

    Prompt Matching

    • For behaviors that are hard to characterize with text examples (e.g., "pretend the Eiffel Tower has moved to Rome"), instead match the behavior Bp(ctx) := Mϕ(I, p ++ ctx), i.e., the model's forward output under the target prompt p, with C taken from a general text dataset.
    • Soft logit labels are used rather than decoded text; the authors' stated reason is that soft-label training signals are stronger, and they cite the finding in knowledge distillation (Hinton et al., 2015) that soft targets "provide more information per training sample."
    • The authors state that the intensional route (making the image embedding close to the prompt embedding) is infeasible due to the modality gap, so they adopt the extensional route.

    Four attack instances (Section 3)

    • Specific string: Match the behavior of a fixed target string, simulating a phishing scenario.
    • Leak context: Match the behavior of filling the input context into an email API call template, simulating data exfiltration.
    • Jailbreak: The ideal goal is to match the behavior of a base model without RLHF; because the attacker may not have the base model, a proxy behavior is used instead—first giving an affirmative response to harmful requests; the context set is harmful content requests.
    • Disinformation (Prompt Matching): Match the "fact editing" behavior induced by the target prompt, making the model persistently lie about a certain fact.

    Constraints and training setup

    • Four constraints: unconstrained; ℓ∞-norm (||x̂−xinit||∞≤ε); stationary patch (a square learnable pixel block at a fixed position); moving patch (the patch position is uniformly randomly sampled each batch, and likewise random at evaluation).
    • Training uses SGD: specific string learning rate 3 (patch)/0.03 (others), leak context 0.3 (patch)/0.03, jailbreak searched over [0.03, 0.3, 1.0]; disinformation learning rate 3, up to 30,000 steps.
    • Training cap 12 hours (NVIDIA A100-SXM4-80GB); the checkpoint is selected by validation-set success rate, then test-set results are reported.
    • Ensembled Behaviour Matching: Sum the Behaviour Matching losses of two models to optimize a single image, used to study cross-model transfer (Equation 2).
  4. What experiments did the paper conduct?

    Evaluates four attack types on LLaVA-13B, all with success rates above 80%; the GCG text baseline lags behind; cross-model transfer is 0%.

    Experimental Setup

    • Target models: Main experiments are on LLaVA LLaMA-2-13B-Chat (CLIP ViT-L/14 + LLaMA-2-13b-Chat); transfer experiments use InstructBLIP-Vicuna-7b and BLIP-2 Flan-T5-XL.
    • Datasets: specific string / leak context / ensemble experiments use Alpaca training set instructions (52,000 pairs); jailbreak uses the AdvBench harmful behaviours dataset; disinformation uses 52,000 Alpaca prompts plus 3,000 "repeat the previous sentence" prompts in 10 variants (82,000 total).
    • Sample sizes: specific string validation/test each 100 / 1,000 held-out instructions; jailbreak validation/test each 25 / 100; disinformation validation/test each 20 questions.
    • Success criteria: specific string requires the output (after stripping leading and trailing whitespace) to exactly match the target string; leak context requires the output to match the API template and the body to contain the user context; jailbreak is judged by the Zou et al. (2023) criterion of whether the model makes a "reasonable effort" to complete the request; disinformation is the proportion of answers consistent with "the Eiffel Tower is in Rome".
    • Evaluation method: jailbreak validation set is auto-scored with GPT-3.5-turbo, test set is human-evaluated; disinformation validation set uses GPT-3.5, test set is human-evaluated.
    • Baseline: GCG text attack, 32 adversarial tokens, with blank image input on LLaVA LLaMA-2, using the same training/test data.

    Main Results

    According to Table 1 (LLaVA-13B, values are success rates; "-" is a combination not run in the paper):

    Swipe horizontally to read the table

    ConstraintSpecific stringLeak contextJailbreak
    ℓ∞ ε=32/255100%96%90%
    ℓ∞ ε=16/25599%90%92%
    ℓ∞ ε=8/25599%73%92%
    ℓ∞ ε=4/25594%80%76%
    ℓ∞ ε=2/2550%0%8%
    Stationary patch 100px100%92%-
    Moving patch 200px99%36%-
    Unconstrained100%100%64%
    Original image0%0%4%
    Text Baseline (GCG)13.5%0%82%
    • The authors state that specific string hijack at ε≥4/255 is fairly successful; a stationary patch of 60×60 pixels (7% of the image) reaches 95%, and a moving patch requires 160×160 (51%) to reach 98%.
    • The authors suggest the leak context success rate is lower than specific string under the same constraint possibly because it must both output a character-level exact template and correctly fill in the context.
    • The authors state that the GCG text baseline lags behind the image attacks on all three attack types at ε=8/255 and above; GCG's specific string average Levenshtein distance is 11.82 and leak context is 93.69.

    Prompt Matching (disinformation)

    • According to Table 2: unconstrained hijack success rate is 85%, ε=64/255 is 70%, ε=32/255 is 40%, ε=8/255 drops to 5%, ε≤4/255 and the untrained baseline are both 0%; the target prompt itself is 100%, and the authors note it upper-bounds hijack performance.
    • The authors state that hijack is not just repeating the prompt but can generalize to related knowledge questions (e.g., when answering about the river next to the Eiffel Tower, giving a river located in Rome).

    Transferability (Section 4.5)

    • Context transfer: The authors state that hijack is effective on held-out user inputs, e.g., the specific string attack at ε=32/255 has a context transfer rate of 100% (Table 1 test set).
    • Single-model transfer: A specific string hijack trained on LLaVA-13B tested on BLIP-2 Flan-T5-XL, and the reverse training and testing, both directions have a success rate of 0%.
    • Ensemble transfer: A single hijack trained with Ensembled Behaviour Matching on LLaVA-13B + InstructBLIP-Vicuna-7b has success rates of 99.8% and 80.6% on the two training models respectively, and 0% on held-out BLIP-2 (Table 4). The authors note that in Figure 4 the BLIP-2 validation loss drops from about 5 to the [3,4] range, and suggest that increasing ensemble size may improve transfer; in informal tests, the disinformation attack also did not transfer to held-out models.

    Defense Evaluation (Section 4.6, preliminary)

    • Noise defense: Add Unif(0,a) noise to pixels; the authors report that the moving patch attack remains robust to high-intensity noise, and hijack with higher ℓ∞ constraints is more robust (Figure 5, top; specific values are not labeled in the figure).
    • JPEG compression defense: The authors report that moving patch hijack remains robust to high compression rates (Figure 5, bottom).
    • The authors note that hijack was not trained against these defenses, and the defense evaluation used only an Alpaca subset due to compute limits, so the investigation is preliminary only.

    Other Ablations and Analysis

    • Jailbreak performance drop at large ε: unconstrained success rate 64% is lower than 92% at ε=8/255; after observing failure cases, the authors believe the model overfits to exactly matching the training label rather than actually answering the request.
    • Non-zero jailbreak baseline: the unmodified Eiffel Tower image has a 4% success rate; the authors hypothesize that LLaVA fine-tuning weakened the base model's RLHF safety training (citing Qi et al., 2023b).
    • Initialization image robustness (Appendix B): training leak context attacks (ε=32/255) with 5 random ImageNet images gives an average success rate of 90% with a standard deviation of 2%.
    • Interpretable features of moving patch (Appendix A): the authors report that the moving patch learns high-level features such as text and objects (Figure 6), and hypothesize that random positions prevent the attack from overfitting to specific circuits.
  5. What are some points that can be further explored?

    The authors state that defense research is only preliminary and transferability is not achieved; experiments are limited to 3 open-source models and two simple defenses.

    Limitations and future directions noted by the authors

    • Defense research is only preliminary (Section 4.6): Only two simple defenses, added noise and JPEG compression, are examined; the authors encourage future work to explore more diverse evaluation datasets, defense mechanisms, and Behaviour Matching variants that can generate more robust attacks.
    • Attacks are not trained against defenses (Section 4.6): The authors note that future image hijacking algorithms could incorporate defenses into the attack process to generate attacks that are harder to defend against.
    • Cross-model transfer is not achieved (Section 4.5): The jointly trained hijack has a 0% success rate on the held-out model; the authors encourage future work to explore larger ensemble sizes to test whether model transfer can be achieved.
    • Attacks are limited to white-box open-source models (Impact Statement): The authors state that such attacks remain important—vulnerabilities in open-source models suggest that closed-source models may have similar weaknesses, and many user-facing applications are built on open-source models.
    • Defense research requires caution (Impact Statement): The authors cite the obfuscated gradients phenomenon (Athalye et al., 2018), cautioning that defense research should focus on certified defenses.
    • More attack types may exist (Impact Statement): The authors speculate that image hijack may also enable more attacks not yet discovered.

    Scope of experiments

    • There are 3 target models tested: LLaVA LLaMA-2-13B-Chat (main experiments), InstructBLIP-Vicuna-7b and BLIP-2 Flan-T5-XL (transfer experiments only), all open-source models.
    • There are 4 attack types: specific string, leak context, jailbreak, disinformation; constraints are unconstrained, ℓ∞ (ε from 1/255 to 64/255), stationary patch (40–100px), moving patch (120–200px).
    • The text baseline is only GCG, with 32 adversarial tokens; defense evaluation covers only two types, added noise and JPEG compression, and due to compute limits uses only a subset of Alpaca instructions (Section 4.6).
    • Test set sizes: specific string 1,000, jailbreak 100, disinformation 20 (n=20); the jailbreak and disinformation test sets are human-evaluated, and the validation set uses GPT-3.5(-turbo).
    • The paper does not report the specific number of training steps (except disinformation at up to 30,000 steps), the training time for each attack (except the 12-hour cap), or the number of human evaluators and their agreement.
  6. Summarize the main content of the paper

    Proposes image hijack and Behaviour Matching; on LLaVA-13B, success rates for all four attack types exceed 80%, and the text baseline lags behind.

    An attack study on a VLM being controlled at runtime by adversarial images, proposing the image hijack concept and a general training framework, Behaviour Matching.

    • Problem: The VLM's continuous image input introduces a new attack surface; the authors envision a VLM assistant that can access untrusted data, holds private information, and can execute API operations; if an image can control its output, it can control its behavior.
    • Method: Freeze the VLM and use projected gradient descent to optimize the image over a large number of contexts (e.g., the Alpaca instruction set) so that the model's output logits match the target behavior; the derived Prompt Matching uses soft logit labels to make the image imitate the behavior induced by an arbitrary text prompt, bypassing the modality gap.
    • Main results: On LLaVA LLaMA-2-13B-Chat, the specific string attack with ε=32/255 has a 100% success rate, leak context under the same constraint 96%, jailbreak with ε=8/255 92%, and disinformation unconstrained 85% (the target prompt itself 100%); the authors report that the success rates of all four attack types exceed 80%.
    • Comparison with text attacks: The GCG text baseline lags on all three attack types at ε=8/255 and above (specific string only 13.5%, leak context 0%); the authors state that image attacks are currently a stronger attack vector on multimodal models.
    • Transfer and defenses: The hijack trained on a single model and the hijack trained on an ensemble of two models both have a 0% success rate on the held-out model (BLIP-2), but the ensemble hijack reaches 99.8% and 80.6% on the two training models respectively; the authors believe there are weaknesses shared across models; the moving patch hijack remains robust to two simple defenses, added noise and JPEG compression (preliminary results).
    • Authors' conclusion: Image hijack can be constructed automatically, has small perturbations, and can control model output at a fine granularity; the authors believe defense research needs to advance and that the obfuscated gradients problem must be guarded against, and speculate that closed-source models may have similar weaknesses.

Related papers

Read originalarxiv.org