SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2510.24195 · NeurIPS · 2025

Vanish into Thin Air: Cross-prompt Universal Adversarial Attacks for SAM2

Yifan Hu, Zhang, Yu Leo, Hai Jin, Ziqi Zhou, Shengshan Hu, Yufei Song, Dezhong Yao, Zijing Li, Long Zheng

arXiv · PDF · Open in the Atlas

Code that ran

8 of 11 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; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 5 failures of our instrument; 3 no recorded run), measured 2026-11-24; 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/2510.24195.json · badge: /api/ran/2510.24195.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
CGCL-codes/UAP-SAM2 canonical (classifier label)
classifier basis: census
8 ran · 3 no recorded run
FunctionStatusWhere it lives
compute_axial_cis Ran
ran, violated the contract we drafted
CGCL-codes/UAP-SAM2/sam2/modeling/position_encoding.py
pointer only (licence: NONE) · get_code("7ceaad42da42edd5")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, CGCL-codes/UAP-SAM2 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.

get_1d_sine_pe Ran
ran; our contract draft was wrong, not the code
CGCL-codes/UAP-SAM2/sam2/modeling/sam2_utils.py
pointer only (licence: NONE) · get_code("a6c3974188a5ffb0")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, CGCL-codes/UAP-SAM2 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.

