polymorphic virus
termKept in this browser · My desk
A virus, or any malware, that changes its own code in every copy, typically by encrypting its body with a new key and generating a new decryption routine, so that no fixed string of bytes identifies it.
Scanners of the 1980s looked for fixed strings. Encrypted viruses such as Cascade left only a small decryptor in clear; polymorphic ones made the decryptor change too. Virus Bulletin called the 1260 virus of 1990 the first nail in the coffin of virus-specific detection, and Dark Avenger's Mutation Engine of 1992, a module any virus could call, turned the technique into a product. Europol still described Emotet in 2021 as polymorphic, changing its code each time it is called up.
The step from encryption to polymorphism is the decryptor. An encrypted virus hides its body but must carry a decryption routine in clear, and scanners learned to look for that. In Cascade the clear part was about thirty unchanging bytes, enough for a search pattern. The 1260 virus, described in Virus Bulletin in March 1990 as built on the Vienna virus printed in Ralf Burger's 1987 book and later credited to Mark Washburn, inserted random useless instructions among the decoding ones, so that, in the magazine's words, extracting a reliable search pattern became virtually impossible. Peter Lammer's comment in the April 1990 issue gave the numbers: the longest unchanging sequence in 1260's decryptor was three bytes, while ten bytes was the practical minimum for a search pattern and sixteen was advised to keep false positives down. Tequila, written in Switzerland, used variable encryption and infected both boot records and executables.
What the standards call it. The 2005 malware guide of the National Institute of Standards and Technology (NIST), Special Publication (SP) 800-83, sets out the ladder. Self-encryption hides the body, and random keys make each instance look different. Polymorphism is a robust form of self-encryption that also changes the encryption settings and the decryption code, while the body underneath stays the same. Metamorphism goes further and alters the body itself, adding unneeded code or reordering it, so that the result looks fundamentally different; in 2005 NIST judged the older techniques generally handled by antivirus products and metamorphism still considerably harder. MITRE ATT&CK (Adversarial Tactics, Techniques, and Common Knowledge) added Polymorphic Code as sub-technique T1027.014 of Obfuscated Files or Information on 27 September 2024, under the Stealth tactic, and treats polymorphic, metamorphic and mutating code as one thing: code that changes its runtime footprint while keeping its purpose. Readers comparing sources should know that the two vocabularies draw the line in different places.
The Mutation Engine (MtE) of 1992 was the turning point. Fridrik Skulason's analysis in Virus Bulletin in April 1992 describes an object module of about 2 KB, version 0.91, released by the author calling himself Dark Avenger with documentation, a sample virus and support through a Bulgarian bulletin board system, which encrypted the calling virus with a different key every time and generated a different decryptor of variable length; detection with signature strings was, he wrote, totally impractical, and the same issue's table listed two viruses already using it, Dedicated and Fear, with the note that no search pattern was possible. The engine itself was not a virus; it was a toolkit any writer could link in, which made polymorphism available to people who could not have written it. Virus Bulletin saw it as the logical extension of 1260: the first nail in the coffin of virus-specific detection, and for simple scanners perhaps the final one.
The answer was to stop looking for strings. Lammer's 1990 comment already proposed it: identify a virus by everything known about it rather than by a byte pattern. A virus has to recognize its own copies or it reinfects files until they grow too large to load, as one Jerusalem variant did, so it leaves a marker; 1260 set the seconds field of the file's timestamp to 62 and began each infected .COM file with a jump to a point 1,260 bytes before its end. Vendors moved to algorithmic detection, which F-Secure notes can produce false alarms, and to emulation, running the decryptor in a sandbox until the constant body appears; later still, behaviour-based detection watched what the program did rather than what it looked like. ATT&CK's mitigations for T1027.014 point the same way: anti-malware that uses machine learning and behaviour rather than indicators, and attack surface reduction rules on Windows, with detection looking for executables whose hash, entropy or memory sections change between or during runs. Fred Cohen's proof that virus detection is undecidable explains why each answer only moved the race.
Where it lives today. Europol counted Emotet in 2021 among the polymorphic botnets that change their code each time they are called up, which makes signature detection difficult. Palo Alto Networks' Unit 42 reported in February 2021 that BendyBear, shellcode of more than 10,000 bytes that it linked to the BlackTech espionage group, used polymorphic code to change its runtime footprint, thwart memory analysis and evade signatures, decrypting its function blocks only as needed. The practical lesson for defenders is that a file hash identifies one copy, not a family: a blocklist of hashes misses the next copy of anything polymorphic. Neighbours: stealth, armoring and tunneling, the other obfuscation techniques in NIST's list, and, in ATT&CK's terms, software packing and encrypted or encoded files, which are often used together with it. The history is in the Learn article on viruses and trojan horses.
Also known as: polymorphic malware, polymorphism (malware), mutation engine, mte, vírus polimórfico, malware polimórfico
Sources
- Virus Bulletin, March 1990, '1260 - The Variable Virus' (read 2026-11-23): based on the Vienna virus as printed in Ralf Burger's book; random useless instructions in its decryptor make a reliable search pattern virtually impossible
- Fridrik Skulason, 'The Mutation Engine - The Final Nail?', Virus Bulletin, April 1992 (read 2026-11-23): Dark Avenger's MtE 0.91, an object module of about 2 KB released with documentation and support through a Bulgarian BBS; a different key and decryptor in every copy; signature strings impractical; 1260 by Mark Washburn as the first nail
- F-Secure, MtE description (read 2026-11-23): not a virus but an add-on that gives any virus a polymorphic ability; detected by an algorithmic approach that can produce false alarms
- F-Secure, Cascade description (read 2026-11-23): a common virus of the early 1990s whose characters fall to the bottom of the screen; variants with switched decryptor instructions to evade a particular scanner
- Europol, Emotet disrupted, 27 January 2021, read in a browser (read 2026-11-23): many botnets like Emotet are polymorphic, changing their code each time they are called up, which makes signature detection difficult
- Peter Mell, Karen Kent and Joseph Nusbaum, NIST SP 800-83, Guide to Malware Incident Prevention and Handling, November 2005, withdrawn July 2013 (read 2026-11-23): virus obfuscation techniques; self-encryption with random keys makes each instance look different; polymorphism is a robust form of self-encryption that changes the encryption settings and the decryption code while the body stays the same; metamorphism alters the content itself (unneeded code, reordering, recompiling); stealth, armoring and tunneling; older techniques generally handled by antivirus software, metamorphism considerably more difficult
- MITRE ATT&CK, T1027.014 Polymorphic Code, sub-technique of T1027 Obfuscated Files or Information, tactic Stealth, created 27 September 2024, version 2.0 (read 2026-11-23): polymorphic code, also known as metamorphic or mutating code, changes its runtime footprint while achieving the same purpose; used with mutation engines, packing and encrypted files; BendyBear as procedure example; mitigations: machine-learning and behaviour-based anti-malware, Attack Surface Reduction rules; detection of changes in binary hash, entropy or memory sections
- Virus Bulletin, April 1990, Peter Lammer, '1260 Revisited', and the editorial on Ralf Burger's book (read 2026-11-23): 1260 is encrypted like Cascade and its only clear part, the decryptor, is self-modifying; its longest constant sequence is three bytes, while ten bytes is the practical minimum for a search pattern and sixteen is advised against false positives; Cascade keeps about thirty constant bytes; detection by 'virus identity': seconds field set to 62 and a COM file starting with a jump 1,260 bytes before its end; a Jerusalem variant that does not recognize its own signature reinfects files until they fail to load; Burger's 1987 book printed the Vienna listing
- Mike Harbison, Unit 42, Palo Alto Networks, BendyBear: Novel Chinese Shellcode Linked With Cyber Espionage Group BlackTech, 9 February 2021 (read 2026-11-23): over 10,000 bytes of shellcode; named for its polymorphic nature; changes its runtime footprint during execution to thwart memory analysis and evade signaturing; encrypts or decrypts function blocks at runtime as needed; modified RC4; linked to BlackTech, which many researchers assess to have ties to the Chinese government