arXiv:2610.37015cs.CVOct 2026

Manuscript Offprint

arXiv:2610.37015

RePAIR: Inverting Backdoor Attacks in Semantic Segmentation

Arnold Brosch, Kira Maag

ABSTRACT

Despite significant advances in computer vision, semantic segmentation models remain vulnerable to backdoor attacks, posing a security risk. These attacks redirect pixels of a chosen victim class to an attacker-specified target class when a trigger is present, while preserving clean predictions. Existing defenses are largely derived from image classification, while dedicated segmentation defenses remain scarce and typically require retraining or model modification. We introduce RePAIR, a post-hoc, label-free, attack-unaware defense based on the observation that backdoor-induced shifts can be stronger in the classifier head than in internal representations, leaving recoverable victim-class semantics. RePAIR infers the victim-target relation from an unlabeled, potentially contaminated image pool, constructs a safety-approved semantic reference, and localizes suspicious pixels by comparing head predictions with internal semantic evidence. It then applies feature-space and output corrections toward the inferred victim semantics, while conservative localization and output constraints limit changes to benign predictions. We model the attack as adversarial probability transport and repair as its approximate reversal, deriving bounds and sufficient conditions for localization, residual attack success, clean-side changes, defense-induced target predictions, and attack-unaware pair identification. Experiments across segmentation architectures and attack settings show that RePAIR substantially reduces attack success while largely preserving clean performance.

1 INTRODUCTION

Semantic segmentation assigns a semantic class to every pixel proving perception in safety-critical systems such as automated driving (Cakir et al., 2022) and medical imaging (Taghanaki et al., 2024). Semantic segmentation networks are vulnerable to backdoor attacks that preserve normal performance on benign inputs while inducing targeted failures when a trigger is present (Li et al., 2021b). For instance, a backdoor can cause a vehicle to disappear from the semantic map by relabeling its pixels as road, without affecting the prediction for the rest of the image. Semantic segmentation backdoors have developed from fixed trigger patterns and predefined victim-target mappings (Li et al., 2021b) toward increasingly flexible attack settings. Existing attacks allow the victim class to depend on trigger placement (Mao et al., 2023), exploit contextual relationships between semantic classes (Abbasi et al., 2025), or automatically optimize triggers and attack configurations (Lan et al., 2024). These attacks demonstrate that backdoors can induce targeted and spatially localized prediction changes under flexible conditions, making the development of robust defenses challenging.

While attacks on dense prediction tasks have received increasing attention, effective defenses remain comparatively underexplored. Detection-oriented methods can identify suspicious inputs or models but do not necessarily remove the underlying backdoor (Liu et al., 2023). Mitigation approaches based on retraining (e.g. fine-tuning and pruning) often require additional clean data and may alter the model's behavior (Liu et al., 2018). For semantic segmentation, effective defenses should selectively correct attacked pixels while limiting changes to unrelated regions, motivating selective repair rather than global model modification.

In this paper, we introduce a Representation-guided pixel-wise attack Repair (RePAIR) against backdoor attacks on semantic segmentation models. We focus on a key empirical observation: the

Figure

Figure 1: From left to right: poisoned image, prediction under the backdoor attack, prediction after applying our defense and ground truth segmentation.

backdoor-induced shift can be substantially stronger in the final task decision than in an appropriately chosen internal semantic representation, even when the encoder itself is affected by the backdoor. Victim semantics can therefore remain partially recoverable even when the head predicts the attacker-selected target. The representation that exposes this state is architecture-dependent. E.g. for DeepLabV3+ (Chen et al., 2018) with a ResNet-50 backbone, the final backbone stage immediately before atrous spatial pyramid pooling provides a useful reference. For SegFormer (Xie et al., 2021) with a MiT-B5 backbone, no single block is sufficient. Victim evidence is distributed across several internal blocks and is reconstructed by a learned multi-layer logistic read-out.

This observation has a natural geometric interpretation. For each pixel, the predicted class probabilities form a point in the probability simplex, where each coordinate represents the probability assigned to one semantic class. An idealized targeted backdoor shifts probability mass from a victim class to an attacker-selected target class, moving the prediction toward the target and away from the victim while remaining within the same simplex. Natural segmentation errors can also shift probability mass between classes (typically not concentrated in one direction), but a backdoor induces a systematic flow from one semantic class to another.

This directed view can be described by a local transport operator acting on the class-probability distribution. RePAIR approximates the corresponding reverse transport from surviving victim evidence and model-derived reference geometry, while treating feasible victim-target pairs as hypotheses and identifying the attacked relation without prior knowledge of either class.

