Functionality Preserving Adversarial Attacks on Malware Detectors

This direction is no longer present in the current build. Its last version stays readable and citable here.

Version 1 of 119 papers24 conceptsfrozen 2026-10-04

In the world of computer vision, an adversarial attack is often as simple as changing a few pixels to turn a "panda" into a "gibbon." In the world of cybersecurity, however, the task is far more constrained. If you change a single byte in a malware binary, you might break the program entirely, rendering the "attack" useless.

This challenge is known as the problem-feature space dilemma, a concept explored by Xiang Ling and colleagues in Adversarial Attacks against Windows PE Malware Detection: A Survey of the State-of-the-Art. To fool a machine learning model, an attacker must modify the file's features (the bytes), but to remain a threat, they must preserve the file's semantics (the malicious logic).

Researchers have converged on a shared strategy to solve this: exploiting the structural flexibility of file formats to hide adversarial "noise" where it won't interfere with execution.

Exploiting Structural Flexibility

The most straightforward way to bypass a detector without breaking a program is to put the adversarial perturbations in places the operating system ignores.

Early work by Bojan Kolosnjaji and Battista Biggio in Adversarial Malware Binaries: Evading Deep Learning for Malware Detection in Executables demonstrated that simply appending carefully crafted bytes to the end of a file—an area called the "overlay"—could drastically reduce detection rates. Because the OS loader doesn't execute the overlay, the malware's logic remains untouched.

However, modern detectors have become sensitive to these "appended" attacks. In response, researchers like Scott E. Coull and Jeffrey Johns developed the Slack Attack in Exploring Adversarial Examples in Malware Detection. This technique identifies "slack space"—unused gaps between file sections created by compiler alignment—and fills them with adversarial data. By hiding perturbations inside the file structure rather than at the end, the attack exploits the "positional blindness" of neural networks.

Semantics-Invariant Transformations

Beyond just filling gaps, researchers have developed more sophisticated "semantics-invariant" transformations. These modifications change the physical layout of the file while keeping the execution flow identical.

The RAMEN and GAMMA frameworks, developed by Luca Demetrio and Battista Biggio, automate these transformations. As detailed in Adversarial EXEmples: A Survey and Experimental Evaluation of Practical Attacks on Machine Learning for Windows Malware Detection, these attacks can:

  • Shift sections: Move blocks of code to different offsets.
  • Extend headers: Grow the metadata sections of a file to house adversarial bytes.
  • Inject new sections: Create entirely new, non-executable sections that contain benign-looking data to "dilute" the malicious signal.

These structural changes are powerful because they target the way static detectors (like MalConv) "see" the file as a raw sequence of bytes, rather than understanding what the code actually does.

Logic-Integrated Modifications

The most resilient form of adversarial malware doesn't just hide in the gaps; it integrates the perturbations into the code itself.

In Optimization-Guided Binary Diversification to Mislead Neural Networks for Malware Detection, Mahmood Sharif and Keane Lucas introduced Malware Makeover. Instead of adding "junk" data, they use binary diversification—techniques like instruction substitution or register swapping—to change the functional code.

Similarly, Asaf Shabtai and Ishai Rosenberg proposed injecting "no-op" API calls in Low Resource Black-Box End-to-End Attack Against State of the Art API Call Based Malware Classifiers. These are legitimate system calls that return success but do nothing, effectively mimicking the dynamic behavior of benign software.

Because these changes are part of the program's execution path, they are nearly impossible for defenders to "strip" or "sanitize" without breaking the program. As Keane Lucas notes in Deceiving ML-Based Friend-or-Foe Identification for Executables, logic-integrated modifications are significantly more robust than padding-based attacks, which can often be defeated by simple file preprocessing.

Optimization in a Discrete Space

The final piece of the puzzle is how to find the right bytes to inject. Since binary files are discrete (you can't have "half a byte"), researchers use specialized optimization techniques.

  • Gradient-based attacks: If the attacker has access to the model (white-box), they can use gradients to find the optimal bytes, as seen in the work of Bojan Kolosnjaji.
  • Genetic Algorithms: In black-box scenarios where only a "malicious/benign" score is available, the GAMMA attack uses genetic algorithms to evolve a population of malware variants until one succeeds.
  • Zeroth-Order Optimization: The ZEXE framework by Marco Rando and Luca Demetrio maps discrete bytes into a continuous mathematical space, allowing for more efficient optimization that requires fewer queries and adds less "junk" data to the file.

By combining these optimization methods with functionality-preserving transformations, this research direction has shown that even commercial-grade antivirus solutions are highly vulnerable to automated evasion.

Papers in this version

History & citationVersion 1 · 2026-10-04

No longer present in the current build · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_functionality_preserving_adversarial_att_90b643ea,
  title = {Functionality Preserving Adversarial Attacks on Malware Detectors},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/functionality-preserving-adversarial-attacks-on-malware-detectors/rdr_90b643eac88b49c49c277ec8365be4f2},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-23},
}

This exact version (version 1, frozen text):

@misc{lacuna_functionality_preserving_adversarial_att_90b643ea_v1,
  title = {Functionality Preserving Adversarial Attacks on Malware Detectors},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/functionality-preserving-adversarial-attacks-on-malware-detectors/rdr_90b643eac88b49c49c277ec8365be4f2/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-23},
}