Q-MALDetect: Quantum Image-Based Malware Detection and Adversarial Robustness Analysis

Walid El Maouaki, Mohammad Izen, Nouhaila Innan, Alberto Marchisio, Muhammad ShafiquearXiv 2026 · arXiv

TL;DR

Q-MALDetect introduces a hybrid quantum-classical neural network designed to detect Linux malware by treating binary files as images. While the model achieves an impressive 97.2% clean accuracy, the researchers demonstrate that it remains highly susceptible to both standard adversarial "pixel" tweaks and sophisticated, executable-preserving mutations, revealing a critical "defense mismatch" where common denoising techniques can actually make the model more vulnerable to real-world attacks.

What Problem Does This Paper Address?

Deep learning has revolutionized malware detection by treating binary files (like Linux ELF files) as grayscale images, allowing convolutional neural networks (CNNs) to spot malicious patterns without manual feature engineering. However, these models are notoriously fragile against adversarial attacks—small, intentional perturbations that trigger misclassification.

In the malware domain, this is doubly complex. A "feature-space" attack might flip pixels in an image to fool a model, but those changes might break the underlying program, making the attack useless in practice. This paper explores the robustness of Quantum Machine Learning (QML) models—specifically hybrid quantum-classical detectors—against both unconstrained image attacks and "problem-space" attacks that ensure the resulting malware still actually runs.

Methods

The authors developed Q-MALDetect, a pipeline that converts ELF binaries into 224x224 images and processes them through a hybrid architecture:

  1. Classical Frontend: A 3-layer CNN extracts high-level features from the byte-images.
  2. Quantum Bridge: A fully connected layer maps classical features into a format suitable for quantum states.
  3. Variational Quantum Circuit (VQC): A 4-qubit circuit using amplitude encoding and "Strongly Entangling Layers" to perform the final classification.
Fig. 1: Q-MALDetect evaluation workflow. ELF binaries are converted to 224 × 224 normalized byte images and divided into a 1,200-sample model-development pool and a 100-malware attack holdout. A CNN bridge supplies normalized amplitudes to a variational quantum circuit. The evaluation covers three feature-space attacks and two Grad-CAM-guided, executable-aware NOP-insertion attacks; dynamic adversarial training and CAE preprocessing are then tested under the same attack families. Ablations vary perturbation budget, qubit count, encoding interface, and NOP length, while the final stage reports clean metrics, ASR, attribution behavior, and noise-model sensitivity.

To test robustness, they employed a spectrum of attacks:

  • Feature-Space: Standard gradient-based attacks like FGSM and PGD, plus a "Compound" attack that combines them.
  • Problem-Space: A novel Grad-CAM-guided attack that identifies influential byte regions in the .text (code) section and inserts semantically neutral "No-Operation" (NOP) instructions. They even tested a version where a Q-learning agent learns which NOP sequences are most effective at evading detection.

Datasets

The study utilized the Labeled-ELFs repository, consisting of 1,300 x86-64 ELF binaries (600 benign and 700 malware).

  • Training/Dev Pool: 1,200 samples.
  • Attack Holdout: 100 malware samples, reserved exclusively for evaluating attack success.
  • Preprocessing: Files were truncated or padded to a fixed size and normalized to $[0, 1]$ pixel values.

Key Insights and Ideas

  • The CAE Paradox (Defense Mismatch): One of the most striking findings involves the use of a Convolutional Autoencoder (CAE) as a pre-filter to "clean" adversarial noise. While the CAE successfully reduced the success of pixel-level attacks, it actually increased the success rate of executable-aware NOP attacks.
  • Attribution Shifting: The reason for the CAE paradox is visible through Grad-CAM (Gradient-weighted Class Activation Mapping). The CAE forces the model to focus its "attention" more heavily on the mutable .text region of the binary. By concentrating the model's decision-making logic into a smaller, attackable area, the CAE inadvertently makes the attacker's job easier.
