List of obfuscators for .NET
- This article was considered for deletion at Wikipedia on August 12 2016. This is a backup of Wikipedia:List_of_obfuscators_for_.NET. All of its AfDs can be found at Wikipedia:Special:PrefixIndex/Wikipedia:Articles_for_deletion/List_of_obfuscators_for_.NET, the first at Wikipedia:Wikipedia:Articles_for_deletion/List_of_obfuscators_for_.NET.
- Wikipedia editors had multiple issues with this page:
- This article needs additional references for verification. Please help by adding citations to reliable sources. Unsourced material will not be challenged and removed. (August 2014)
- The topic of this article may not meet Wikipedia's general notability guideline. But, that doesn't mean someone has to… establish notability by citing reliable secondary sources that are independent of the topic and provide significant coverage of it beyond its mere trivial mention. (February 2014)
Compiling a .NET project generates an assembly that contains Intermediate Language (CIL) instructions, managed resources and metadata describing the types, methods, properties, fields and events in the assembly. This metadata allows inspecting the assembly through the reflection API which makes dynamic code like data bindings in WPF possible. But this metadata and the high-level nature of CIL instructions make it possible to understand the assembly structure and the method instructions in order to decompile it to the high-level source code. In many cases, the generated source code looks similar to the original source code used by the compiler. It lacks code formatting and comments but it has all the type and member names. An attacker could use this information to understand how a program was implemented, which would allow the access to manipulate or to extract sensitive information or algorithms.
Obfuscation is the process of modifying an assembly so that it is no longer useful to a hacker but remains usable to the machine for executing the intended operations. While it may change metadata or the actual method instructions, it does not alter the logic flow or the output of the program. There are several techniques that can be used which are described below.
There are a number of .NET obfuscators available including a free one that is part of Visual Studio (Dotfuscator CE). Note, not all of these support the latest version of the .NET framework, Xamarin and Universal Apps. Different obfuscators support different protection methods, however, most share common features which can be used for the purpose of comparison. The list is followed by a brief explanation of each one of the features on which the comparison is based.
The list of features below has not been vetted by a credible authority with references. For example, a vendor may claim to support a specific feature that only works under a very narrow set of circumstances and some vendors may deliberately manipulate the feature list for a competitor. As always, do you own research, testing and validation.
Name obfuscation changes the name of types and members. Name obfuscation makes the decompiled source harder to understand but the overall flow of the code is not obscured. The new names can follow different schemes like "a", "b", "c", or numbers, characters from non-Latin scripts, unprintable characters or invisible characters. Names may be used multiple times in a scope by using overloading. While proper names are technically not required to execute the assembly, the resulting assembly would be unverifiable.
Name obfuscation is the most basic technique that is used by every .NET obfuscator solution.
In a managed assembly all strings are clearly identifiable and readable. Even when methods are renamed, strings used in a method may give clues about the purpose of the method. This includes messages (especially error messages) that are displayed to the user. Those strings can be tracked down to the code that uses them. String encryption works by modifying all strings in the assembly and restore their original value at runtime. Since the string data must be restored automatically at runtime, usually without the user providing a decryption key, the data cannot actually be encrypted but only encoded. The algorithm that decodes the data is always included in the obfuscated assembly. This process may affect the runtime performance of the program, either once at startup or for every string usage.
Control Flow Obfuscation
Control flow obfuscation is about modifying the program so that it yields the same result when run, but is impossible to decompile into a well-structured source code and is more difficult to understand. Most code obfuscators would replace CIL instructions produced by a .NET compiler with
gotos and other instructions that may not be decompiled into a valid source code. This process may affect the runtime performance of a method.
Method Call Redirection
The way CIL instructions work references to external types and methods are clearly visible and will be unaffected by name obfuscation and control flow obfuscation. Even without reasonable names, the fact that a method makes use of certain framework classes like I/O, networking or cryptography can draw attention to it. Calls to suspicious methods can be redirected through a generated method that only wraps the original call. This wrapper method can be renamed and the called method's name will no longer appear in the obfuscated method body. The Just-In-Time compiler (JIT) will normally inline such short wrapper methods so that it does not affect runtime performance.
Code encryption protects the CIL instructions by encrypting them and stripping the original instructions from the assembly. The encrypted instructions are kept in a separate storage. When the assembly is loaded a native runtime executive assumes control of portions of the .NET runtime and manages decrypting the CIL as needed. If the native code is involved, the application may not run on different platforms anymore.
Code virtualization converts the CIL code into virtual opcodes that will only be understood by a secure virtual machine. As opposed to protecting CIL code through encryption where the encrypted code must be decrypted back into CIL before it can be executed by the CLR, code virtualization uses a virtual machine which directly processes the protected code in the form of a virtual machine language. Code virtualization feature is by far the strongest protection method available in code protection arena today as it implements a one-way code transformation. The code is never translated back to its original form, instead, the virtual machine emulates the original code behavior. Code virtualization can significantly degrade performance and make debugging very difficult.
The data stored in the class fields are vulnerable to analysis and unauthorized modification at runtime. The virtualization helps to minimize this vector of attack by changing the way the data are presented in memory and in the assembly file. The original fields are replaced with special holders that store the values in encrypted form. The data are only decrypted when the value is used by the program code, after that it gets cleared from the memory.
Symbol files are .pdb files for Visual Studio applications that show how the compiler converted source code into machine code. They contain mappings from CIL elements and method body offsets to the original source code files. These symbol files are required to use a debugger on the assembly. The obfuscated assembly is a modified version of the original assembly and the original assembly's symbol files do not match the obfuscated one. The obfuscator software must, therefore, write the corresponding debug symbols for the obfuscated assembly. This file should not be deployed with the application (as it would defeat the purpose of obfuscation) but it can be used by the developer to analyze issues in the obfuscated assembly.