Code morphing definition
Code morphing is a software obfuscation technique that protects code from reverse engineering, analysis, and cracking by constantly changing its structure. It is a common technique in computer security, particularly in companies that develop proprietary software or sensitive systems. Constantly changing code structure makes it much harder for attackers to understand, replicate, or exploit the code. As a result, code morphing increases software security.
See also: reverse engineering, obfuscation
How code morphing works
- This original source code that must be protected is compiled into machine or low-level code that computers can execute directly.
- The machine code is then transformed or “morphed.“ This transformation can include a variety of techniques, like changing the order of instructions, adding in redundant (no-op) instructions, or substituting instructions with equivalent ones. These transformations aim to alter the machine code so that it does the same thing as before but looks different.
- Computers can’t directly execute the transformed (or “morphed“) code. So, a decoding routine (also called a morphing engine) is added to the final program. This decoding routine is responsible for converting the morphed code back into its original form at runtime, instruction by instruction, just before it's executed.
- When the final program runs, it first uses the decoding routine to convert the morphed instructions to their original form. After that, these instructions are executed as normal.
Benefits of code morphing
- Increased security. Morphed code is much more difficult to reverse engineer (duplicate).
- Intellectual property protection. Companies often invest significant resources in developing unique, effective algorithms. Code morphing can help protect this intellectual property by making it more difficult for competitors to copy or reverse engineer the software.
- Software compatibility. Code morphing may help achieve software compatibility across different hardware architectures.