Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between metamorphic and polymorphic code?

Tags:

c++

security

Metamorphic code is code that outputs a semantically equivalent version of itself: https://en.wikipedia.org/wiki/Metamorphic_code

However, a polymorphic code is code that uses a polymorphic engine to mutate while keeping the original algorithm intact: https://en.wikipedia.org/wiki/Polymorphic_engine

So, is the sole difference that polymorphic code relies on some other program (polymorphic engine), while the metamorphic has this functionality built-in?

Can someone provide an example of polymorphic code either through a link or in an answer?

Thank you,

like image 924
Shuzheng Avatar asked Jul 04 '16 12:07

Shuzheng


People also ask

What are the similarities between polymorphic and metamorphic malware?

Metamorphic malwares are body-polymorphic [10], i.e. Instead of generating new decryptor, a new instance (body) is created without changing its actions. Similar to polymorphic malware, obfuscation techniques can be used to create new instances.

What is the difference between a polymorphic virus and a metamorphic virus How can such viruses be detected by an antivirus scanner?

A polymorphic virus is a harmful, destructive or intrusive type malware that can change, making it difficult to detect with anti-malware programs. A metamorphic virus is a virus that is rewritten with every iteration so that every succeeding version of the code is different from the proceeding one.

What is the purpose of polymorphic code?

Polymorphic code allows a program to process objects differently depending on their data type or class, with the ability to redefine methods for derived classes.

What is meant by polymorphic of viruses?

Polymorphic viruses are complex file infectors that can create modified versions of itself to avoid detection yet retain the same basic routines after every infection. To vary their physical file makeup during each infection, polymorphic viruses encrypt their codes and use different encryption keys every time.


1 Answers

The key difference between polymorphic code and metamorphic code is whether the code that is actually executed changes or not. A polymorphic virus decrypts its code, runs that code, and then when propagating itself encrypts the decrypted code with a different key. When run on a different machine the decrypted code is the same. A metamorphic virus simply runs its code and then when propagating itself mutates its code into different but functionally identical code. The executed code is different on every machine its propagated to.

This means that with a polymorphic virus its possible to inspect the original unencrypted code by simply running it (ideally in some sort of safe sandbox environment) and then examining the decrypted version of the code in memory. With metamorphic code this doesn't work, the virus never generates an original version of itself.

Note that the term "polymorphic code" is confusing. Out of context, to most programmers it would mean code that written using polymorphic types.

like image 67
Ross Ridge Avatar answered Nov 14 '22 22:11

Ross Ridge