System Prompt Extraction Attacks Against Vision-Language ModelsSystem Prompt Extraction against Vision-Language Models
The authors propose DISPEL, using DDPO to fine-tune a diffusion model to generate images that extract system prompts; in the gray-box setting, the average EM across 12 conditions is 0.405, higher than M-PLeak's 0.149.
The attacker submits images and text as an ordinary user to induce the VLM to leak the hidden system prompt. Under gray-box, the attacker can write into the shadow model's system slot and read the negative log-likelihood of selected outputs, but has no access to parameters, gradients, or activations; under black-box, only the target's replies are observed, and training relies on a shadow VLM and 16 public auxiliary prompts.
- Existing system prompt extraction and defenses mainly center on the text channel, whereas VLMs place visual tokens and text in the same representation space. The authors study whether an attacker can recover a deployed hidden system prompt through image input alone.
- DISPEL uses Stable Diffusion v1.5 as the generator and fine-tunes it with LoRA and DDPO reinforcement learning; the reward is the length-normalized log-likelihood of the shadow VLM reproducing known auxiliary system prompts, requiring no backpropagation through the VLM. At deployment, 16 images are generated, and then one reconstruction is selected from the candidate replies.
- The experiments cover four open-source VLMs, three prompt datasets, and three types of defenses. In the gray-box setting, DISPEL's average EM is higher than M-PLeak and handcrafted queries, but lower than VJAP-Leak; in black-box transfer, its off-diagonal average EM is higher. Purification and refusal instructions fail to prevent leakage, and adaptive image detection only reduces part of exact extraction.
- The experiments use only public models and controlled prompts and do not attack third-party production systems; the targets are four 7B–13B open-source VLMs. The authors note that real attackers lack ground-truth prompts and need indirect strategies such as behavioral equivalence and cross-query consistency to judge success; output filtering also faces paraphrased or encoded leakage and utility costs.
- Evaluated models
- Idefics2Qwen2-VLMiniGPT-4LLaVA-1.5Adaptive CLIP-feature logistic-regression detector
- Metrics
- Exact Match (EM)Sub-string Match (SM)Semantic Similarity (SEM)model-based recall (MR)AUCTPR@5%
The authors propose DISPEL and claim it is the first attack that extracts hidden system prompts from vision-language models (VLLMs) entirely through the image modality. The method formulates adversarial image generation as a reinforcement learning policy problem, fine-tunes a pretrained diffusion model with LoRA, and encodes the adversarial signal in image semantics rather than superimposed perturbations, so that the generated images both induce system prompt leakage and resist purification-based defenses. The paper notes that visual tokens are projected into the text embedding space, making the image an equal input to the decoder alongside the system prompt, an attack surface that text-only defenses do not cover. Evaluations on multiple VLLMs and datasets show that DISPEL successfully extracts hidden system prompts and significantly outperforms state-of-the-art text-only attack baselines on exact-match metrics.
Related events and news
1 events · 0 news mentions
- This event's paper
DISPEL 通过图像模态提取视觉语言模型隐藏系统提示词
Paper analysis
What problem does this paper attempt to solve?
Studies whether a VLM's hidden system prompt can be extracted through the image channel alone, and tests existing text and perturbation defenses.
The core question is: can an attacker, using only visual input, make a deployed VLM leak its confidential system prompt, and generalize across unseen prompts and different models?
- Problem setting: The system prompt carries the application's role, task specifications, safety constraints, and business logic, and the authors treat it as an asset that depends on confidentiality; once leaked, it may be used to replicate the application, circumvent constraints, or obtain attached retrieval context.
- Gap in prior research: The authors state that existing extraction attacks all use text interaction, and the visual channel has not been studied; visual tokens and text tokens enter the same embedding space and attention layers, so images are also input to the decoder that processes the system prompt.
- Core design assumption: Rather than superimposing additive perturbations on clean images, the authors have a diffusion generator encode the adversarial signal into image semantics, so that it does not depend on text injection and does not take the form of the high-frequency noise targeted by perturbation-aware purification methods.
- Proposed method: The paper proposes DISPEL (DIffusion-guided System Prompt Extraction via reinforcement Learning), which fine-tunes Stable Diffusion with DDPO and LoRA, uses the likelihood of a shadow VLM reproducing known prompts as the reward, and evaluates gray-box, black-box transfer, and three types of defenses.
- Threat model:
- Goal: Recover the application's hidden system prompt s, or obtain an approximate reconstruction of it; success is judged by an evaluation oracle that holds the ground truth.
- gray-box capability: Can write self-chosen prompts into the shadow model's system slot and read the sequence negative log-likelihood of chosen outputs; cannot access parameters, gradients, or activations.
- black-box capability: At deployment, only submits images and text and observes replies, does not know the target prompt, and cannot read log-probability; training relies on a controlled shadow VLM.
- Auxiliary knowledge and victim system: The attacker holds 16 public auxiliary prompts and knows the input template; the victim system is a VLM application that prepends a secret system prompt and accepts image and text queries.
What related research exists?
Related work covers text prompt extraction, VLM image attacks, and prompt defenses; this paper turns to transferable visual extraction.
Text system prompt extraction
- Perez and Ribeiro (2022); Zhang, Carlini, and Ippolito (2023): The former documents prompt leaking; the latter systematically evaluates text attacks on 11 LLMs and three prompt datasets, and uses a high-precision verifier to distinguish genuine extraction from hallucination; Claude and ChatGPT were also tested.
- Yu et al. (2023): Evaluates more than 200 deployed OpenAI Custom GPTs; the authors relay its result as near-universal susceptibility to extraction, and connect prompt confidentiality with the confidentiality of data uploaded by designers.
- GCG, AutoDAN, and PLeak: The first two are discussed as gradient-based and search-based jailbreak mechanisms; PLeak formulates extraction as incremental discrete optimization over target prompt tokens, and is the source of this paper's optimization-based text baseline.
Model inversion and multi-turn extraction
- Morris et al. (2024) and OUTPUT2PROMPT (2024): The former trains a decoder from victim model logits; the latter removes the logit access requirement and inverts ordinary text outputs; the paper notes that such attacks do not leave jailbreak-like signatures in request logs.
- Zheng et al. (2026): Studies extraction in multi-turn and agent deployments, and discusses the attack surface introduced by conversation state and tool use; the paper only describes it and does not use it as an experimental baseline.
VLM security and privacy attacks
- Cross-modal jailbreaks and indirect prompt injection: One line of work combines adversarial or typographic images with normal text to bypass safety constraints; another studies images in third-party media triggering indirect injection after submission by benign users.
- Membership inference and Image Hijacks (2023): The former targets training-data membership; the latter uses adversarial images to force VLMs to output context tokens. The paper explicitly criticizes it as limited to white-box, single-model settings with near-zero transfer, whereas this paper studies targeted, transferable, black-box system prompt extraction.
Defenses and experimental baselines
- Prompt, output, and training defenses: The paper discusses refusal instructions, output filtering based on n-gram overlap, Instruction Hierarchy, and ProxyPrompt; the authors state that none of these defenses is designed or evaluated for the visual modality, and that training-time defenses additionally require cooperation from the model provider.
- Experimental baselines and datasets: VJAP-Leak is modified to optimize image perturbations to extract prompts, M-PLeak extends PLeak to text optimization under a fixed image, and Zhang et al. uses fixed handcrafted queries; all three are compared on ChatGPT-Roles, Awesome-ChatGPT-Prompts, and Unnatural Instructions.
The authors position this paper as a test of the premise that "the attack surface lies only in text": rather than optimizing only text or additive visual perturbations, they train an image generator and separately examine prompt generalization and model transfer.
How does the paper address this problem?
DISPEL uses the shadow VLM's prompt-reproduction likelihood as the reward and trains a diffusion image generator with DDPO and LoRA.
The overall idea is to train DISPEL to generate images that carry adversarial semantics, rather than optimizing pixel perturbations on a fixed image. Training requires only forward scoring by a shadow VLM; at deployment, the generated images and fixed text queries are given to the target model, and one reconstructed prompt is selected from multiple candidate replies.
Problem Setting and Access Conditions
- Extraction target: the developer places a secret system prompt s in the system slot, the attacker submits images and text and obtains replies; a reconstruction function obtains ŝ from n replies, requiring it to equal or approximate s. A single query is n=1, and DISPEL uses multiple queries followed by selection.
- Basis for the visual channel: visual tokens enter the same attention computation together with the system prompt and user text; the authors accordingly treat images as a continuous, high-dimensional input channel, rather than directly moving text jailbreak prompts into images.
- Difference between training and deployment: during training the attacker knows the prompt in the shadow model's system slot and scores its reproduction; during deployment the target prompt is unknown. Training and test prompts are disjoint to test prompt generalization; if the shadow and target differ, model transfer is tested.
Generator and Extraction Reward
- Generative attack: the backbone is Stable Diffusion v1.5, and only the UNet is fine-tuned via LoRA, with the text encoder and autoencoder frozen. Compared with additive perturbation methods, the optimization changes the semantic content depicted in the image rather than superimposing an independent noise layer.
- Reward definition: for a training prompt of length |s|, the reward is r(ximg,xtext;s)=1/(|s|)log pFS(s∣ s,ximg,xtext), i.e., the average per-token log-likelihood of the shadow model reproducing that prompt conditioned on the image, fixed text, and system slot.
- Optimization objective: maximize the expected reward over the training prompt distribution and diffusion sampling trajectories, updating only the LoRA parameters. The expectation over Dtrain is used to learn extraction behavior not tied to a single prompt.
DDPO Training and Deployment Reconstruction
- Policy optimization without VLM gradients: DDPO treats the diffusion denoising trajectory as an MDP and assigns reward only on the final image; the importance-sampling policy gradient is backpropagated only to the LoRA, and the shadow VLM serves only as a reward oracle.
- Training configuration: Dtrain contains 16 prompts randomly sampled from the corresponding experimental dataset; 128 trajectories are collected each time, with DDIM using 50 steps, η=1.0, and guidance weight 5.0. Training runs for 800 steps with AdamW learning rate 3e-4 and DDPOIS clip range 1e-4 (Table 9, Appendix A.4).
- Queries and reconstruction: at deployment, the 16 training prompts are each used as diffusion text conditions, generating K=|Dtrain|=16 images and querying once each. A learned scorer scores replies together with other candidates, filters by threshold τ, and then groups candidates by normalized text for voting; if no candidate passes the threshold, the highest-scoring one is chosen, and one reply is always selected without concatenation.
Baseline Adaptation and Success Determination
- Three comparisons: VJAP-Leak optimizes image perturbations via gradients of the target vision encoder, using α=1 and ε=32/255; M-PLeak fixes a clean image and optimizes the text query; Zhang et al. uses 5 manual queries and their 100 rewrites with a clean image, with K of 5 or 105, respectively.
- Fair conditions: VJAP-Leak, M-PLeak, and DISPEL use the same 16-prompt Dtrain; DISPEL's fixed text input is taken from Zhang et al.'s manual queries, with the variant selected per model. Appendix Table 8 gives the complete queries.
- Metrics and determination: EM requires the reconstruction to be exactly identical to ground truth after removing punctuation; SM requires the ground truth to appear as a contiguous substring in the output; SEM is the cosine similarity of the two sentence embeddings. Success evaluation uses ground truth, and this signal is not assumed to be available to a real-world attacker.
What experiments did the paper conduct?
On four open-source VLMs and three datasets, DISPEL achieves a gray-box average EM of 0.405 and outperforms perturbation baselines in black-box transfer.
Experimental Setup
- Models evaluated: Idefics2, Qwen2-VL, MiniGPT4, LLaVA-1.5, all in publicly available 7B–13B weight configurations; the vision encoder, projection module, and language backbone differ across models, with architectures given in Appendix A.1.
- Datasets: ChatGPT-Roles uses all 256 entries, Awesome-ChatGPT-Prompts uses all 187 entries, and Unnatural Instructions uses 256 randomly sampled entries; Dtrain for optimization is randomly sampled from the corresponding experimental dataset with 16 entries, and testing uses held-out prompts.
- Baselines and access: VJAP-Leak and M-PLeak are white-box, Zhang et al. is black-box, and DISPEL is gray-box. In Table 1, each method is optimized and deployed on the same model; Table 2 distinguishes shadow source models from different target models.
- Metrics: EM and SM measure exact or substring matching after removing punctuation, and SEM measures sentence-embedding cosine similarity; MR measures reconstruction confidence, and the detection experiment reports AUC and TPR at 5% benign FPR.
- Query budget: VJAP-Leak and M-PLeak use K=1 per prompt, Zhang et al. uses K=105 (also K=5), and DISPEL uses K=|Dtrain|=16; main results are the average over 3 seeds, and Table 1 also lists standard deviations.
- Evaluation method: main results are computed automatically from ground truth without an LLM judge; candidate ranking for Zhang et al. follows its DeBERTa recall-score model. The paper does not report human evaluation or human agreement.
Main Results
The table below is taken from the gray-box results in Table 1, with values being EM; each method is optimized and deployed on the same model, and DISPEL's target model is also its shadow model.
Swipe horizontally to read the table
Model Dataset VJAP-Leak (white-box) M-PLeak (white-box) Zhang et al. (black-box) DISPEL (gray-box) Idefics2 ChatGPT-Roles 0.882 0.022 0.015 0.819 Qwen2-VL ChatGPT-Roles 0.947 0.000 0.000 0.426 MiniGPT4 ChatGPT-Roles 0.779 0.000 0.000 0.454 LLaVA-1.5 ChatGPT-Roles 1.000 0.665 0.000 0.997 Idefics2 Awesome-ChatGPT 0.419 0.160 0.002 0.409 Qwen2-VL Awesome-ChatGPT 0.681 0.059 0.000 0.268 MiniGPT4 Awesome-ChatGPT 0.086 0.000 0.000 0.200 LLaVA-1.5 Awesome-ChatGPT 0.741 0.253 0.079 0.496 - Across all conditions: the authors report that DISPEL's average EM across the 12 model×dataset conditions is 0.405, M-PLeak's is 0.149, and Zhang et al.'s is 0.019; DISPEL leads M-PLeak on EM and SM in 11/12 conditions, with the exception being LLaVA-1.5/Unnatural Instructions.
- Comparison with manual queries: DISPEL has higher EM in 12/12 conditions, but higher SM in only 6/12 conditions. The authors take Idefics2/Awesome-ChatGPT as an example, where Zhang et al.'s SM is 0.822 and DISPEL's is 0.568, while the former's EM is only 0.002, thereby distinguishing content disclosure from verbatim recovery.
- Comparison with gradient perturbation: VJAP-Leak achieves the highest EM in 11/12 conditions; DISPEL's average SEM differs from VJAP-Leak's by 7.6 percentage points. The authors emphasize that VJAP-Leak here has stronger white-box privileges and requires no transfer, so this ranking cannot be directly extrapolated to black-box deployment.
Black-Box Cross-Model Transfer
- Test method: Table 2 reports EM from four source models to four target models, for 16 directed combinations per dataset; source differing from target is transfer, and the diagonal is the matched condition. DISPEL's generated images and fixed text are used unchanged for the target, and Zhang et al. does not depend on the source model.
- Transfer results: the off-diagonal average EM in Table 11 shows that DISPEL is 0.400, 0.281, and 0.076 on ChatGPT-Roles, Awesome-ChatGPT, and Unnatural, respectively, while VJAP-Leak is 0.034, 0.130, and 0.073; the corresponding improvement factors are listed by the paper as 11.8×, 2.2×, and 1.04×.
- Exceptions and authors' interpretation: on Unnatural the two are close, and the authors state that prompt heterogeneity is a constraint; Qwen2-VL→LLaVA-1.5 and MiniGPT4→LLaVA-1.5 reach EM of 0.966 and 0.973 on ChatGPT-Roles, respectively. Regarding the reasons for differences across source models, the authors only state a "conjecture" that it is related to the degree of coupling with architecture-specific visual features.
Three Types of Defenses
- DiffPure input purification: Figure 3 sweeps t∈{0,10,50,150,250}; the main text reports that VJAP-Leak approaches zero by t=50 on Idefics2, MiniGPT4, and LLaVA-1.5, while DISPEL only shows an initial decline and then remains stable. Qwen2-VL is an exception, with both methods converging to similar values after purification; the translated text does not provide point-by-point values that can be checked back.
- Refusal instruction: in Table 3, on Idefics2/ChatGPT-Roles, DISPEL's EM/SM/SEM are 0.592/0.761/0.967 and VJAP-Leak's are 0.602/0.718/0.928; on Qwen2-VL with the same dataset, DISPEL is 0.727/0.828/0.964 and VJAP-Leak is 0.769/0.769/0.874. The authors accordingly state that the protection of refusal instructions is inconsistent across architectures, with DISPEL leading on SM and SEM but not on EM.
- Adaptive image detection: the detector uses images from one attack run as positives and base Stable Diffusion images as negatives, trains logistic regression on CLIP features, and tests on an independent run. In Table 4, Idefics2/ChatGPT-Roles has AUC 0.95 and TPR@5% 0.63, with 6 of 16 passing, EM dropping from 0.82 to 0.32 and SM from 0.95 to 0.82; Qwen2-VL/Awesome-ChatGPT has AUC only 0.64, with EM going from 0.27 to 0.25. The authors state that detection reduces exact extraction but does not prevent content leakage.
Other Ablations and Analyses
- Input modality (Table 5, Unnatural gray-box): Idefics2's fine-tuned generator has EM 0.500, fixed images and pretrained SD images have 0.094 and 0.121, respectively, and text-only has 0.000.
- Reward (Table 6): unweighted logprobs are higher than weighted-logprobs on EM, SM, and SEM for all four models; for example, Qwen2-VL's EM is 0.398 versus 0.250.
- Training set and number of queries (Table 7): |Dtrain|=K goes from 4, 8, 16 to 24; Idefics2's EM is 0.188, 0.188, 0.500, 0.262, and Qwen2-VL's is 0.250, 0.188, 0.398, 0.235, declining after 16.
- Temperature (Table 12): β∈{1.0,0.5,0.25,0.1,0.01}; Idefics2's EM is in the range 0.301–0.531, and Qwen2-VL's is in the range 0.379–0.410.
- Distribution shift (Table 13): on Idefics2, the distance demb to the nearest training prompt is 0.466–0.663, and SM is 0.410–0.849; the correlation between distance and SM is −0.060 on ChatGPT-Roles and −0.137 and −0.133 on the other two datasets.
- Failure cases (Tables 14–15): the appendix shows exact matches, substring-only matches, and complete failures; failed replies include describing the image rather than leaking the prompt, with examples covering English, French, and Chinese prompts.
What are some points that can be further explored?
The authors discuss success determination without ground truth and the cost of output defenses; the experiments are limited to four open-source models and controlled public prompts.
Limitations and Future Directions Noted by the Authors
- Real-world attacks lack ground-truth determination (§9 "Real-world Attack Deployment"): the authors note that in actual deployment it is impossible to directly know whether extraction succeeded, and propose behavioral equivalence tests, cross-query consistency, and textual structural cues as indirect strategies; these are proposals in the discussion, not completed experiments.
- Output filtering involves a trade-off between leakage forms and utility (§9 "Defending the surface"): the authors state that verbatim output filtering can prevent exact and substring leakage, but paraphrased or encoded reproduction can bypass it; fuzzy matching in turn incurs a utility cost on normal answers, so they suggest combining output filtering with image-channel detection.
- Applicability conditions of differential privacy defenses (§9 "Differential Privacy-Based Defenses"): the authors state that such methods involve a privacy–utility trade-off; the works discussed respectively require public example data or tie the number of generatable tokens to a privacy budget, and may not be suitable for proprietary system prompts.
- Future defense directions (§10 Conclusion): the authors believe defenses must jointly consider both input modalities, rather than relying only on unimodal measures targeting text or additive perturbations.
Scope of Experimental Coverage
- Model scope: the targets are four publicly weighted VLMs, Idefics2, Qwen2-VL, MiniGPT4, and LLaVA-1.5, in 7B–13B configurations; no attacks are conducted against third-party production deployments (Appendix A.1, Ethical Considerations).
- Data scope: public research prompts from ChatGPT-Roles, Awesome-ChatGPT-Prompts, and Unnatural Instructions are used, with main test set sizes of 256, 187, and 256 entries, respectively; the training auxiliary set has 16 entries (§6.1).
- Defense scope: DiffPure, system prompt refusal instructions, and adaptive CLIP-feature logistic regression detection are tested empirically; output filtering and differential privacy defenses are discussed in §9 without experimental results.
- Repetition and budget: main tables and transfer results use 3 seeds; DISPEL by default queries each target prompt 16 times, and Appendix A.5 analyzes k via subsets of the existing 16 candidates without new queries.
- Unreported information: the paper does not report human evaluation or human agreement for the main experiments, nor the time and actual API cost for each method to complete a full attack.
Summarize the main content of the paper
DISPEL extends system prompt extraction to the image generation channel and provides gray-box, transfer, and defense evaluations.
DISPEL is a system prompt extraction attack against VLMs: the attacker uses ordinary images and text queries to induce the application to output its hidden instructions, focusing on testing whether the visual channel can substitute for existing text attack channels.
- Problem and permissions: The system prompt is treated as a confidential asset. During training, the attacker can only write auxiliary prompts into a shadow VLM and read sequence likelihoods, and cannot obtain its gradients; in black-box deployment, the attacker only observes target replies, and test prompts are separated from the training set.
- Method highlights: DDPO reinforcement learning and LoRA are used to fine-tune Stable Diffusion v1.5, with the reward being the average token log-likelihood of the shadow model reproducing known prompts. After training, 16 images are generated, each used to query the target, and then one reconstruction is selected from candidate replies via scoring, thresholding, and voting.
- Gray-box results: On 12 conditions across four models and three datasets, DISPEL achieves an average EM of 0.405, higher than M-PLeak's 0.149 and Zhang et al.'s 0.019; however, white-box VJAP-Leak has the highest EM in 11/12 conditions, so DISPEL cannot be called comprehensively leading on this basis.
- Transfer results: In Table 11, DISPEL's off-diagonal average EM on ChatGPT-Roles is 0.400, versus 0.034 for VJAP-Leak; on Unnatural the two are 0.076 and 0.073 respectively, and the authors attribute the limitation here to prompt heterogeneity.
- Defense results: DiffPure has a greater effect on perturbation baselines, and refusal instructions do not consistently prevent extraction; adaptive image detection reduces DISPEL's EM from 0.82 to 0.32 on Idefics2/ChatGPT-Roles, but SM remains 0.82, indicating that a drop in exact match does not mean the content is no longer leaked.
- Authors' conclusion: The authors state that the visual modality constitutes an extraction surface not covered by text defenses, and recommend combining output filtering with image-channel detection. Their experiments involve only public models and controlled prompts; ground-truth-free judgment, paraphrase or encoded leakage, and the utility cost of filtering in real attacks remain at the discussion level.
Research lineage
9 foundations · 0 follow-ups in library- Cites2023-07Universal and Transferable Adversarial Attacks on Aligned Language Models§ 2.1 Prompt Extraction Attacks against LLMs
- Cites2025-05ProxyPrompt: Securing System Prompts against Prompt Extraction Attacks§ 2.1 Prompt Extraction Attacks against LLMs
- Cites2026-01Just Ask: Curious Code Agents Reveal System Prompts in Frontier LLMs§ 2.1 Prompt Extraction Attacks against LLMs
- Cites2024-04The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions§ 2.1 Prompt Extraction Attacks against LLMs
No later in-library follow-ups recorded yet.
“As models are aligned against hand-written queries, attackers adapted gradient- and search-based jailbreak mechanisms, notably GCG [50] and AutoDAN [22], to the extraction objective.”