Explainability-Guided Adversarial Attacks on Transformer-Based Malware Detectors Using Control Flow Graphs
Authors: Andrew Wheeler, Kshitiz Aryal, Maanak Gupta
Organizations: Department of Computer Science, Tennessee Tech University, Cookeville, USA · School of Interdisciplinary Informatics, University of Nebraska Omaha, Omaha, USA
Transformer-based malware detection systems operating on graph modalities such as control flow graphs (CFGs) achieve strong performance by modeling structural relationships in program behavior. However, their robustness to adversarial evasion attacks remains underexplored. This paper examines the vulnerability of a RoBERTa-based malware detector that linearizes CFGs into sequences of function calls, a design choice that enables transformer modeling but may introduce token-level sensitivities and ordering artifacts exploitable by adversaries. By evaluating evasion strategies within this graph-to-sequence framework, we provide insight into the practical robustness of transformer-based malware detectors beyond aggregate detection accuracy. This paper proposes a white-box adversarial evasion attack that leverages explainability mechanisms to identify and perturb most influential graph components. Using token- and word-level attributions derived from integrated gradients, the attack iteratively replaces positively attributed function calls with synthetic external imports, producing adversarial CFG representations without altering overall program structure. Experimental evaluation on small- and large-scale Windows Portable Executable (PE) datasets demonstrates that the proposed method can reliably induce misclassification, even against models trained to high accuracy. Our results highlight that explainability tools, while valuable for interpretability, can also expose critical attack surfaces in transformer-based malware detectors.
Figures & tables
Paper
Model Architecture
Modality
Attack Context
Contributions
Raff et al. [ 21 ]
Neural Network
Raw Byte Sequences
N/A
Creation of advance malware classifier for large scale classification.
Nicosia et al. [ 17 ]
MalGAN
CFG
Black-box
Modification of the MalGAN framework for control flow modalities.
Yan et al. [ 27 ]
GNN
CFG
N/A
Implements global and local explainability for CFGs.
Shoukouhinejad et al. [ 23 ]
GNN
CFG
N/A
Utilization of advance explainability techniques for control flow modalities.
Soi et al. [ 24 ]
DNN
FCG
N/A
Augmentation of FCGs via inclusion of DEX information from APK files.
Govea et al. [ 8 ]
GNN + CyberBert
Network Logs + Traffic Flow
N/A
Development of robust detector model using privacy-preserving federated learning.
TABLE I: Summary of related works
Fig. 1: Generalized threat model of malware detection system.
Fig. 2: Overview of the adversarial generation procedure.
Fig. 3: Architecture of the Graphene framework.
Rounds
sg
ai
sn
Mean
Median
Mean
Median
Mean
Median
1
87.72%
87.88%
2255
2249
97.24%
96.61%
2
88.52%
90.40%
2365
2318
93.81%
97.50%
3
91.44%
90.04%
2300
2285
99.37%
99.77%
5
90.81%
90.60%
2278
2271
99.65%
99.74%
TABLE II: Attack statistics for RoBERTa trained on small dataset.
Rounds
sg
ai
sn
Mean
Median
Mean
Median
Mean
Median
1
61.51%
61.20%
1802
1867
85.40%
86.86%
2
65.53%
64.40%
1720
1733
95.34%
95.80%
3
69.88%
69.76%
1804
1798
96.95%
97.00%
5
67.36%
70.96%
1911
2031
88.21%
88.23%
TABLE III: Attack statistics for RoBERTa trained on large dataset.
Function Call
Function Count
entry0
5307
sym.imp.KERNEL32.dll_GetStartupInfoA
3153
sym.imp.KERNEL32.dll_GetModuleHandleA
2631
sym.imp.MSVCRT.dll__set_app_type
2282
sym.imp.MSVCRT.dll___p__fmode
2282
sym.imp.MSVCRT.dll___p__commode
2282
TABLE IV: Top ten most common function calls in small dataset.
Machine learning-based static malware detectors remain vulnerable to adversarial evasion techniques, such as metamorphic engine mutations. To address this vulnerability, we propose a certifiably robust malware detection framework based on randomized smoothing through feature ablation and targeted noise injection. During evaluation, our system analyzes an executable by generating multiple ablated variants, classifies them by using a smoothed classifier, and identifies the final label based on the majority vote. By analyzing the top-class voting distribution and the Wilson score interval, we derive a formal certificate that guarantees robustness within a specific radius against feature-space perturbations. We evaluate our approach by comparing the performance of the base classifier and the smoothed classifier on both clean executables and ablated variants generated using PyMetaEngine. Our results demonstrate that the proposed smoothed classifier successfully provides certifiable robustness against metamorphic evasion attacks without requiring modifications to the underlying machine learning architecture.
Nandakrishna Giri, Asmitha K. A., Serena Nicolazzo +2
Department of Computer Applications, Cochin University of Science and Technology, India · Department of Electrical, Computer and Biomedical Engineering, University of Pavia, Via Adolfo Ferrata 5, 27100, Pavia, Italy
Malware development and detection have undergone significant changes in recent years as modern concepts, such as machine learning, have been used for both adversarial attacks and defense. Despite intensive research on Windows Portable Executable (PE) files, there is minimal work on Linux Executable and Linkable Format (ELF). In this work, we summarize the academic papers submitted in this field and develop a new adversarial malware generator for the ELF format. Using a variety of metrics, we thoroughly evaluated our generator and achieved an Evasion Rate of 67.74 % while changing the confidence of the malware detector by -0.50 in the mean case for the dataset used. In our approach, we chose MalConv as the target classifier. Using this classifier, we found that the most successful modifications used strings typical of benign files as a data source. We conducted a variety of experiments and concluded that the target classifier appears sensitive to strings at any location within the executable file.
Lukáš Hrdonka, Martin Jureček
Faculty of Information Technology, Czech Technical University in Prague, Thákurova 9, Prague, Czech Republic
Malware detection is a critical task in cybersecurity, and graph neural networks over control flow graphs have shown promising results for it. However, detectors are usually evaluated on a random split of a corpus collected over a single period, which cannot show how well a model generalizes to later samples. This study addresses that limitation with a strict temporal split: every model is trained on one period and scored once on a later one. Two corpora of control flow graphs, each node carrying 37 features, were extracted statically from 1,989 Windows portable executables: 459 graphs from 2024-2025 for training and 223 from 2026 for evaluation. Twelve variants and a flat-feature control were trained on the earlier corpus. The choice of message-passing operator changes robustness to the shift significantly, and every pairwise gap that survives correction separates an aggregating architecture from one built around a learned attentional readout. The ranking also reverses: the flat control, which sees node features but no topology, is the best in-distribution model and among the worst across the boundary, so a conventional benchmark would have rejected message passing. Neither recalibration nor ensembling substitutes for the operator choice. Attributions do not shift, but explanation validity is architecture-specific, and the most accurate operator on the later corpus is the hardest to explain. An architecture derived from the finding matches the best searched operator without search. The shift affects both malware and benign classes alike, so these are results about robustness to distribution shift, not malware evolution.