ConfuserEx Documentation

repository·master·Indexed 25 days ago

https://github.com/mkaring/confuserex

An open-source protector for .NET applications (supporting versions 2.0 through 4.8) designed to obfuscate code and protect against reverse engineering, debugging, and tampering. Features include symbol renaming, control flow obfuscation, constant and resource encryption, and an extensible plugin API. Documentation covers the use of Confuser.CLI.exe and the configuration of .crproj XML project files, including module settings, protection rules, and pattern expressions.

Tokens
905
Snippets
1
Records
7
Agent score
34%

What's inside ConfuserEx

  1. Overview of ConfuserEx features

    master

    ConfuserEx is an open-source protector for .NET applications (successor to the Confuser project). It provides various obfuscation and protection mechanisms including:

    • Symbol Renaming: Supports WPF/BAML.
    • Anti-Debugging/Profiling: Protection against debuggers and profilers.
    • Anti-Memory Dumping: Protection against memory dumping.
    • Anti-Tampering: Method encryption to prevent tampering.
    • Obfuscation: Control flow obfuscation.
    • Encryption: Constant and resource encryption.
    • Reference Hiding: Uses reference hiding proxies.
    • Decompiler Protection: Designed to disable decompilers.
    • Other: Embedding dependencies and compressing output.
    • Extensibility: Includes an extensible plugin API.

    It supports .NET Framework versions 2.0, 3.0, 3.5, 4.0, 4.5, 4.6, 4.7, and 4.8.

  2. Define Protection Rules

    master

    Rules determine how protections are applied to components. Rules are applied in order from global (project level) to local (module level).

    Attributes:

    • inherit: Indicates whether this rule inherits settings from previous rules. Defaults to true.
    • pattern: A pattern expression used to match target components (e.g., types, methods).
    • preset: The protection preset. Possible values: none, minimum, normal, aggressive, and maximum. Defaults to none.

    Elements:

    • protection: Specific protection settings.
  3. Configure the ConfuserEx Project Root

    master

    ConfuserEx projects use the *.crproj file format, which is an XML document. The root element is <project> and it defines global settings for the obfuscation process.

    Attributes:

    • outputDir: The directory where ConfuserEx stores the output files.
    • baseDir: The base directory for all relative paths used in the project document. In the official Confuser.CLI implementation, relative paths are resolved based on the location of the project file.
    • seed: The seed for the random generator used during the protection process.
    • debug: (Currently unused) Indicates whether debug symbols (*.pdb) should be generated.
  4. Configure Module Settings

    master

    The <module> element defines settings for individual modules (assemblies) within a project.

    Attributes:

    • path: The path to the module.
    • snKey: (Optional) The path to the Strong Name Key used to sign the module.
    • snKeyPass: (Optional) The password for the SNK if a PFX container is used in snKey.

    Elements:

    • rule: Protection rules applied specifically to this module.

    Project-level elements affecting modules:

    • probePath: Directories in which ConfuserEx searches for dependencies.
  5. Configure Protection and Packer Settings

    master

    The <protection> and <packer> elements define individual protection or packing settings.

    Attributes:

    • id: The identifier of the protection/packer.
    • action: Determines whether protections are added or removed. Possible values: add (default) and remove.

    Elements:

    • argument: Arguments passed to the protection. Each <argument> requires a name and a value attribute.
  6. Use Pattern Expressions to Match Components

    master

    Rules use pattern expressions to select which items (types, methods, etc.) they apply to. The expression is evaluated for every item; if it returns true, the item is matched.

    Common Pattern Examples:

    • true: Matches all items.
    • name('X'): Matches all items with the name 'X'.
    • member-type('type') and full-name('NS.Type'): Matches types that have the full name 'NS.Type'.
  7. Protect a .NET project using Confuser.CLI.exe

    master

    To protect a .NET application, use the Confuser.CLI.exe command-line tool and provide a ConfuserEx Project file (*.crproj) as the argument. The .crproj file defines the protection settings for your project.

    Confuser.CLI.exe <path to project file>