arXiv:2608.27007cs.CRAug 2026

Manuscript Offprint

arXiv:2608.27007

Metamorphism: A mathematical challenge for antivirus technology

Luis M. Augusto

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Metamorphic viruses, currently the most advanced computer viruses in the wild, have the unique ability of mutating their own code virtually into infinitely many highly dissimilar copies of themselves that nevertheless have the same functionality. This ability—metamorphism—together with other advanced obfuscation techniques makes these computer viruses virtually undetectable by the antivirus technology available in the market today. In this paper, I show that viral metamorphism is fully attainable by the employment of van Wijngaarden grammars. The challenge then for an antivirus software is to embed the Turing machine that decides the language generated by the grammar.

1 Introduction

Computer viruses, which have been around since the early 1970s, are essentially computer programs that can replicate their own code in their infected targets. Their growth in number and type has been exponential from early on: Tellingly, in less than five years M. A. Ludwig had to revise the title of his book first published in 1991 by changing it from The Little Black Book of Computer Viruses [1] to The Giant Black Book of Computer Viruses [2]—my bold-font emphasis. But then things got much, much worse when antivirus software companies had to worry not only about the number of viruses in the wild but also with the mathematical properties of a few of them. In effect, in the early 2000s some clever computer virus designers realized the malicious potential hidden in mathematics. This general approach to the design of malware, now known as malicious mathematics and generally explored in a few monographs (e.g., [3,4]) and papers (e.g., [5,6]), forced antivirus software companies to upgrade their staff and technology to the highest level in computing. 1^{1}

As a matter of fact, not all software companies bothered to do so, as only—possibly negligibly—few virus designers can cope with the hard requirements of mathematics, malicious or otherwise.

*Published as a working paper in Ω::=Journal\Omega::=Journal of Formal Languages under the title “Metamorphism: A mathematical challenge for antivirus software”; submitted for standard publication in August 2026.

1^{1}Malicious mathematics finds applications in other fields of malicious intent, such as cryptography; see, e.g., [7].

This is a particularly Herculean task in the case of the metamorphic viruses, i.e. viruses that generate highly dissimilar replicas of themselves to escape detection and analysis by antivirus technology (AVT); see, e.g., [8-12]. Every computer virus is a program written in some computer language such as an assembly language or a programming language; as such, writing a “typical” virus requires from a virus designer no more maths than writing a typical program does from a programmer. In fact, your usual “lamers” or “script kiddies” (i.e. unskilled malware users) can easily, albeit illegally, download kits available on the Internet that basically write the viruses for them. In contrast, metamorphic viruses require, besides the usual computing expertise, strong mathematical skills both in formal languages and automata theory and in computability theory, two subjects that are typically conjoined in a single course in a computer science curriculum (e.g., [13]). 2^{2}

Thus, writing a successful metamorphic virus is a computational feat, so much so that most antivirus companies regard the threat of one such virus as abstract as the mathematics it is created on. (An honorable exception is Symantec, which as early as 2003 already included these viruses in its white paper; cf. [15].) But the payoff of going to the great lengths of writing a metamorphic virus is their undetectability, with polymorphic techniques, less advanced than metamorphism, already placing a virus in the NP-complete class [16]. In other words, the payload for these virtually undetectable viruses may belie the old motto that “crime does not pay.” These viruses are evolving slowly, but their hybridization with advanced obfuscation techniques such as k-ary coding simply cannot be ignored; see, e.g., [17] and [18]. Additionally, their predictably core role in future warfare makes their comprehensive analysis not only necessary, but also urgent.

Here, drawing on F. Cohen's original formalization of computer virology based on the Turing machine I associate metamorphic viruses with a special kind of formal grammars, to wit, the van Wijngaarden grammars. I claim that a pure metamorphic virus can be designed entirely by means of a van Wijngaarden grammar; the challenge then for an AVT is to embed the Turing machine that decides the language generated by the given grammar. The present discussion continues previous work in [19-21] on the syntax and semantics of these grammars and sets a formal research program in computer virology.

References (42)