What a polymorphic virus is
A polymorphic virus is a self-replicating program that changes its outward form without changing what it does. Each copy is wrapped in a new encryption layer, so two copies can share almost no bytes. A scanner that compares files byte by byte finds nothing in common between them, and that is the threat's main advantage.
The idea is simple: the visible form changes on every copy while the job stays the same. The job depends on the payload, which can be anything from file damage to a keylogger that records what users type.
How the encrypted wrapper works
The mechanism needs two parts that change and one that does not. The steps describe the idea at a high level, not how the code is built.
- 1
Hide the body
The main program is stored in encrypted form, so the file does not show its instructions.
- 2
Choose a new key
Each new copy is encrypted with a different key, so its bytes differ from every earlier copy.
- 3
Attach a decryptor
A short routine in readable form is added to the file to restore the body.
- 4
Restore and run
When the file starts, the decryptor rebuilds the body in memory and the program carries out its task.
Where the pattern still shows
The encrypted body gives away little, but the decryptor has to be readable, because the computer must be able to run it. Analysts therefore compare the layers, since each one changes in a different way between copies.
| Layer | Changes between copies | What it offers analysts |
|---|---|---|
| Encrypted body | Completely, with each key | Almost nothing, it looks like random data |
| Decryptor routine | Rewritten for each copy | A short routine whose instruction patterns can be matched |
| Decrypted body | Identical in every copy | A stable target once it is in memory |
How defenders catch it
The body appears only while the program runs, so detection has to catch that moment or match the part that never changes. Three approaches do this in practice.
- Pattern matching on the decryptor, which is shorter than the body and can be checked against known samples.
- Emulation, where the file runs for a short time in a controlled environment so the body is decrypted where it can be inspected.
- Behavior monitoring, which flags self-copying, writes to other programs and unexpected network traffic whatever the code looks like.
Common mistakes
Most gaps come from treating the virus as the whole incident. Three habits make a polymorphic infection more costly than it needs to be.
A copy that never matches a known pattern can run unnoticed, so what it does and where data moves matter as much as the match.
- Relying on a single signature scan, which can only find decryptors that were recorded before.
- Ignoring removable media and email attachments, the usual routes a copy takes to a new machine.
- Focusing on cleanup and forgetting the data exfiltration that may already have happened.
Where to start
Start with the machines that hold the most sensitive data, then list the routes that data uses to leave: email, web uploads and removable devices. A decryptor can change from copy to copy, but a file that leaves through a monitored route can be seen and limited.
Anexet DLP works at that layer. It watches the channels that data leaves through, as an endpoint data loss prevention control does, so a leak can be limited even when the infection itself goes unrecognized.
The code can change with every copy, but the data still has to leave the building.