Fig. 2: Representative attribution shift under CAE preprocessing. (a) Original malware byte image. (b) The base-model Grad-CAM map is spatially diffuse. (c) The CAE-model map concentrates high activation in a narrow horizontal band aligned with the analyzed .text region. The two numbered callouts mark segments of this same high-activation band, not separate processing stages. Across 495 paired maps, .text attribution mass increases from 35.2% to 45.7%.
  • Quantum Scaling isn't Linear for Robustness: Increasing the number of qubits (from 2 to 9) did not lead to a monotonic improvement in robustness. This suggests that for hybrid QML, robustness is a property of the entire system—encoding, circuit depth, and optimization—rather than just "quantum power."
  • Layout Matters More Than Logic: In the NOP-insertion attacks, the specific type of NOP instruction mattered less than the fact that bytes were being shifted. The total displacement of the file's layout was the primary driver of evasion.

Key Results

  • Clean Performance: The undefended model reached 97.2% training accuracy and a malware recall of 99.6%.
  • Attack Vulnerability: The undefended model was highly vulnerable to the "Compound" feature-space attack, with an Attack Success Rate (ASR) of 78.7%. Executable-aware NOP attacks achieved a conditional ASR of 32.9%.
  • Defense Efficacy: Dynamic Adversarial Training (AT) proved to be the most robust defense, slashing the feature-space ASR to just 5.0% and the NOP-insertion ASR to 9.0%.
Fig. 4: ASR under the undefended, CAE-defended, and adversarially trained conditions. FGSM, PGD, and Compound are feature- space ASRs; Grad-CAM+NOP and Grad-CAM+RL are conditional executable ASRs. Bar labels round the corresponding means to whole percentages. AT reduces all five attacks, whereas the CAE reduces feature-space ASR but increases both executable-aware rates.

Limitations and Future Work

The authors acknowledge several areas for further exploration:

  • Dataset Scale: The study used a relatively small dataset (1,300 samples). Scaling to larger, more diverse malware repositories is necessary for production-grade validation.
  • Mutation Diversity: The problem-space attacks were limited to NOP insertions in the .text section. Future work could explore more complex binary transformations like instruction substitution or code transposition.
  • Hardware Realism: While the paper simulated hardware noise (using the FakeManilaV2 model), testing on actual physical quantum processors remains a future milestone to account for real-world decoherence and gate errors.

Ultimately, the paper warns that high "clean" accuracy is a deceptive metric for QML security tools. True reliability requires testing against adaptive, domain-specific mutations that respect the constraints of the underlying software.

Summary updated

Abstract

Quantum machine-learning (QML) models are increasingly considered for security applications, yet their adversarial robustness in malware analysis remains insufficiently understood. This paper presents Q-MALDetect, a hybrid convolutional and variational-quantum detector for byte-image representations of x86-64 Executable and Linkable Format (ELF) binaries, and evaluates it under feature-space and a range of Grad-CAM-guided, executable-aware evasion attacks. The model achieves 97.2% training accuracy, but its robustness deteriorates as attack strength increases, with the strongest evaluated feature-space attack reaching a 78.7% attack success rate (ASR). Among executable-aware attacks, Grad-CAM-guided no-operation (NOP) insertion produces the highest conditional ASR of 32.9%. Dynamic adversarial training is the most effective evaluated defense, reducing feature-space ASR to as low as 5.0%, executable-aware ASR to 7.7%, and the sequential-attack ASR to 34.0%. In contrast, convolutional-autoencoder preprocessing increases executable-aware ASR to 39.7%, coinciding with a rise in Grad-CAM attribution mass within the mutable .text region from 35.2% to 45.7%. Ablation results reveal no monotonic relationship between qubit count and robustness, while the encoding interface modifies the learned attack surface without neutralizing the strongest attack. These findings demonstrate that the effectiveness of attacks and defenses depends strongly on the perturbation constraints and evaluation conditions. Reliable deployment of QML malware detectors therefore requires assessment against both feature-space and executable-aware attacks rather than reliance on clean accuracy or generic denoising alone.
BibTeX
@misc{maouaki2026q,
  author = {Walid El Maouaki and Mohammad Izen and Nouhaila Innan and Alberto Marchisio and Muhammad Shafique},
  title = {{Q-MALDetect: Quantum Image-Based Malware Detection and Adversarial Robustness Analysis}},
  year = {2026},
  eprint = {2610.26240},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.26240},
}
Figure