get_activation_fn Ran
ran; our contract draft was wrong, not the code
CGCL-codes/UAP-SAM2/sam2/modeling/sam2_utils.py
pointer only (licence: NONE) · get_code("f2e72d81f39d65cd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, CGCL-codes/UAP-SAM2 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.

get_args Ran
ran; our contract draft was wrong, not the code
CGCL-codes/UAP-SAM2/uap_attack.py
pointer only (licence: NONE) · get_code("57f374cc9128068a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, CGCL-codes/UAP-SAM2 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.

get_iou Ran
ran, honoured the contract we drafted
CGCL-codes/UAP-SAM2/sam2_util.py
pointer only (licence: NONE) · get_code("971426f0fd97a041")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, CGCL-codes/UAP-SAM2 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.

init_t_xy Ran
ran, honoured the contract we drafted
CGCL-codes/UAP-SAM2/sam2/modeling/position_encoding.py
pointer only (licence: NONE) · get_code("bb060d29525f90eb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, CGCL-codes/UAP-SAM2 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.

reshape_for_broadcast Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
CGCL-codes/UAP-SAM2/sam2/modeling/position_encoding.py
pointer only (licence: NONE) · get_code("f8f09f78b474ee7c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, CGCL-codes/UAP-SAM2 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.

select_closest_cond_frames Ran
ran; our contract draft was wrong, not the code
CGCL-codes/UAP-SAM2/sam2/modeling/sam2_utils.py
pointer only (licence: NONE) · get_code("4ee20f090e58c425")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, CGCL-codes/UAP-SAM2 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.

build_sam2 Not yet run
unverified (harvested, no recorded run)
CGCL-codes/UAP-SAM2/sam2/build_sam.py
pointer only (licence: NONE) · get_code("f9850c1d4acdbb5a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, CGCL-codes/UAP-SAM2 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. No invocation recorded.

build_sam2_hf Not yet run
unverified (harvested, no recorded run)
CGCL-codes/UAP-SAM2/sam2/build_sam.py
pointer only (licence: NONE) · get_code("de8c2a625f263855")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, CGCL-codes/UAP-SAM2 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. No invocation recorded.

build_sam2_video_predictor Not yet run
unverified (harvested, no recorded run)
CGCL-codes/UAP-SAM2/sam2/build_sam.py
pointer only (licence: NONE) · get_code("61b96459a41f7fd9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, CGCL-codes/UAP-SAM2 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. No invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 9 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 7 the same month, 3 later) and 2 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
compute_axial_cis 13 other papers
12 dated earlier, 1 the same month
2302.01872 (2023-02)
MOSE: A New Dataset for Video Object Segmentation in Complex Scenes
2306.01567 (2023-06)
Segment Anything in High Quality
2408.00874 (2024-08)
Medical SAM 2: Segment medical images as video via Segment Anything Model 2
and 10 more not named here
init_t_xy 13 other papers
12 dated earlier, 1 the same month
2302.01872 (2023-02)
MOSE: A New Dataset for Video Object Segmentation in Complex Scenes
2306.01567 (2023-06)
Segment Anything in High Quality
2408.00874 (2024-08)
Medical SAM 2: Segment medical images as video via Segment Anything Model 2
and 10 more not named here
reshape_for_broadcast 13 other papers
12 dated earlier, 1 the same month
2302.01872 (2023-02)
MOSE: A New Dataset for Video Object Segmentation in Complex Scenes
2306.01567 (2023-06)
Segment Anything in High Quality
2408.00874 (2024-08)
Medical SAM 2: Segment medical images as video via Segment Anything Model 2
and 10 more not named here
build_sam2 10 other papers
8 dated earlier, 1 the same month, 1 later
2302.01872 (2023-02)
MOSE: A New Dataset for Video Object Segmentation in Complex Scenes
2306.01567 (2023-06)
Segment Anything in High Quality
2408.07931 (2024-08)
Surgical SAM 2: Real-time Segment Anything in Surgical Video by Efficient Frame Pruning
and 7 more not named here
get_activation_fn 10 other papers
9 dated earlier, 1 the same month
2404.07445 (2024-04)
Multi-view Aggregation Network for Dichotomous Image Segmentation
2407.10749 (2024-07)
SEED: A Simple and Effective 3D DETR in Point Clouds
2408.00874 (2024-08)
Medical SAM 2: Segment medical images as video via Segment Anything Model 2
and 7 more not named here
get_1d_sine_pe 9 other papers
8 dated earlier, 1 the same month · 1 only as an assembly brick
2408.00714 (2024-08)
SAM 2: Segment Anything in Images and Videos
2408.00874 (2024-08)
Medical SAM 2: Segment medical images as video via Segment Anything Model 2
2408.07931 (2024-08)
Surgical SAM 2: Real-time Segment Anything in Surgical Video by Efficient Frame Pruning
and 6 more not named here
select_closest_cond_frames 9 other papers
8 dated earlier, 1 the same month · 1 only as an assembly brick
2408.00714 (2024-08)
SAM 2: Segment Anything in Images and Videos
2408.00874 (2024-08)
Medical SAM 2: Segment medical images as video via Segment Anything Model 2
2408.07931 (2024-08)
Surgical SAM 2: Real-time Segment Anything in Surgical Video by Efficient Frame Pruning
and 6 more not named here
build_sam2_hf 5 other papers
4 dated earlier, 1 later
2302.01872 (2023-02)
MOSE: A New Dataset for Video Object Segmentation in Complex Scenes
2410.16268 (2024-10)
SAM2Long: Enhancing SAM 2 for Long Video Segmentation with a Training-Free Memory Tree
2411.17576 (2024-11)
A Distractor-Aware Memory for Visual Object Tracking with SAM2
and 2 more not named here
build_sam2_video_predictor 1 other paper
1 later
2609.03756 (2026-09)
ENEAS: Embedding-guided Neural Ensemble for Adaptive Segmentation

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-24.

Repositories linked to this paper

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

Abstract

Recent studies reveal the vulnerability of the image segmentation foundation model SAM to adversarial examples. Its successor, SAM2, has attracted significant attention due to its strong generalization capability in video segmentation. However, its robustness remains unexplored, and it is unclear whether existing attacks on SAM can be directly transferred to SAM2. In this paper, we first analyze the performance gap of existing attacks between SAM and SAM2 and highlight two key challenges arising from their architectural differences: directional guidance from the prompt and semantic entanglement across consecutive frames. To address these issues, we propose UAP-SAM2, the first cross-prompt universal adversarial attack against SAM2 driven by dual semantic deviation. For cross-prompt transferability, we begin by designing a target-scanning strategy that divides each frame into k regions, each randomly assigned a prompt, to reduce prompt dependency during optimization. For effectiveness, we design a dual semantic deviation framework that optimizes a UAP by distorting the semantics within the current frame and disrupting the semantic consistency across consecutive frames. Extensive experiments on six datasets across two segmentation tasks demonstrate the effectiveness of the proposed method for SAM2. The comparative results show that UAP-SAM2 significantly outperforms state-of-the-art (SOTA) attacks by a large margin. Our codes are available at: https://github.com/CGCL-codes/UAP-SAM2.

For agents

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

get_harvested_code_for_paper("2510.24195")
get_code_for_paper("2510.24195")
have("2510.24195")

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

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

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

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

Connect an agent — have() is free.