Construction of Countably Infinite Programs That Evade Malware/Non-Malware Classification for Any Given Formal System

Vasiliki Liagkou, Panagiotis E. Nastou, Paul G. Spirakis, Yannis C. StamatiouCryptogr 2025 · DOI

TL;DR

This paper proves that it's theoretically impossible to create a perfect, universal malware detector. For any given formal system designed to classify programs as malware or not, the authors show how to construct an infinite number of programs that this system cannot classify. Even more concerning, many of these unclassifiable programs are actually malicious.

What Problem Does This Paper Address?

The core problem this paper tackles is the fundamental limit of detecting malware. For decades, researchers have tried to build automated systems that can reliably distinguish malicious software from benign software. Fred Cohen's early work in the 1980s showed that detecting even a specific type of malware (computer viruses that replicate themselves) is an undecidable problem – meaning no algorithm can solve it for all cases. This paper extends Cohen's findings by proposing a more general model of malware behavior and proving that, for any formal system attempting to classify malware, there will always be programs that can evade detection. This has significant implications for the design and inherent limitations of all anti-malware solutions.

Methods

The authors leverage the theoretical framework of Computability Theory, specifically using Turing Machines as the computational model. They generalize Fred Cohen's definition of a virus to a broader concept of malware behavior, defining it as a Turing Machine that enters a specific set of "malware states" during its execution.

The key technical contributions involve:

  • Formalizing Malware Behavior: Defining malware not just by its code, but by the sequence of actions it performs, modeled as transitions between states in a Turing Machine. This is shown to be equivalent to the Sequence Traversal Problem, which is itself proven to be equivalent to the Halting Problem (a classic undecidable problem).
  • Constructing Evasive Programs: Using results from Recursive Function Theory, particularly the Recursion Theorem and Kleene's Smn-theorem, they demonstrate how to construct Turing Machines that possess properties unprovable within a given formal system.
  • Obfuscator Turing Machines: They introduce the concept of an "obfuscator Turing Machine" – a program with unprovable properties that can be used to hide actual malware. This allows them to construct programs that are malicious but whose malware status cannot be proven by the formal system.

Datasets

Not discussed in the paper. This paper is a theoretical computer science work focusing on formal proofs and constructions, not empirical evaluation on datasets.

Key Insights and Ideas

  • Malware Detection is Fundamentally Undecidable: This isn't just a matter of current technology limitations; it's a theoretical impossibility for any system based on formal logic.
  • Sequences of Actions Matter: Malware's maliciousness often lies in the order of operations, not just individual malicious instructions. This makes detection akin to predicting the entire execution path, which is computationally intractable.
  • Formal Systems Have Inherent Blind Spots: Any formal system (representing an anti-malware detector) has limitations. The authors show how to construct programs that exploit these blind spots, making them undetectable by that specific system.
  • "Stealth" Malware is Theoretically Possible: The concept of obfuscators allows for the creation of malware that hides its true nature by leveraging the unprovable properties of the formal system used for detection.
  • Zero-Day Exploits are Inevitable: The ability to construct programs that evade detection implies that zero-day exploits (malware that exploits unknown vulnerabilities) are not just a practical problem but a theoretical consequence of formal systems.

Key Results

  • The paper formally proves that the malware/non-malware classification problem is undecidable for any given formal system.
  • For any consistent formal system F, they can construct an infinite, effectively enumerable set of Turing Machines that cannot be classified as malware or non-malware by F.
  • They further show that for any consistent formal system F, they can construct an infinite, effectively enumerable set of Turing Machines that are actually malware but for which no proof exists within F that they are indeed malware.

Limitations and Future Work

  • Idealized Model: The use of Turing Machines is an idealized model. Real-world computers have finite resources, which can make some theoretically undecidable problems practically decidable (though often with extreme inefficiency). The authors acknowledge this but argue that the theoretical impossibility still highlights fundamental challenges.
  • Generalization of Malware Definition: While the paper generalizes Cohen's virus definition, it acknowledges that its model of malware behavior (sequences of states) is a simplification and may not capture all complex malware behaviors.
  • Future Work: The authors suggest investigating the decidability problem for more complex definitions of malware behavior, including those based on sequences of specific computational steps or the languages that malware Turing Machines accept. They also propose exploring how these theoretical findings can inform practical anti-malware strategies and potentially guide the development of AI/ML approaches by understanding their theoretical underpinnings and limitations.

Summary updated

Abstract

The formal study of computer malware was initiated in the seminal work of Fred Cohen in the mid-80s, who applied elements of Computation Theory in the investigation of the theoretical limits of using the Turing Machine formal model of computation in detecting viruses. Cohen gave a simple but realistic formal definition of the characteristic actions of a computer virus as a Turing Machine that replicates itself and proved that detecting this behaviour, in general, is an undecidable problem. In this paper, we complement Cohen’s approach by providing a simple generalization of his definition of a computer virus so as to model any type of malware behaviour and showing that the malware/non-malware classification problem is, again, undecidable. Most importantly, beyond Cohen’s work, our work provides a generic theoretical framework for studying anti-malware applications and identifying, at an early stage, before their deployment, several of their inherent vulnerabilities which may lead to the construction of zero-day exploits and malware strains with stealth properties. To this end, we show that for any given formal system, which can be seen as an anti-malware formal model, there are infinitely many, effectively constructible programs for which no proof can be produced by the formal system that they are either malware or non-malware programs. Moreover, infinitely many of these programs are, indeed, malware programs which evade the detection powers of the given formal system.
BibTeX
@article{liagkou2025construction,
  author = {Vasiliki Liagkou and Panagiotis E. Nastou and Paul G. Spirakis and Yannis C. Stamatiou},
  title = {{Construction of Countably Infinite Programs That Evade Malware/Non-Malware Classification for Any Given Formal System}},
  journal = {Cryptogr.},
  year = {2025},
  doi = {10.3390/cryptography9010016},
}

Loading related content...

Figure