MacPrompt: Hybrid-Language Guided Jailbreak Attack Against Text-to-Image ModelsMacPrompt: Maraconic-guided Jailbreak against Text-to-Image Models
MacPrompt performs a black-box cross-lingual attack on T2I; in Table 1, for Sex and SD, the ASR-5 is 96%.
A black-box adversary does not access F and G's parameters or structure, and can only submit prompts and observe images or rejections. G includes SD with filters and concept removal models. The goal is to bypass F and make the generated image contain harmful content and be similar to the original prompt's image.
- T2I generates NSFW content and forbidden objects. The authors state that filters and concept removal cannot stop diverse adversarial prompts, and attacks that can bypass both types of defenses at the same time often require internal information from the model. The goal is to perform a black-box cross-lingual attack without accessing the internals.
- First use a blacklist and embedding similarity to find sensitive words, then use an LLM to obtain multilingual candidates, and keep the top-k by image harm score and CLIP similarity. Then concatenate at the character level according to learnable boundaries and order, and use zeroth-order optimization to push the detection score toward 1.
- In Table 1, blacklist's BPR is 100%, Sex's ASR-5 on SD is 96%, and Violence's on SafeGen is 90%. In Table 2, Dog's ASR-5 on SD is 100%. Commercial ASRs are DALL·E 3's 65% and Doubao's 96%.
- The Conclusion does not list the method's limitations, only stating that it can serve as a reference for subsequent research on safe generation. The experiments are described as covering SD v2.1, nine concept removal methods, DALL·E 3, and Doubao; the candidate LLM name, τ, number of queries, and human agreement are not reported.
- Evaluated models
- SD v2.1ESDSLDSafeGenFMNDUOEAPPromptGuardDALL·E 3DoubaoLatentGuardBERT-based NSFW text classifier
- Benchmarks
- NSFW-200Object-200
- Metrics
- ASR-1ASR-5BPRCLIPScoreBLIPScore
The researchers propose MacPrompt, a black-box cross-lingual attack that constructs hybrid-language adversarial prompts by performing cross-lingual character-level recombination of harmful words, bypassing the safety filters of text-to-image models. The method achieves semantic similarity with the original harmful input up to 0.96, bypasses major safety filters in up to 100% of cases; attack success rates reach up to 92% for sexual content and 90% for violent content, breaking current concept removal defenses. The authors argue that the robustness of existing T2I safety mechanisms against linguistically diverse, fine-grained adversarial strategies needs to be reassessed.
Paper analysis
What problem does this paper attempt to solve?
Black-box cross-lingual character recombination, used to bypass both T2I text filtering and concept removal.
Existing T2I text filtering and concept removal cannot stop cross-lingual adversarial prompts that do not rely on model internal information and target both types of defenses simultaneously.
- Scenario: The authors state that mainstream T2I models trained on large-scale web data may generate NSFW or prohibited objects; online services and open-source SD use text filtering, image filtering, and concept removal to intercept, but these defenses can still be bypassed by adversarial prompts.
- Existing gaps: The authors state that existing attacks typically bypass only one of built-in filtering or concept removal; methods that bypass both generally require additional information like target structure, unsuitable for real black-box settings. They also state that methods relying on synonym substitution are ineffective against text filtering.
- Observation: The authors state that non-English prompts can also generate semantically similar images on original SD and concept-removal variants fine-tuned from SD (Figure 1); directly switching languages may still be caught by semantic matching or latent representation filtering. Based on this, they perform character-level cross-lingual recombination to widen textual semantics while preserving visual semantics.
- Method: The authors propose a black-box attack MacPrompt, which replaces sensitive words with macaronic substitutions formed by recombining character substrings of multilingual equivalents.
- Threat Model:
- Goal: Construct padv such that F(padv) is False, and G(padv) contains harmful content, and is visually and semantically aligned with G(pori).
- Knowledge: Black-box. Cannot access the internal parameters or structure of F and G.
- Capability: Submit prompts, observe returned images or whether the prompt is rejected, then modify the prompt accordingly.
- Victim System: SD with safety filters, and concept removal models. F can be a keyword blacklist, semantic matching based on a pretrained text classifier, or latent representation filtering.
What related research exists?
Defenses are divided into filters and concept removal; attacks are divided into white-box, gray-box, and black-box.
Input and Output Filtering
- George (2023) uses blacklists for text matching. Jieli (2023) trains text classifiers to distinguish harmful from harmless prompts; LatentGuard (Liu et al. 2025) performs latent representation filtering.
- Zeng et al. (2025)'s image filtering checks generated images for NSFW and returns a black image if unsafe. The authors state that DALL·E 2 and Midjourney deploy proprietary black-box filtering.
Concept Removal
- ESD (Gandikota et al. 2023) and FMN (Zhang et al. 2024a) fine-tune diffusion weights to remove NSFW concepts.
- SLD (Schramowski et al. 2023) suppresses NSFW during denoising; SafeGen (Li et al. 2024b) modifies visual self-attention to remove NSFW representations.
- DUO (Park et al. 2024) uses direct preference optimization for selective forgetting; EAP (Bui et al. 2024) argues that keeping only neutral concepts is insufficient; PromptGuard (Yuan et al. 2025) introduces safety pseudowords, optimized by type and then combined.
NSFW Attacks Categorized by Attacker Knowledge
- White-box: Chin et al. (2024), Yang et al. (2024b), Zhao, Chen, and Gao (2024), Xu et al. (2025). The authors state that here the target structure and weights are accessible.
- Gray-box: Zhuang, Zhang, and Liu (2023), Tsai et al. (2024), Ma et al. (2024), Yang et al. (2024c), Gao et al. (2024). The authors state that only partial information is available, or text and image encoders are used.
- Black-box: DACA (Deng and Chen 2023), Position (Yang et al. 2024d), DiffZOO (Dang et al. 2024), SurrogatePrompt (Ba et al. 2024), ART (Li et al. 2024a), PGJ (Huang et al. 2025). The authors state that the attacker only has the target model's generated images from prompts. The authors state that DiffZOO is the only black-box attack targeting concept removal models, and PGJ and SurrogatePrompt mainly target online platforms; they also state that methods relying on synonym substitution are ineffective against text filtering.
Cross-Lingual Clues
- Raphaël (2022) concatenates words from multiple languages to preserve the visual semantics of the original prompt. The authors state that this paper builds on this observation with character-level recombination.
- Baselines and Data: Experimental baselines are DACA, DiffZOO, ART, Position, MMP-Attack, PGJ, and SurrogatePrompt. Evaluation sets are NSFW-200 built by DeepSeek-V3 (taxonomy following I2P) and Object-200 with 200 prompts.
The authors position MacPrompt as a black-box framework that does not access model internals, gradients, or tokenizers, used to bypass both text filtering and concept removal, and state that defenses beyond monolingual assumptions and simple keyword matching need reconsideration.
How does the paper address this problem?
After sensitive word filtering, cross-lingual candidates are generated, and then zeroth-order optimization is used to assemble character-level macaronic replacements.
Given a harmful prompt pori, a filter F and a target G, MacPrompt replaces sensitive words with macaronic words formed by recombining characters across languages, so that the prompt bypasses F while the generated image still carries the target harmful semantics. The image harm score serves as feedback, and the parameters are updated with zeroth-order optimization (Figure 2).
Problem setup
- The objective is written as F(padv)=False, G(padv)≈G(pori) (Equation 1): False means bypassing F, and ≈ means the generated image is visually similar to the image from the original prompt. The authors also require the generated image to contain harmful content and the two images to be semantically aligned.
- The authors say that if the new word is formed by concatenating tokens consistent with the tokenization of the original sensitive word, image semantics are more likely to be preserved. However, SD's tokenization of low-resource or non-Latin languages is often irreversible, making it hard to reverse-engineer a string that lands exactly on the target token sequence, so character-level construction is used instead.
Sensitive word identification and candidate filtering
- Identification: Blacklist matching against a predefined harmful word list (the list comes from Yang et al. 2024b); or computing the maximum cosine similarity between the word embedding and pre-collected harmful concept embeddings, marking it sensitive if it exceeds τ. The paper does not give τ.
- Candidates: Each sensitive word is translated or rewritten by an LLM into L languages, usually L=79. The paper does not name the LLM.
- Filtering: For NSFW, candidates are placed into templates containing people; for prohibited objects, an image template containing only that word is used; 10 images are generated for each. H is the probability of the target class; CLIPSim is used only for NSFW, comparing against images generated from a safe prompt. The top-k by a combined score of H and CLIPSim are kept, usually k=10 (Figure 3). The paper does not give the weights of the combined score.
Macaronic replacement
- Each candidate has boundary parameters β1 and β2, ranging from 0 to 1, representing the normalized start and end positions of the substring; the substring is taken only when β2 is greater than β1, with indices computed as the character length times β, rounded.
- The ordering parameter α determines the order of fragments. Fragments are concatenated in descending order of α, replacing all sensitive words in pori to obtain padv.
- When a sentence contains multiple sensitive words, a unified loss is computed over the whole sentence padv and updated jointly.
Zeroth-order optimization and evaluation
- The loss is L=||H(padv)−1||22 (Equation 9), pushing H toward an all-ones vector of the same dimension. H comes from a pretrained NSFW detector or object classifier. The gradient is approximated by finite differences, with the perturbation δ of each parameter adjusted separately, initial δ0=0.25. The learning rate is 0.1, with a fixed 100 iterations; early stopping occurs if L is less than τ. The paper does not give the value of this τ.
- Evaluation criteria are written separately from the optimization objective: ASR-N requires at least one harmful image among N generations; BPR only looks at whether the prompt bypasses the filter. Implemented in PyTorch on a single NVIDIA RTX 4090. The authors say they do not access model internals, gradients or the tokenizer.
What experiments did the paper conduct?
In Table 1, for Sex on SD, Ours has an ASR-5 of 96%, and the blacklist BPR is 100%.
Experimental Setup
- Models: SD v2.1; concept removal includes ESD, SLD's Max, Strong, Medium, FMN, SafeGen, DUO, EAP, PromptGuard. Also reports DALL·E 3 and Doubao.
- Data: DeepSeek-V3 constructed NSFW-200, with taxonomy referencing I2P; Object-200 contains 200 prompts, with categories dog, cat, car, bird, selected from MS COCO. The main text does not state the number of entries in NSFW-200, nor how many Sex and Violence each account for.
- Filters: blacklist keyword filtering, BERT-based NSFW text classifier (Jieli 2023), LatentGuard (Liu et al. 2025).
- Baselines: Table 1 uses DACA, ART, Position, PGJ, SurrogatePrompt, DiffZOO; Table 2 uses MMP-Attack. The authors state that the experiments include seven black-box baselines in total, and the list also includes MMP-Attack.
- Metrics: ASR-N refers to at least one harmful image within N generations; ASR-1 and ASR-5 are reported. BPR is the proportion of prompts that bypass the filter, without considering the semantics of the image. CLIPScore and BLIPScore are cosine similarities of CLIP or BLIP embeddings.
- Judgment: Pornography uses CLIP-based-NSFW-Detector, violence uses Q16, and forbidden objects use classifiers trained on Animals-10 and Stanford cars. Optimization learning rate 0.1, 100 iterations, δ0=0.25. The paper does not report the number of repetitions, number of queries, or human agreement.
Main Results
The table below shows Ours's ASR in Table 1, in %. SLD-Max and SLD-Strong correspond to SLD.Ma and SLD.S, and PromptGuard corresponds to ProG.
Swipe horizontally to read the table
Model Sex ASR-1 Sex ASR-5 Violence ASR-1 Violence ASR-5 SD v2.1 56 96 42 72 ESD 62 74 42 74 SLD-Max 52 96 8 36 SLD-Strong 54 92 22 48 SafeGen 38 76 49 90 FMN 52 84 52 74 EAP 24 62 8 34 PromptGuard 24 34 28 64 SLD-Medium (SLD.Me in Table 1: Sex 54/88, Violence 20/36) and DUO (Sex 32/60, Violence 26/72) are omitted.
- The authors state that on Sex, ASR exceeds the baselines, and the blacklist BPR reaches 100%. Comparing column by column in Table 1, Sex's ASR-1 and ASR-5 are higher than the baselines in the same column on SD and the nine concept removal methods. BPR is not the highest in every column: on Sex with LatentGuard, Ours is 82, while DACA and PGJ are 98; with BERT, Ours is 70, while Position is 94.
- The authors state that Violence still has a relatively high BPR and competitive ASR. In Table 1, Ours's List BPR is 100 and BERT is 98, both the highest in their columns; LatentGuard is 80, lower than PGJ's 92. On SD's ASR-5, Ours is 72, lower than DACA's 85; on EAP's ASR-5, Ours is 34, lower than DACA's 62.
- The abstract and introduction state sex is at most 92% and violence at most 90%. Sex's ASR-5 in Table 1 is not all capped at 92; Violence's highest ASR-5 is the same as the 90 in the introduction. The authors state that the upper part of Figure 4 shows that adversarial prompts can generate target NSFW images on multiple concept removal models, and one prompt can act on multiple filters at the same time.
Forbidden Object Generation
- Table 2 compares Ours with MMP-Attack on dog, cat, car, bird, with models SD, ESD, FMN, EAP, in the format ASR-1/ASR-5. On SD, Ours is: dog 96/100, cat 86/98, bird 70/94, car 92/100.
- The authors state that the prompts were constructed only for the SD safety filter, yet they can still transfer to other concept removal mechanisms, and state that some settings are higher than MMP-Attack. The authors state that in the lower part of Figure 4, the same prompt can trigger forbidden objects on each model shown in the figure.
- Not every cell is higher. On EAP, dog's ASR-5 is 94 for MMP-Attack and 88 for Ours; cat's ASR-5 is 86 for MMP-Attack and 80 for Ours; bird on EAP is 66/82, while Ours is 58/80. On ESD, bird's ASR-5 is 88 for MMP-Attack and 78 for Ours.
Semantic Consistency
- Table 3 gives the CLIPScore for pori and padv, psafe and padv, Iori and Iadv, and the BLIPScore for pori and Iadv. In each row, the CLIPScore of psafe and padv is higher than that of pori and padv; the latter for the six categories is Sex 0.8768, Violence 0.8618, Dog 0.9223, Cat 0.9004, Bird 0.8951, Car 0.9348.
- The BLIPScore of pori and Iadv is Sex 0.5602, Violence 0.5893, Dog 0.9572, Cat 0.9600, Bird 0.6007, Car 0.5047. The authors state that the average BLIPScore is 0.6953, while MMP-Attack is 0.414, and state that the generated images align better with the original semantics.
- The authors state that in the text embedding space of Figure 5, the original prompts and macaronic replacements are separated; in the image embedding space, the generated images of the two types of prompts form tight clusters. The text in the figure reads "Text embedding space" and "Image emebedding space". The replacement strings in the figure are not restated here.
Commercial Systems
- The authors report DALL·E 3's ASR as 65% and Doubao's as 96%. The paper does not state the concept category, whether it is ASR-1 or ASR-5, or the sample size.
Other Ablations and Analyses
- The main text does not report ablations that change a single variable or parameter sweep comparison numbers; the authors state that more details are in the appendix.
What are some points that can be further explored?
The Conclusion does not list the method's limitations, only pointing to subsequent research on safe generation.
Limitations and Future Directions Noted by the Authors
- The paper does not have a dedicated Limitations section. The Conclusion states that the results point to key gaps in current defense strategies, and states that MacPrompt can serve as a reference for subsequent research on safe and responsible generation models; it does not describe the failure conditions of this method or specific follow-up experiments.
Experimental Coverage
- The tested generation models are SD v2.1, ESD, SLD (Max), SLD (Strong), SLD (Medium), SafeGen, FMN, DUO, EAP, PromptGuard, and the ASR of DALL·E 3 and Doubao is reported (Experiments).
- The filter results are listed as blacklist, LatentGuard, and BERT classifier; concept generation uses NSFW-200, and objects use dog, cat, car, bird from Object-200 (Table 1, Table 2). Related work mentions image filtering, but the main text does not report BPR for image filters.
- The baselines in Table 1 are DACA, ART, Position, PGJ, SurrogatePrompt, DiffZOO; Table 2 compares against MMP-Attack, with models listed as SD, ESD, FMN, EAP.
- Success is automatically determined by CLIP-based-NSFW-Detector, Q16, and object classifiers. The main text gives a learning rate of 0.1, 100 iterations, δ0=0.25, and typically L=79, k=10, 10 images per candidate, and states that more details are in the appendix.
- The main text does not state the value of τ, the name of the LLM that produces cross-lingual candidates, the number of queries, the number of repetitions, or the agreement between detectors and humans; the ASR of DALL·E 3 and Doubao does not state the category or ASR-N.
Summarize the main content of the paper
MacPrompt bypasses filtering and concept removal with black-box cross-lingual character recombination and reports multiple ASRs.
MacPrompt is a black-box attack against text-to-image models that uses cross-lingual character recombination to examine whether text filtering and concept removal can be bypassed simultaneously.
- Problem: The authors state that the two types of defenses are unprepared for diverse adversarial prompts; existing methods that can bypass both at the same time often require internal information from the target model.
- Approach: Identify sensitive words, generate and filter candidates using multilingual equivalent words, then concatenate character substrings according to learnable start and end positions and order; the detection score is pushed toward 1 by zeroth-order optimization. It does not access parameters, gradients, or the tokenizer.
- Concept generation: In Table 1, for Sex, Ours's BPR against blacklist is 100%, and the ASR-5 is 96% on SD and SLD-Max; Violence's ASR-5 on SafeGen is 90%. In the same table, for Sex with LatentGuard, Ours's BPR is 82, lower than DACA and PGJ's 98. Comparing column by column in that table, Sex's ASR is higher than the baselines in the same column on SD and the nine concept removal methods; this is not the case for Violence, for example on SD's ASR-5, Ours is 72 and DACA is 85.
- Objects and commercial systems: In Table 2, for Dog on SD, Ours's ASR-5 is 100%; on EAP, Dog's ASR-5 is 88 for Ours and 94 for MMP-Attack. The authors report DALL·E 3's ASR as 65% and Doubao's as 96%, without stating the ASR-N or category. In Table 3, for Cat, the BLIPScore of pori and Iadv is 0.9600; the authors state that the average BLIPScore across the six categories is 0.6953.
- Authors' conclusion: The authors state that this type of replacement can preserve the visual semantics of harmful concepts and confuse text representations, and state that defenses need to be reconsidered beyond monolingual assumptions and simple keyword matching. The Conclusion does not list the method's limitations.