/

Control Flow

Protection ID: control_flow_advance

This protection modifies the flow of methods so that it cannot be interpreted.

This protection is available in the editions:

Scale Enterprise Admits © Smart Integrity Protection System


How It Works

Control flow obfuscation divides your methods into blocks and rearranges them in a non-linear way while maintaining the original functionality. This creates a "spaghetti code" effect that makes it extremely difficult for decompilers to produce readable or accurate output.

The methods will perform exactly the same functions but the logical flow is obscured, making it challenging to reverse engineer your code. This protection is particularly effective when combined with other obfuscation techniques.


Parameters

  • Intensity integer : This parameter is an integer value of 0 to 100, indicates the size of each block of code divided.
  • Depth integer : This parameter defines the depth of the generated expression if the selected mode is expression or advanced.
  • Invalid code boolean : This parameter is a Boolean value that indicates whether invalid code will be inserted.
  • Operations string : This parameter indicates which operations must be generated to control the flow of the code. The available mutation protection options
  • © Smart Integrity Protection System: It generates advanced operations with native methods that directly affect the flow of code. Enterprise With this parameter the difficulty to solve the original flow increases considerably.

Rules configuration

  • shield.config.json
{
  "protections": {
    "control_flow_advance": {
      "intensity": 10,
      //from 0 to 100, default 10.
      "depth": 5,
      //from 0 to 10, default 5. 
      "invalid code": false,
      //default false
      "operations": "arithmetic|logic|conversion"
      //string with the selected operations separated by a vertical bar default null, you can use all the options available in constants_mutation protection
    }
  }
}

Modes

  • Advanced: Generates dynamic matrices that can change in execution to determine the order of the blocks. This flow control is the most advanced on the market and cannot be correctly interpreted by any decompiler.

Code Example

  • Original code:
public int CalculateSum(int n)
{
    int result = 0;
    for (int i = 1; i <= n; i++)
    {
        result += i;
    }
    return result;
}
  • After control flow obfuscation (conceptual representation):
public int CalculateSum(int n)
{
    int result = 0;
    int i = 1;
    goto block3;

block2:
    result += i;
    i++;
    if (i > n) goto block4;
    
block3:
    if (i <= n) goto block2;
    goto block4;
    
block4:
    return result;
}

Exclusions

  • Exclude with attribute

Include this attribute in your source code:

[Obfuscation(Exclude = false, Feature = "-control_flow_advance")]
  • Exclude from the interface

You can exclude this protection from methods or classes you want using the Shield configuration interface.


When to Use

Control flow obfuscation provides powerful protection for your application:

  • Algorithm protection: Secures methods containing proprietary algorithms or important business logic
  • Security-critical code: Strengthens methods performing authentication, validation, or licensing checks
  • Complex processing logic: Safeguards code that implements unique calculations or processing techniques
  • Anti-reverse engineering: Significantly increases the difficulty of reverse engineering your application

Shield automatically optimizes control flow obfuscation based on your application type and target environment, ensuring the perfect balance between security and performance.

Control flow obfuscation is recommended for most applications as it provides strong protection against reverse engineering. Shield's intelligent engine ensures optimal application performance while maximizing security.


Compatibility

FrameworkCompatibilityComments
.NET Core
.NET Framework
.NET (up to 8 version)
.NET Standard
Xamarin IOS
Xamarin Android
Xamarin MacOs
WPF
Blazor
.NET Maui
Unity
ASP
Silverlight
VBa (Visual Basic) or C# (CSharp)
WinRT

Shield is compatible with all versions of .NET. It automatically adapts to your specific framework, whether you're using .NET 2.0, .NET 4.7, .NET Core 2.1, or Xamarin.Forms 5.0.

Previous
Renamer