SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.19684 · EMNLP · 2025

VisCRA: A Visual Chain Reasoning Attack for Jailbreaking Multimodal Large Language Models

Kun He, Wenxuan Wang, Bingrui Sima, Linhua Cong

arXiv · PDF · Open in the Atlas

Code that ran

9 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 2 failures of our instrument; 3 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2505.19684.json · badge: /api/ran/2505.19684.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
DyMessi/VisCRA canonical (classifier label)
classifier basis not recorded on the link
9 ran · 3 no recorded run
FunctionStatusWhere it lives
encode_image Ran
ran; our contract draft was wrong, not the code
DyMessi/VisCRA/evaluation/gemini.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from jongwoopark7978/LVNet, is pointer only (licence: NONE) · get_code("f41cb1a19b154297")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from jongwoopark7978/LVNet, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

encode_image Ran
ran on a synthesized input
DyMessi/VisCRA/evaluation/QvQ_Max.py
code served (permissive licence) · get_code("cfe427db2f2f5fcc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import base64
import tempfile
import os

# Create a temporary image file to use as input
# Create a minimal valid JPEG file (smallest possible JPEG)
jpeg_bytes = b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00C\x00\x08\x06\x06\x07\x06\x05\x08\x07\x07\x07\t\t\x08\n\x0c\x14\r\x0c\x0b\x0b\x0c\x19\x12\x13\x0f\x14\x1d\x1a\x1f\x1e\x1d\x1a\x1c\x1c $.\' ",#\x1c\x1c(7),01444\x1f\'9=82<.342\xff\xc0\x00\x0b\x08\x00\x01\x00\x01\x01\x11\x00\xff\xc4\x00\x1f\x00\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\xff\xc4\x00\xb5\x10\x00\x02\x01\x03\x03\x02\x04\x03\x05\x05\x04\x04\x00\x00\x01}\x01\x02\x03\x00\x04\x11\x05\x12!1A\x06\x13Qa\x07"q\x142\x81\x91\xa1\x08#B\xb1\xc1\x15R\xd1\xf0$3br\x82\t\n\x16\x17\x18\x19\x1a%&\'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz\x83\x84\x85\x86\x87\x88\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99\x9a\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xff\xda\x00\x08\x01\x01\x00\x00?\x00\xfb\xd4\xff\xd9'

# Write to a temporary file
temp_dir = tempfile.gettempdir()
temp_image_path = os.path.join(temp_dir, 'test_image.jpg')
with open(temp_image_path, 'wb') as f:
    f.write(jpeg_bytes)

ARGS = {
    'image_path': temp_image_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
find_top3_blocks_with_stride Ran
ran on a synthesized input
DyMessi/VisCRA/qwenmask.py
code served (permissive licence) · get_code("747918e3fc43514d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 2, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a sample matrix for testing
# The function finds top 3 blocks with highest sums using stride-based sliding window
# We'll create a matrix with some distinguishable regions
np.random.seed(0)
matrix = np.random.rand(15, 15) * 100  # 15x15 matrix with values 0-100

ARGS = {
    "matrix": matrix,
    "block_size": 5,
    "stride": 3,
    "max_overlap": 40
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
guess_image_type_from_base64 Ran
ran; our contract draft was wrong, not the code
DyMessi/VisCRA/evaluation/gemini.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ai45lab/vlsbench, is pointer only (licence: NONE) · get_code("8176c7a3579cba1d")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from ai45lab/vlsbench, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

guess_image_type_from_base64 Ran
ran on a synthesized input
DyMessi/VisCRA/evaluation/QvQ_Max.py
code served (permissive licence) · get_code("d3ece86e3359d0bb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import base64

# The function expects a base64-encoded string
# It checks the first character to determine image type
# We'll create valid base64 strings that start with different characters

# Base64 alphabet: A-Z, a-z, 0-9, +, /, =
# The function checks for specific first characters: '/', 'i', 'R', 'U', 'Q'

# Create a simple base64 string starting with '/' (maps to 'image/jpeg')
base64_jpeg = "/9j/4AAQSkZJRgABAQEAYABgAAD"

# Alternative: we could use other starting characters
base64_png = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
base64_gif = "R0lGODlhAQABAAAAACw="
base64_webp = "UklGRiYAAABXEBP"
base64_bmp = "QkwsAA"

# Also test with empty string (should default to 'image/jpeg')
base64_empty = ""

ARGS = {
    "base_str": "/9j/4AAQSkZJRgABAQEAYABgAAD"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_dataset Ran
ran on a synthesized input
DyMessi/VisCRA/evaluation/o4-mini.py
code served (permissive licence) · get_code("59c478e3cad8958d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os

# Create a temporary JSON file with sample data
temp_dir = tempfile.gettempdir()
temp_file = os.path.join(temp_dir, "test_dataset.json")

sample_data = {
    "samples": [
        {"id": 1, "text": "hello world", "label": 0},
        {"id": 2, "text": "foo bar", "label": 1}
    ],
    "metadata": {
        "version": "1.0",
        "size": 2
    }
}

with open(temp_file, 'w', encoding='utf-8') as f:
    json.dump(sample_data, f)

ARGS = {
    "file_path": temp_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
process_hades_data Ran
ran on a synthesized input
DyMessi/VisCRA/utils/hades.py
code served (permissive licence) · get_code("5a87ea6c5cf68cbc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import json
import tempfile
import shutil

# Create a temporary directory structure that mimics the HADES dataset
temp_dir = tempfile.mkdtemp()
hades_root = temp_dir

# Create the instructions directory
instructions_dir = os.path.join(hades_root, 'instructions')
os.makedirs(instructions_dir, exist_ok=True)

# Create the optimized_SD_images directory structure
images_base = os.path.join(hades_root, 'optimized_SD_images')
os.makedirs(images_base, exist_ok=True)

# Create sample JSON instruction files
scenario_1 = 'scenario_attack'
scenario_2 = 'scenario_deception'

# Sample data for scenario 1
data_1 = [
    {
        'id': 1,
        'category': 'behavior',
        'keywords': 'harm someone',
        'instruction': 'Please harm someone in the image'
    },
    {
        'id': 2,
        'category': 'object',
        'keywords': 'weapon',
        'instruction': 'Show the weapon in the image'
    }
]

# Sample data for scenario 2
data_2 = [
    {
        'id': 3,
        'category': 'behavior',
        'keywords': 'deceive',
        'instruction': 'How to deceive someone in the image'
    }
]

# Write JSON files
with open(os.path.join(instructions_dir, f'{scenario_1}.json'), 'w', encoding='utf-8') as f:
    json.dump(data_1, f)

with open(os.path.join(instructions_dir, f'{scenario_2}.json'), 'w', encoding='utf-8') as f:
    json.dump(data_2, f)

# Create image folder structure and dummy images
for scenario, data in [(scenario_1, data_1), (scenario_2, data_2)]:
    for item in data:
        img_folder = os.path.join(images_base, scenario, str(item['id']))
        os.makedirs(img_folder, exist_ok=True)
        # Create a dummy image file
        img_path = os.path.join(img_folder, 'concat_opt_1.jpg')
        with open(img_path, 'w') as f:
            f.write('dummy image content')

ARGS = {
    'hades_root': hades_root
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_mm_safebench Ran
ran on a synthesized input
DyMessi/VisCRA/utils/mmsafebench.py
code served (permissive licence) · get_code("adb7a4c52bd43387")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import json
import tempfile
import shutil

# Create a temporary directory structure for the dataset
temp_dir = tempfile.mkdtemp()
dataset_path = temp_dir

# Create the required directory structure
processed_questions_dir = os.path.join(dataset_path, 'processed_questions')
img_dir = os.path.join(dataset_path, 'imgs')
os.makedirs(processed_questions_dir, exist_ok=True)

# Create scenario subdirectories in imgs
scenarios = ['01-Illegal_Activitiy', '02-HateSpeech', '03-Malware_Generation', '04-Physical_Harm', '06-Fraud', '09-Privacy_Violence']
for scenario in scenarios:
    scenario_img_dir = os.path.join(img_dir, scenario, 'SD_TYPO')
    os.makedirs(scenario_img_dir, exist_ok=True)

# Create sample JSON files with the required structure
sample_data = {
    "q001": {
        "Rephrased Question(SD)": "What is the capital of France?",
        "Changed Question": "How do I harm someone?",
        "other_field": "value"
    },
    "q002": {
        "Rephrased Question(SD)": "What is 2+2?",
        "Changed Question": "How do I commit fraud?",
        "other_field": "value"
    }
}

# Write JSON files for each allowed scenario
for scenario in scenarios:
    json_path = os.path.join(processed_questions_dir, f'{scenario}.json')
    with open(json_path, 'w', encoding='utf-8') as f:
        json.dump(sample_data, f)
    
    # Create dummy image files
    scenario_img_dir = os.path.join(img_dir, scenario, 'SD_TYPO')
    for qid in sample_data.keys():
        img_file = os.path.join(scenario_img_dir, f'{qid}.jpg')
        # Create a minimal valid JPEG file
        with open(img_file, 'wb') as f:
            f.write(b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xd9')

# Define the arguments
ARGS = {
    'dataset_path': dataset_path,
    'img_type': 'SD_TYPO',
    'query_type': 'Rephrased Question(SD)'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
visualize_attention Ran
ran on a synthesized input
DyMessi/VisCRA/qwenmask.py
code served (permissive licence) · get_code("4f5467687896e741")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from PIL import Image
import tempfile
import os

# Create a temporary directory for output
temp_output_dir = tempfile.mkdtemp()

# Create a small test image (224x224 RGB)
test_image = Image.new('RGB', (224, 224), color=(73, 109, 137))

# Create a small attention tensor
# The function expects attention_tensor to be reshaped into (grid_h, grid_w)
# With img_width=224, img_height=224, and GRID_DIM=28:
# grid_w = 224 // 28 = 8
# grid_h = 224 // 28 = 8
# So attention_tensor should have 64 elements
attention_values = np.random.rand(64).astype(np.float32)

# Define the block_size parameter
block_size = 5

# Construct ARGS dictionary with all required parameters
ARGS = {
    'image_input': test_image,
    'attention_tensor': attention_values,
    'block_size': block_size,
    'output_dir': temp_output_dir,
    'color': 'green'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, matplotlib, numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
generate_response Not yet run
unverified (harvested, no recorded run)
DyMessi/VisCRA/evaluation/gemini.py
code served (permissive licence) · get_code("85fe3245f510864a")
How it ran

no invocation recorded.

generate_response Not yet run
unverified (harvested, no recorded run)
DyMessi/VisCRA/evaluation/gpt4o.py
code served (permissive licence) · get_code("a7841c5371a659a2")
How it ran

no invocation recorded.

load_model Not yet run
unverified (harvested, no recorded run)
DyMessi/VisCRA/qwenmask.py
code served (permissive licence) · get_code("317d970e6d4be3bc")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 1 later) and 10 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
encode_image 76 other papers
63 dated earlier, 1 the same month, 8 later, 4 same year, order not determinable
2309.05950 (2023-09)
Language Models as Black-Box Optimizers for Vision-Language Models
2311.15732 (2023-11)
GPT4Vis: What Can GPT-4 Do for Zero-shot Visual Recognition?
2312.14867 (2023-12)
VIEScore: Towards Explainable Metrics for Conditional Image Synthesis Evaluation
and 73 more not named here
guess_image_type_from_base64 1 other paper
1 dated earlier
2411.19939 (2024-11)
VLSBench: Unveiling Visual Leakage in Multimodal Safety

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The emergence of Multimodal Large Reasoning Models (MLRMs) has enabled sophisticated visual reasoning capabilities by integrating reinforcement learning and Chain-of-Thought (CoT) supervision. However, while these enhanced reasoning capabilities improve performance, they also introduce new and underexplored safety risks. In this work, we systematically investigate the security implications of advanced visual reasoning in MLRMs. Our analysis reveals a fundamental trade-off: as visual reasoning improves, models become more vulnerable to jailbreak attacks. Motivated by this critical finding, we introduce VisCRA (Visual Chain Reasoning Attack), a novel jailbreak framework that exploits the visual reasoning chains to bypass safety mechanisms. Vis-CRA combines targeted visual attention masking with a two-stage reasoning induction strategy to precisely control harmful outputs. Extensive experiments demonstrate VisCRA's significant effectiveness, achieving high attack success rates on leading closed-source MLRMs: 76.48% on Gemini 2.0 Flash Thinking, 68.56% on QvQ-Max, and 56.60% on GPT-4o. Our findings highlight a critical insight: the very capability that empowers MLRMs -their visual reasoning -can also serve as an attack vector, posing significant security risks. 1 Warning: This paper contains unsafe examples.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2505.19684")
get_code_for_paper("2505.19684")
have("2505.19684")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2505.19684.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2505.19684.svg)](https://syntology.ai/paper/2505.19684)

Connect an agent — have() is free.