Skip to content

Name Protection

Martin Karing edited this page Dec 31, 2020 · 12 revisions

ID: rename
Preset: Minimum
Availability: ConfuserEx ConfuserEx 2

This protection obfuscate the symbols' name so the decompiled source code can neither be compiled nor read.

Parameters

  • mode: This parameter define the way ConfuserEx renames symbols. Supported values are:

    • empty: ConfuserEx would rename all symbols to a empty string.
      Expect many problems when using this mode.
    • unicode: ConfuserEx would rename symbols to Unicode unreadable characters.
      Reflection may not work in this mode. (default)
    • ascii: ConfuserEx would rename symbols to readable ASCII characters.
      Reflection may not work in this mode.
    • letters: ConfuserEx would rename symbols to English letters.
    • decodable: ConfuserEx would rename symbols to decodable string. The obfuscated name mapping would be saved to output folder in the file "symbols.map".
    • sequential: ConfuserEx would rename symbols to sequential string. The obfuscated name mapping would be saved to output folder in the file "symbols.map".
    • reversible: ConfuserEx would encrypt the symbols. The obfuscated names could be decoded by providing the password used in obfuscation.
    • debug: ConfuserEx would add an underscore before the symbols. Not intended for production use.
  • password: This parameter is a string value, indicates the password ConfuserEx should use to encrypt the symbol names when mode is set to reversible. Only effective on modules. This parameter is not set by default.

  • renameArgs: This parameter is a boolean value, indicates whether ConfuserEx should remove the name of methods' parameters.

    • true: Rename the parameters of methods. (default)
    • false: Don't rename the parameters.
  • renEnum: This parameter is a boolean value, indicates whether ConfuserEx should change the name of enum values.

    • true: Rename the members of enums.
    • false: Don't rename the members of enums. (default)
  • flatten: This parameter is a boolean value, indicates whether ConfuserEx should flatten the types by removing the namespaces.

    • true: Remove the namespaces of renamed types. (default)
    • false: Keep the namespaces as they are.
  • forceRen: This parameter is a boolean value, indicates whether ConfuserEx should rename the symbols even if the analyzer shows that it should not be renamed.

    • true: Always rename the type or member. This shouldn't be enabled for every member under any circumstances. Enabling it for single types or members were the analyzer came to the wrong conclusion can improve the obfuscation.
    • false: Rename the member only in case the analyzer deems to safe to rename. (default)
  • renPublic: This parameter is a boolean value, indicates whether ConfuserEx should rename the symbols even if the item is visible outside the assembly.

    • true: Rename members and types visible outside of the assembly.
    • false: Don't rename members and types visible outside of the assembly. (default)

    Types that are declared public, but are located in executable assemblies, are not considered to be visible outside of the assembly and will be renamed even if this parameter is set to false.

  • renPdb: This parameter is a boolean value, indicates whether ConfuserEx should rename the variable names and the file names in PDB.

  • true: Rename the values in the pdb file.

  • false: Don't rename anything in the pdb file. (default)

Enabling this is only useful in case you want to public the debug symbole file, but you don't want anyone to be able to reconstruct part of the code using it. Usually it's a good idea to avoid deploying the pdb file to the users.

  • renXaml: This parameter is a boolean value, indicates whether ConfuserEx should rename the XAML file name.

    • true: Rename the file names of XAML files. (default)
    • false: Don't rename the XAML files.

    Renaming the XAML files assumes that the UI framework used is WPF. @AvaloniaUI is currently not supported.

Example

<protection id="rename">
  <argument name="mode" value="unicode" />
  <argument name="password" value="This password is secret" />
  <argument name="renameArgs" value="true" />
  <argument name="renEnum" value="true" />
  <argument name="flatten" value="true" />
  <argument name="forceRen" value="false" />
  <argument name="renPublic" value="false" />
  <argument name="renPdb" value="true" />
  <argument name="renXaml" value="true" />
</protection>

Types that are marked as serializable are in general not renamed, to ensure that the serialized data can be deserialized across assemblies that are obfuscated differently. In case the serialization is only used for cross-domain communication for example, it may be useful to enforce renaming in this case.

<rule pattern="not is-public() and is-type('serializable')">
  <protection id="rename">
    <argument name="forceRen" value="true" />
  </protection>
</rule>

Remarks

This is a highly effective and irreversible protection for the assembly. Tuning this protection to obfuscate as many names as possible should always be a focus. Using the mode values unicode and ascii creates names compiler is not able to use. So the directly decompiled code will not compile properly.

Deobfuscators have no way to restore the original naming and are only able to guess the original names or use a default pattern for restored names.