The Effect of Data Poisoning on Counterfactual Explanations

André Artelt, Shubham Sharma, Freddy Lécué, Barbara Hammer

Abstract

Counterfactual explanations provide a popular method for analyzing the predictions of black-box systems, and they can offer the opportunity for computational recourse by suggesting actionable changes on how to change the input to obtain a different (i.e. more favorable) system output. However, recent work highlighted their vulnerability to different types of manipulations. This work studies the vulnerability of counterfactual explanations to data poisoning. We formally introduce and investigate data poisoning in the context of counterfactual explanations for increasing the cost of recourse on three different levels: locally for a single instance, or a sub-group of instances, or globally for all instances. In this context, we characterize and prove the correctness of several different data poisonings. We also empirically demonstrate that state-of-the-art counterfactual generation methods and toolboxes are vulnerable to such data poisoning.

Introduction

Counterfactual Explanations (CFEs) have emerged as the "gold standard" for providing actionable recourse in Explainable AI (XAI). When a machine learning model makes an unfavorable decision—such as denying a loan application—a CFE provides the user with a specific path to reversal: "If your income were $5,000 higher, your loan would be approved." While previous research has identified vulnerabilities in these explanations during the inference stage (run-time), this paper explores a more insidious threat: training-stage data poisoning.

The authors investigate whether an attacker can inject a small number of malicious samples into a training set to shift a model's decision boundary. The goal of such an attack is not to destroy the model's accuracy, but to intentionally increase the "cost of recourse," making it significantly harder or more expensive for users to achieve a favorable outcome.

Methodology: Surgical Data Poisoning

The research proposes a model-agnostic data poisoning framework designed to manipulate the decision boundary with surgical precision. Unlike traditional "label flipping" attacks that aim to degrade overall model performance, this framework focuses on the explanation itself.

Targeting Levels

The attack can be configured at three distinct levels of granularity:

  1. Global: Increasing the recourse cost for the entire population.
  2. Sub-group: Targeting specific protected classes or demographics.
  3. Local: Manipulating the recourse path for a single specific individual.

Poison Generation and Stealth

The attacker identifies samples near the existing decision boundary and uses counterfactual generation methods (such as DiCE) to create "poisonous" versions of these samples. These points are placed just across the boundary to force the newly trained model to shift its limits, effectively "pushing the goalposts" back for the user. To ensure stealth, the optimization objective ensures these samples are "plausible"—they sit on the data manifold and resemble legitimate data points, allowing them to bypass traditional outlier detection systems.

Experimental Results

The study evaluated the attack across several benchmarks, including the Diabetes dataset, German Credit (loan approval), and the Hanoi Benchmark for Water Distribution Networks (WDN).

Impact on Recourse

The findings demonstrate that injecting as little as 5% poisonous data leads to a statistically significant increase in recourse cost. In local attack scenarios on the Diabetes dataset, the cost of recourse jumped by as much as 39%. Beyond just increasing the "distance" to a favorable outcome, the poisoning also increased the sparsity of the explanations, meaning users were forced to change a higher number of features to achieve a different result.

The Failure of Traditional Defenses

One of the most concerning findings is the failure of standard data sanitization methods. The authors tested five classic defenses, including Isolation Forest and k-NN-based defenses. These methods struggled to identify the poisonous samples, often showing a recall of less than 20-30%. Because the poisonous samples are generated to be plausible and close to the existing data distribution, they do not appear as "noise" to traditional detectors.

Real-World Implications

In the Hanoi Benchmark case study, poisoning an event detector in a water network made it significantly more difficult for engineers to pinpoint the cause of sensor faults. This suggests that poisoning attacks on CFEs could have dire consequences in critical infrastructure, where delayed or obscured explanations can hinder emergency responses.

Conclusion

This research highlights that the explanation itself is a high-value target for malicious actors. Current state-of-the-art counterfactual generation toolboxes are highly vulnerable to informed poisoning strategies, while remaining largely unaffected by random label flipping. As XAI becomes more integrated into sensitive domains like finance and healthcare, there is an urgent need to design CFE algorithms that are inherently robust to training-set manipulations, rather than relying on post-hoc defenses that currently fail to protect users.

Summary updated

Abstract

Counterfactual explanations provide a popular method for analyzing the predictions of black-box systems, and they can offer the opportunity for computational recourse by suggesting actionable changes on how to change the input to obtain a different (i.e.\ more favorable) system output. However, recent work highlighted their vulnerability to different types of manipulations. This work studies the vulnerability of counterfactual explanations to data poisoning. We formally introduce and investigate data poisoning in the context of counterfactual explanations for increasing the cost of recourse on three different levels: locally for a single instance, or a sub-group of instances, or globally for all instances. In this context, we characterize and prove the correctness of several different data poisonings. We also empirically demonstrate that state-of-the-art counterfactual generation methods and toolboxes are vulnerable to such data poisoning.
BibTeX
@article{artelt2026effect,
  author = {André Artelt and Shubham Sharma and Freddy Lécué and Barbara Hammer},
  title = {{The Effect of Data Poisoning on Counterfactual Explanations}},
  journal = {Information Fusion},
  year = {2026},
  doi = {10.1016/j.inffus.2026.104237},
}
Figure