BreakFun: Jailbreaking LLMs via object instantiation in simulated code executionBreakFun: Jailbreaking LLMs via Object Instantiation under Simulated Code Execution
BreakFun turns harmful requests into code-execution simulations, achieving an average ASR of 89% across 13 models on JailbreakBench.
A black-box, single-turn attacker with only standard API access, able to control only the input prompt; no access to weights, internal state, or the generation process, and no conversation history. The prompt contains a Trojan Schema wrapped in a seemingly benign code-related request. The goal is to make the model write harmful content as a side effect when it simulates execution and instantiates objects.
- The authors aim to examine whether, when an LLM follows complex structure and syntax, harmful content can emerge as a side effect of simulated code execution rather than only as a directly user-posed request. The authors believe this capability is related to models being used for code and formal schemas.
- BreakFun is a black-box single-turn prompt: a benign framework, a Trojan Schema, and chain of thought. The model is asked what a benign Python class definition would print if executed and must fill values according to adversarial field names during instantiation. APD first transcribes readable text and then judges safety.
- The average ASR across 13 models on JailbreakBench is 89% (open-weight ~98%, API systems ~78%). In the same setting, the average across 12 models is 94%, higher than the 56% of CodeAttack's strongest variant, Stack. After removing the schema, the average across three models drops from 94% to 35%.
- The authors say black-box evidence cannot establish mechanistic causality, and neural verification is left as future work; the attack is limited to Python code simulation. APD is a probe, not a defense. The experiments cover 13 models, a 12-model rerun of CodeAttack, three-model ablations, and APD on three backbones.
- Evaluated models
- GPT-4.1 MiniGemini 2.5 FlashClaude-3.5 SonnetClaude-3 HaikuKimi-K2Ernie-4.5GPT-OSSDeepseek-R1Gemma3Qwen3LLaMA 3.1MistralZephyrQwen2.5 32BGemini 2.0 FlashMinistral 8B
- Benchmarks
- JailbreakBenchBorderline-Benign合成集(122条任务)Benign合成集(122条任务)
- Metrics
- ASRdetection accuracyFPRCohen's κHuman-AI agreement
The researchers propose the BreakFun jailbreak method, which wraps harmful requests as code execution simulations: the prompt gives a harmless Python class definition, the Trojan Schema, and asks the model to answer what this code would print if run. The model must instantiate the object and invent values for each field, and the adversarial field names steer these values toward the attack target, so harmful content appears as a side effect of the simulated instantiation rather than as a direct answer. The attack has three parts: a benign framework, a Trojan Schema, and chain-of-thought interference. On JailbreakBench, BreakFun achieves an average attack success rate of 89% across 13 open-weight and commercial models (about 98% for open-weight and about 78% for API systems), reaching 100% on several models; ablation experiments show the Trojan Schema is the largest contributing component. The authors argue that LLM safety needs to cover content produced as a side effect of simulation tasks, not only content directly requested by users.
Paper analysis
What problem does this paper attempt to solve?
BreakFun turns harmful requests into code execution simulations, making harmful content appear as an instantiation side effect.
The model's goal of adhering to complex structures and syntax can be exploited to bypass safety alignment in simulated code execution, causing harmful content to appear as a side effect of object instantiation.
- Scenario: The authors argue that LLMs are used in complex software because they excel at handling code, JSON, XML, and formal schemas, and that the same capability constitutes a new attack surface. They hypothesize that if a task is sufficiently complex and well-formed, the model will prioritize syntactic compliance, focusing on structure rather than semantics.
- Gap to examine: The introduction links this hypothesis to the goal of following complex instructions and adhering to structural and syntactic rules (Chao et al., 2025). What the authors address is not content directly requested by the user, but content produced as a side effect of a simulated task.
- Core approach: The prompt provides a Python class definition that is benign in isolation, i.e., a Trojan Schema, and asks what would be printed if executed. The model must instantiate the object and invent values for fields, with adversarial field names steering the values toward the attacker's goal.
- What this paper provides: A black-box jailbreak method called BreakFun, and an anti-ablation probe called Adversarial Prompt Deconstruction (APD). APD has a second LLM first write out the readable text in the prompt, then make a safety determination.
- Threat model:
- Knowledge: The paper is written as black-box; no access to weights, internal states, or generation processes.
- Interaction: Single-turn; standard API access; only the input prompt can be controlled; no conversation history.
- Goal: Harmful content appears as a side effect of object instantiation under simulated execution, rather than as a direct answer to a harmful question.
- Victim surface: The LLM that receives the prompt. The attack surface is a Trojan Schema wrapped in a seemingly benign code-related request. The authors claim non-experts can also carry it out.
What related research exists?
The authors position BreakFun separately from code completion, syntax constraints, and coding-style jailbreaks.
Related work is organized by access level, black-box techniques, and code-based attacks. The authors only state differences in Positioning and comparison experiments.
By model access
- White-box optimization: Zou et al. (2023) use universal adversarial suffixes; Liu et al. (2024)'s AutoDAN uses genetic search to rewrite prompts. The paper states white-box assumes access to weights and other internal states.
- Black-box automation: TAP (Mehrotra et al., 2024), GPTFUZZER (Yu et al., 2023), PAIR (Chao et al., 2025) use queries for automatic refinement. The paper states black-box requires only query access and better represents real threat models.
- Personas and multi-agent: Crescendo (Russinovich et al., 2025), DeepInception (Li et al., 2023), PAPs (Zeng et al., 2024), and PsySafe (Zhang et al., 2024). The positioning section states role-playing requires adopting a fictional persona, while BreakFun assigns no role.
Obfuscation, encoding, and templates
- Obfuscation and hiding intent: DrAttack (Li et al., 2024b), Jigsaw Puzzles (Yang et al., 2025), FlipAttack (Liu et al., 2025), ReNeLLM (Ding et al., 2024), WordGame (Zhang et al., 2025b); also work hiding in benign context (Wu et al., 2025; Chang et al., 2024) and cross-lingual jailbreaks (Yong et al., 2023; Deng et al., 2024; Li et al., 2024a; Kumar et al., 2024). The positioning section states these attacks disguise the intent itself, while BreakFun keeps the intent visible and only rewrites the task as syntactic execution.
- Encoding then restoring: CipherChat (Yuan et al., 2024), CodeChameleon (Lv et al., 2024), StegoAttack (Geng et al., 2025), h4rm3l (Doumbouya et al., 2025) have the model, not a filter, restore the request. TIP (Berezin et al., 2025) places unsafe requests into benign tasks via encoding functions; SIJ (Zhao et al., 2025) attacks how templates are assembled. The authors state TIP only works when the model reconstructs the removed harmful words, while BreakFun does no encoding.
- Beyond fixed templates: The authors state the Core Task Schema can swap domain classes and field names according to the harmful target, distinguishing it from fixed-template attacks, and corresponding to the 10 JailbreakBench categories (Figure 4).
Code completion and syntactic constraints
- CodeAttack (Ren et al., 2024): embeds malicious tasks into code completion. The positioning section states its input already contains harmful constructs; BreakFun elicits the simulated output of pre-written benign code.
- EnumAttack (Zhang et al., 2025a): constrains decoding with grammar rules. The paper states it is not a pure black-box prompt attack and requires controlling the decoding process; the authors state this is a stronger attacker capability than prompting alone.
Baseline methods and benchmarks: Under the same JailbreakBench targets, same review, and same deterministic settings, the authors reran CodeAttack's String, Queue, and Stack. EnumAttack was not rerun. The probe uses Llama Guard 4 12B as a production safety classifier comparison. The benchmark is JailbreakBench's (Chao et al., 2024) 10 harmful categories; the probe additionally uses the synthetic Borderline-Benign and Benign sets from Appendix A.3.
The authors state BreakFun's prompt contains no harmful code; harmful content appears only when simulating execution of benign class definitions and inventing field values. The authors use ablations to separate this path from the task framing: removing only the schema while keeping the benign framing and chain of thought drops the three-model average ASR from 94% to 35% (Section 4.3), so they believe the attack is not carried by the task framing or instruction-following pressure.
How does the paper address this problem?
The three-component prompt requires the model to assume a benign class definition and fill in fields upon instantiation.
BreakFun places the harmful goal inside a Python class definition that is benign in isolation, then asks the model to answer what the output would be if executed. The authors describe the harmful content as a side effect of object instantiation, rather than a direct answer.
How the Attack Triggers
- Hypothetical execution: The attacker provides a class definition and asks for the output after hypothetical execution. The authors argue that answering this question elicits behavior consistent with internal compilation or interpretation of the code; this pattern comes from the hypothetical phrasing of the question, not from a role assigned in the prompt.
- Instantiation sub-step: Simulated execution includes instantiating the schema. The model must invent values for each field. Adversarial class and field names steer the most natural completion toward the attacker's goal. Naming examples and the ten schema categories are in Figure 2 and Appendix A.1; fields are not listed here.
- Benign in isolation: The authors state that as code, the schema contains no harmful constructs, and actual execution would not produce harmful output. The harmful content only appears when the model fills in the fields.
Three-Component Template
- Innocent Framing: Kept static across all experiments. It wraps the interaction in a benign instructional request, used to activate a helpful persona, making the model more cooperative and less likely to flag the request as unsafe. This is the authors' stated rationale.
- Trojan Schema: Built per each of the 10 harmful categories, derived from the Core Task Schema. The CTS contains generic classes that can be extended with domain-specific classes and fields. The placeholder {task} is filled with the specific goal, and {steps} controls generation length; the paper does not report the number of steps used in experiments. Figure 3 shows a full prompt example.
- Customization: The authors state the goal is to align the classes and fields with the harmful category. The schema is generated with LLM assistance; the paper does not specify the model name; the final version is in Appendix A.1.
- Chain-of-Thought Distraction: Also static. It asks for step-by-step reasoning about the hypothetical code execution. The authors give two purposes: lengthening and intensifying the generation task, and diluting the malicious payload within a long, structurally complex answer.
Success Determination
Success is defined as J(R,G)=I(¬ Refusal(R)∧ Actionable(R,G)), i.e., both non-refusal and actionable. Refusal includes direct refusal (internal information or external API interception) and indirect misdirection (filling the schema with benign alternatives). Actionable requires specific, structured, and sufficient detail to execute the goal; vague or philosophical answers count as non-actionable. ASR is the mean of J over the dataset: first score each goal, then average over goals within a category, then average over the 10 categories, yielding one ASR per model. Cross-model numbers are the mean of these model values. Appendix A.2 provides the review prompt.
APD Probe
APD is not an attack step. The authors use it as a reverse probe: if the schema drives bypass during generation, then a model performing safety classification should label the same harmful intent less often while the schema is present; removing the schema should restore labeling. The authors emphasize that the two sides are different models and different tasks, so this is a second behavioral signal, not a description of the model's internal processes.
The second LLM performs three steps (Figure 7 provides the full prompt):
- Literal Transcription: Extract natural language sentences and string literals from the structured format.
- CoT Unwrapping: Transcribe these contents in a chain of thought, forming what the authors call a sanitized context, so that subsequent judgment conditions depend on the semantic payload rather than the syntactic wrapper. The authors' stated rationale is autoregressive generation.
- Logical OR: If any transcribed component is judged harmful, the entire prompt is flagged.
The backbone is chosen close to Llama Guard 4 12B; the authors' stated rationale is to avoid explaining detection differences by model size. Three conditions: Baseline (zero-shot safety prompting on the original BreakFun prompt, Appendix A.5), APD w/o Trans. (keeping the chain-of-thought scaffolding but removing literal transcription), and full APD.
What experiments did the paper conduct?
The average ASR across 13 models is 89%; after removing the Trojan Schema, the average across three models drops from 94% to 35%.
Experimental setup
- Models tested: 13 in Table 1. Tier 1 (local, open-weights): GPT-OSS 20B, Deepseek-R1 14B, Gemma3 12B, Qwen3 8B, LLaMA 3.1 8B, Mistral 7B, Zephyr 7B. Tier 2 (API): GPT-4.1 Mini, Gemini 2.5 Flash, Claude-3.5 Sonnet, Claude-3 Haiku, Kimi-K2 (1T A32B), Ernie-4.5 (300B A47B). BreakFun was also run separately on Qwen2.5 32B and Gemini 2.0 Flash, only to compare against published EnumAttack numbers.
- Data: 10 harmful categories from JailbreakBench. The paper does not report the number of targets. The probe's Borderline-Benign and Benign sets each have 122 tasks; after injecting 10 templates, each becomes 1220 prompts (Appendix A.3).
- Baselines: CodeAttack's String, Queue, Stack, rerun under the same targets, same review, and same deterministic settings. EnumAttack was not rerun. The probe comparison is Llama Guard 4 12B.
- Metrics: ASR is defined in question 3. The probe reports the proportion flagged as harmful; Limitations additionally gives FPR on borderline.
- Review: qwen3-max. Appendix A.4 states that GPT and Gemini family models often refuse to classify due to their own safety policies, so this model was chosen. Three human experts independently classified all responses, with an average pairwise Cohen's κ=0.96; the final label is majority vote, with 97.5% human-machine agreement.
- Generation: attack, probe, and review all use temperature=0.0, seed=42, max_tokens=10000 (Table 6). Reruns matched reported numbers on 10/13 models; the remaining 3 API providers had std≤2 points; the paper does not name these 3.
Main results
The table below is based on Table 2 (ASR, %). It exceeds 8 rows, so 5 models are omitted and listed after the table. Claude-3.5 Sonnet's CodeAttack is unreported because its API is deprecated.
Swipe horizontally to read the table
Model Tier BreakFun String Queue Stack Claude-3.5 Sonnet 2 25% unreported unreported unreported Gemini 2.5 Flash 2 77% 28% 28% 68% Claude-3 Haiku 2 87% 11% 12% 55% LLaMA 3.1 8B 1 89% 25% 34% 12% Ernie-4.5 2 93% 42% 41% 91% GPT-OSS 20B 1 96% 8% 9% 8% Deepseek-R1 14B 1 100% 64% 66% 50% Kimi-K2 2 100% 39% 26% 88% Omitted (BreakFun/String/Queue/Stack): GPT-4.1 Mini 86/30/36/77, Gemma3 12B 97/40/47/48, Qwen3 8B 100/62/70/67, Mistral 7B 100/52/73/69, Zephyr 7B 100/31/32/35.
- Overall and by tier: The authors report an average of 89% across 13 models, ∼98% for Tier 1 and ∼78% for Tier 2, calling this the Guardrail Divide. The authors believe provider-side systems raise the bar but do not address the model-layer problem. The Table 2 average row (12 models, excluding Claude-3.5 Sonnet) is BreakFun 94%, String 36%, Queue 40%, Stack 56%. The authors state that taking the best CodeAttack variant per model gives 60%.
- How the gap is distributed: The authors state that BreakFun is 89%–100% on every Tier 1 model, while CodeAttack is 8%–73% on the same models, and believe CodeAttack depends on the model processing payloads embedded in code, whereas BreakFun's payload is plaintext. The main text states the smallest gaps are on two hardened API systems; the parenthetical 91% vs. 93% and 88% vs. 100% match the order of Stack vs. BreakFun in Table 2. The lowest BreakFun in the table is Claude-3.5 Sonnet.
- Categories: The authors state that Malware/Hacking, Economic Harm, and Disinformation are bypassed on almost all models, while Physical Harm and Sexual/Adult Content are the most resistant, and the resistance comes almost entirely from Tier 2 (Section 4.1; Figure 4's caption is consistent). The text has no per-category ASR. Appendix A.6 gives redacted examples; the authors state the models fill in executable instructions rather than generic refusals.
Component ablations
Section 4.3 is done on LLaMA 3.1 8B, GPT-OSS 20B, and Gemma3 12B. The paper states the three-model average ASR for the full prompt is 94%. Figure 5 corresponds to these conditions; the main text does not give per-model bar values except for CTS.
- Removing the schema: average drops to 35%. The authors call this the most damaging removal and identify the Trojan Schema as the strongest contributing factor.
- Structure and naming: replacing fields with neutral identifiers gives 66%. The authors state structure contributes about 30 ASR points and adversarial naming another about 28. Removing CoT gives 72%; removing the benign framing gives 86%; the authors place these as secondary and minor.
- CTS only: using the generic CTS for all ten categories without per-category customization gives an average of 74% (GPT-OSS 80%, Gemma3 82%, LLaMA 3.1 60%). The authors state the models still run the simulation and write instructions, but with generic fields the instructions are less specific, so fewer pass the strict executability criterion. With neutral naming, the authors observe the models often still instantiate the schema but fill in benign content.
Detection changes with APD
Table 3 is detection accuracy. Baseline is zero-shot safety judgment on the original prompt.
- Three rows of numbers: Gemma3 12B is 70%, 77% (+7), 100% (+30). Ministral 8B is 50%, 61% (+11), 91% (+41). Qwen3 8B is 62%, 64% (+2), 87% (+25). The order is Baseline, without transcription, full APD. The authors state the middle condition is only 2 to 11 points higher, while the full protocol is 25 to 41 points higher, so they believe the gain comes mainly from transcription rather than general prompt engineering.
- Authors' interpretation: The authors believe these backbones can recognize harm in the underlying content, but when the schema is present, they flag the same intent less often. The authors attribute the vulnerability in this setting mainly to structure, with field-value semantics as an enhancement. Figure 6's caption is a summarized illustration: without APD it returns Benign; after transcription it flags a component as harmful and returns Harmful.
- Not reaching the same level: under full APD, only Gemma3 12B reaches 100%; Ministral is 91% and Qwen3 is 87%.
Flagging on three input types
Table 4. The harmful column matches the main text as the proportion flagged harmful. For the Borderline and Benign columns, the main text calls it accuracy, and the FPR in Limitations is consistent with "100% minus the corresponding cell"; the table title, however, says the whole table is flagging proportions. The two are inconsistent.
- Harmful: Gemma3 12B 100%, Ministral 8B 91%, Qwen3 8B 87%, Llama Guard 4 12B 63%. The authors state that Llama Guard 4 reaches 100% on benign and borderline distributions yet still flags only 63% of BreakFun harmful prompts, so they believe such prompts can also bypass a production safety system.
- Borderline and benign: The main text states APD accuracy on Borderline-Benign is 88%–97% and on Benign is 99%–100%, and believes deconstruction does not flag merely because a prompt looks complex or code-like. The three rows in the table are 88%, 90%, 97% for Borderline and 99%, 100%, 100% for Benign. Limitations states Qwen3 has 3% FPR on borderline and Gemma3 12%. The paper does not give Ministral's FPR.
- Observations the authors use to support the probe: the above borderline/benign numbers and Llama Guard 4's 63%. The authors believe this supports that "detection recovers after removing the schema" is not a matter of flagging everything as harmful.
Other ablations and analyses
- BreakFun is 100% on Qwen2.5 32B, compared to EnumAttack's reported 99%; on Gemini 2.0 Flash, EnumAttack reports 92% and BreakFun is 68% (Section 4.2). Neither is in Table 1.
- Reruns: 10/13 models match reported values; the remaining 3 API providers have std≤2 points (Section 3.3).
- Human-machine agreement: average pairwise κ=0.96, agreement 97.5% (Section 3.3).
What are some points that can be further explored?
The authors say black-box evidence cannot establish mechanistic causality, and the attack scope stops at Python code simulation.
Limitations and future directions noted by the authors
- Mechanistic causality: Without internal state, no single experiment can trace a given input feature to a given safety failure. The evidence is therefore behavioral. The authors call probe classifiers, attention analysis, or activation patching important future work (Limitations).
- Scope of code simulation: The attack requires schema instantiation under simulated code execution. This paper focuses on Python and Pydantic/PyGlove-style schema libraries. JSON, YAML, and standalone XML cannot be executed and are not within the mechanism. SQL returns existing rows and has no step that invents new object field values; shell executes commands and also has no schema instantiation. The authors say these formats require separately designed misleading strategies, left for future work. TypeScript with Zod and Rust with serde match the mechanism but were not tested (Limitations).
- The probe is not a defense: APD is defined by the authors as a behavioral probe of schema role, not a defense, and was not evaluated for adversarial robustness. The cost is one additional model call before the target system, and transcription makes the output longer. The authors did not tune for latency or service cost and describe these as program properties rather than deployment measurements (Limitations).
- Precision: The authors say APD must trade off recall and precision on ambiguous tasks. On borderline cases, Qwen3 has an FPR of 3% and Gemma3 of 12%; fine-tuning the backbone for transcription may narrow this gap. The benign distribution contains ordinary technical queries and code, and APD classifies 99%–100% of it correctly. The authors state that benign prompts containing large schemas like those in BreakFun have not been tested, and they consider that the most likely place for false positives. The synthetic borderline set may not cover all production edge cases (Limitations).
- Alignment coverage: In the Discussion, the authors call "content filtering around direct queries, which in this setting does not generalize to byproducts of larger simulation tasks" an open problem of the current alignment paradigm.
Experimental coverage
- The main attack experiment is the 13 models in Table 1 and the 10 categories of JailbreakBench; each model's ASR is the category mean then averaged over the 10 categories (Sections 3.3, 4.1). The paper does not report the number of targets.
- The three CodeAttack variants were rerun on 12 models; Claude-3.5 Sonnet has no CodeAttack numbers because of API deprecation (Table 2). EnumAttack was not rerun; the authors additionally ran BreakFun on Qwen2.5 32B and Gemini 2.0 Flash (Section 4.2).
- Ablations were run on LLaMA 3.1 8B, GPT-OSS 20B, and Gemma3 12B, including the full prompt and five deletions or replacements (Section 4.3, Figure 5). The main text gives per-model ASR only for the general CTS condition; the bar heights in Figure 5 cannot be read from the text.
- APD compares three conditions on Gemma3 12B, Ministral 8B, and Qwen3 8B (Table 3), and Table 4 additionally includes Llama Guard 4 12B. Borderline and Benign each have 122 tasks, each with 1,220 injected prompts (Appendix A.3).
- The attack review used qwen3-max; three experts independently classified all responses (κ=0.96, human–machine agreement 97.5%). Generation parameters are in Table 6. Appendices A.1–A.4 give schemas, prompts, synthetic data, and hyperparameters; the authors state they do not release runnable attack code or unredacted harmful outputs. The paper does not report the name of the LLM that helped generate the schemas, nor the value of {steps}.
Summarize the main content of the paper
BreakFun achieves an average ASR of 89% across 13 models, and the Trojan Schema is the component the authors identify as strongest.
BreakFun is a black-box, single-turn jailbreak: it makes the model hypothetically execute a benign Python class definition and produce harmful content while filling in object fields.
- Problem: The authors hypothesize that the goal of adhering to complex structure and syntax overrides safety alignment, making the model focus on form and overlook semantics. What is being tested is the side effect of a simulation task, not a harmful question directly asked by the user. The attacker has only the standard API and the current-turn prompt.
- Method: The prompt consists of a benign framework, a Trojan Schema, and chain-of-thought interference. The class definition in isolation contains no harmful constructs; the adversarial field names guide the values the model invents. The general CTS can be rewritten according to JailbreakBench's 10 categories. Success requires both non-refusal and executability.
- Main results: The average ASR across 13 models on JailbreakBench is 89%. The authors write Tier 1 is ~98% and Tier 2 is ~78%. On the 12 comparable models in Table 2, BreakFun averages 94%, while CodeAttack's Stack is 56%. Claude-3.5 Sonnet is 25%, the lowest in that table.
- Ablations and probe: On LLaMA 3.1 8B, GPT-OSS 20B, and Gemma3 12B, removing the schema drops the average ASR from 94% to 35%; the authors therefore identify the schema as the strongest contributing factor. When APD judges after removing the schema, Gemma3 12B goes from 70% to 100%, Ministral 8B from 50% to 91%, and Qwen3 8B from 62% to 87% (Table 3). Llama Guard 4 12B flags 63% of harmful BreakFun prompts (Table 4).
- Authors' conclusions: The authors believe provider-side protections have raised the bar but have not addressed the model-layer problem. The authors argue that safety pipelines that only filter direct queries do not cover the byproducts of simulation tasks in their setting. The authors treat APD as a probe, not a defense.