A correct victim–target pair alone is not sufficient for a safe repair. The reference data used for repair must also be protected from poisoned samples, otherwise, the defense may learn the very distortion it is meant to remove. We therefore first identify candidate clean images and then check whether they provide reliable evidence of the victim class before using them for repair. An image is rejected if its internal victim evidence is severely degraded, or if a moderate degradation is accompanied by an unusually strong shift from the victim class to the target class. Rejected images are not replaced merely to meet a desired reference-set size. If too little reliable victim evidence remains, the defense does not construct a repair state. Together, these components form our method for selective and reliable backdoor repair. The source code of our method is publicly available at https://github.com/A-Brosch/RePAIR. Our contributions can be summarized as follows:

• We introduce a post-hoc repair method for backdoored semantic segmentation models that reconstructs victim-consistent semantics and selectively corrects attacked pixels, without retraining or globally modifying the deployed network.

• We develop a theoretical framework that models targeted segmentation backdoors as directed victim-to-target transport in the class-probability simplex. This view links surviving internal evidence to localization, residual attack success, attack-unaware pair identification, and clean-side safety.

• Our method for generating a reliable repair reference is attack-unaware and operates on potentially compromised data. It identifies consistent victim-to-target evidence and screens candidate clean-like images with a one-way victim-safety firewall.

• We develop architecture-specific semantic references for both convolutional- and transformer-based segmentation models, showing that the information required for repair may be concentrated in a single representation or distributed across multiple internal layers.

2 RELATED WORK

Backdoors Attacks. The first work adapted the BadNets attack (Gu et al., 2019) from image classification to semantic segmentation, using either a black stripe at the image border as a non-semantic trigger or a semantic class present in the image as a trigger (Li et al., 2021b). Once activated, the attack relabeled all pixels of a victim class as a target class. The Influencer Backdoor Attack (IBA, (Lan et al., 2024)) places a trigger on non-victim pixels while relabeling the victim class as a predefined target. It further introduces Nearest Neighbor Injection (NNI) and Pixel Random Labeling (PRL), which respectively place the trigger near the victim region and add random label changes to non-victim pixels to strengthen the attack's reliance on global context. The Object-Free Backdoor Attack (OFBA, (Mao et al., 2023)) places the trigger on the target object and varies victim classes and trigger positions during training, allowing the victim class to be selected by trigger placement at inference time while keeping the target class fixed. The Contextual Segmentation attack (ConSeg) uses a natural semantic trigger, such as a motorcycle, instead of an artificial pattern (Abbasi et al., 2025). It relabels the victim class as the target and adds a small number of co-occurring target-related classes within the victim region to strengthen the contextual association. BADSEG (Zhang et al., 2026) broadens the attack space to four attack types: Object-to-Object (O2O), Object-to-Background (O2B), Background-to-Object (B2O), and Background-to-Background (B2B), along with instance-level and conditional variants. A surrogate model optimizes trigger parameters and selects victim-target pairs using feature-space class centroids.

Defense Methods. Work on defenses against backdoor attacks in semantic segmentation remains limited, and existing studies therefore mainly adapt defenses originally developed for image classification. Test-time detection methods such as STRIP (Gao et al., 2019) and TeCo (Liu et al., 2023) detect suspicious inputs by measuring prediction entropy under image superposition or prediction consistency under image corruptions, respectively. Similarly, Zeng et al. (Zeng et al., 2021) detect anomalous trigger-related patterns in frequency domain (Ahmed et al., 1974). BEATRIX (Ma et al., 2023) detects anomalous internal representations using class-conditional higher-order Gram matrices (Zhang et al., 2026). These methods aim to identify suspicious inputs but do not repair the affected predictions or remove the underlying backdoor. Pruning (Liu et al., 2018) removes neurons with low activation on benign inputs and fine-tunes the remaining network on clean data to eliminate dormant backdoor components and recover clean performance. Fine-tuning (Sha et al., 2022) instead directly retrains the potentially compromised model on clean data to weaken the learned association between trigger and target. Both methods were also evaluated as defenses against segmentation backdoors, but both require access to clean data for mitigation (Lan et al., 2024; Zhang et al., 2026). Segment Cleanse (Mao et al., 2023) adapts Neural Cleanse (Wang et al., 2019) to semantic segmentation by reconstructing object-level trigger candidates and mitigating detected backdoors through retraining, likewise requiring model modification and clean data. Anti Backdoor Learning (ABL, (Li et al., 2021a)) exploits differences in training loss dynamics to identify suspicious samples and reduce their influence through gradient ascent. While these approaches identify or suppress backdoor behavior, they do not enable post-hoc, selective repair of affected pixels in a deployed model.

RePAIR differs from detection-based methods (e.g. STRIP, TeCo, frequency-domain defenses, and BEATRIX), which identify suspicious inputs, samples, or internal representations but do not repair the affected predictions. In contrast to model-modification approaches such as pruning, fine-tuning, and Segment Cleanse, our method does not retrain or otherwise alter the compromised model. It is also applied post-hoc, unlike ABL, which operates during training. Finally, RePAIR requires neither ground truth labels nor an external clean reference set, instead deriving the information needed for selective repair from the model and available data while leaving unaffected predictions unchanged.

References (21)