Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
Polymorphic malware encrypts itself with a fresh key for every copy and changes the routine that unwraps it, so a thousand downloads produce a thousand unique files.

What Is Polymorphic Malware?
Polymorphic malware changes how it looks every time it replicates, while doing exactly the same thing. The payload is encrypted with a different key for each copy, and the small decryption routine attached to it is regenerated as well, so there is no fixed sequence of bytes for a scanner to match. Two infections from the same campaign can be completely different files.
The idea is old enough to be foundational. The Mutation Engine written by the author known as Dark Avenger in 1992 was distributed as a library that any virus writer could bolt on, which turned a specialist technique into a commodity almost immediately. That pattern, capability packaged for resale, has defined the problem ever since.
A polymorphic sample has two parts: an encrypted body containing the actual malware, and a decryptor that reconstructs it in memory at runtime. Only the decryptor is exposed on disk, so it is the decryptor that must keep changing. Mutation engines achieve that by varying the encryption algorithm and key, substituting equivalent instructions, inserting junk code between the real ones, shuffling register usage, and padding with loops that compute nothing.
What never changes is the decrypted body. Once the routine has run, the original code sits in memory identical to every other copy, and that is the opening defenders use.
Hand-written mutation engines are now unusual. The same result is produced far more cheaply in three ways:
This is why hash-based blocklists have such a short half-life. A file hash describes one build of something that is rebuilt continuously, and sharing it after the fact rarely prevents the next infection.
The three terms get used interchangeably and should not be. A packer compresses or encrypts a binary, usually with a stub that stays the same from build to build unless deliberately varied. Polymorphic malware varies that stub and key on every copy while preserving a constant hidden body. Metamorphic malware has no hidden body at all; it rewrites its own instructions, so there is no decrypted form to recover. In descending order of frequency you will meet packed samples constantly, polymorphic generation often, and true metamorphism almost never.
Every polymorphic sample has to decrypt itself to run, and the moment it does, the variation stops helping it.
Practically, this means judging an endpoint product by what it does after execution begins rather than by the size of its definition set, and measuring your own detection coverage by technique rather than by indicator count. A detection built on a file hash is worth one build of one campaign; a detection built on what the malware must do is worth all of them. At Privia Security, our managed security services are built around that behavioural layer, because the file layer is the one attackers can change for free.
By never presenting the same file twice. The payload is encrypted with a new key for each copy and the decryption routine is regenerated, so signatures written against previous samples do not match. It works against static file matching only. Once the sample decrypts itself in memory, the underlying code is identical across every variant and can be detected there.
It is a hint rather than proof. Many things produce unique hashes, including ordinary software builds, per-user installers, and files with embedded licence data. Combined with high entropy, an almost empty import table, execution from a user profile directory, and no signature, a one-of-a-kind binary becomes a strong indicator worth investigating rather than dismissing.
They help with confirmed incidents and with commodity malware that is not regenerated, and they cost almost nothing to apply. What they cannot do is prevent the next variant, because the next variant has a different hash by design. Treat shared hashes as a way to scope an investigation retrospectively, not as a preventive control you can rely on.
It makes it harder to detect, not more capable. The payload and its effects are unchanged; only the packaging differs. The practical consequence is a longer dwell time before discovery, which is what turns a contained infection into a serious incident, so the response is better detection after execution rather than more effort spent matching files.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.