# Body Mutation

### :fast\_forward:Performance: Medium           :closed\_lock\_with\_key:Potency: High            :brain:Resilience: Medium

## Understanding the protection

Body mutations are a set of techniques used in code obfuscation to protect intellectual property and make it more difficult for attackers to reverse engineer and understand the underlying code. These techniques include constant decomposition, code mangling, and function outlining, among others.

Constant decomposition is a technique that breaks down constant values into multiple smaller parts and stores them in different locations in the code. This makes it difficult for attackers to identify and extract these values, thus protecting the intellectual property embedded in them.

Code mangling is another technique that involves modifying variables, functions, and other code elements to make them less readable and recognizable. This makes it difficult for attackers to understand the code and its functionality, thus protecting the intellectual property contained in it.

Function outlining is a technique that involves extracting common code blocks and placing them in separate functions. This not only improves the code's readability and maintainability, but also makes it harder for attackers to understand the code's functionality and extract its intellectual property.

Overall, body mutations offer several advantages in terms of code obfuscation and IP protection.&#x20;

#### Before Obfuscation:

```csharp
        public static void Main(string[] args) {
          int i, sum = 0, n;
          Console.Write("Enter the Nth Number : ");
          n = int.Parse(Console.ReadLine());
          for (i = 0; i <= n; i++) {
            sum = sum + i;
          }
          Console.WriteLine("\nSum of N Numbers : " + sum);
          Console.ReadLine();
        }
```

#### After Obfuscation:

```csharp
!(~(((((((*(int*)(obj.>)._}}_<_>{>( + 8) & 577869) ^ (*(int*)(obj.>)._}}_<_>{>( + 8) ^ 736216)) != 735706) ? -348746744 : -811) ^ *(int*)(obj.>)._}}_<_>{>( + 8)) + *(int*)(obj.>)._}}_<_>{>( + 4) - *(int*)(obj.>)._}}_<_>{>( + 4) | *(int*)(obj.>)._}}_<_>{>( + 4)) > ((((((*(int*)(obj.>)._}}_<_>{>( + 8) | 25303) ^ (*(int*)(obj.>)._}}_<_>{>( + 8) & 258408)) != 25303) ? -833691950 : 802) ^ *(int*)(obj.>)._}}_<_>{>( + 8)) + *(int*)(obj.>)._}}_<_>{>( + 4) & *(int*)(obj.>)._}}_<_>{>( + 4)) * ((((*(int*)(obj.>)._}}_<_>{>( + 8) + 911987 & (*(int*)(obj.>)._}}_<_>{>( + 8) ^ 188070)) != 52524) ? -1018579007 : 800) ^ *(int*)(obj.>)._}}_<_>{>( + 8))) & (10.681713f / (float)(*(int*)(obj.>)._}}_<_>{>( + 4)) & (float)(*(int*)(obj.>)._}}_<_>{>( + 4)) & (float)(((*(int*)(obj.>)._}}_<_>{>( + 8) + 115805 + (*(int*)(obj.>)._}}_<_>{>( + 8) + 754033) != 871396) ? -1195773132 : 778) ^ *(int*)(obj.>)._}}_<_>{>( + 8))) < (-7.0337505f * (float)(*(int*)(obj.>)._}}_<_>{>( + 4)) + (float)((((*(int*)(obj.>)._}}_<_>{>( + 8) & 375784 & *(int*)(obj.>)._}}_<_>{>( + 8) + 612283) != 512) ? 1057956446 : 840) ^ *(int*)(obj.>)._}}_<_>{>( + 8)) ^ (float)(*(int*)(obj.>)._}}_<_>{>( + 4))))
```

## Exploring the different settings

Due to Body Mutation being a composition of features rather than a single feature, you are allowed to tune the obfuscation parameters.

### Performance Mode

The performance mode will remove the more [resilient](/.net-code-obfuscation/code-obfuscation.md#resilience) techniques in an effort to keep the original performance of the method or application.

{% hint style="warning" %}
The performance mode will maintain potency levels high, however, resilience levels will drop significantly. Only use this setting on non-security critical regions of your code.
{% endhint %}

### Intensity

The intensity sets the complexity of the injected arithmetic and logical functions, this setting increases the [potency](/.net-code-obfuscation/code-obfuscation.md#potency) of the protection.

### Complex CFG

The Complex CFG Mode inserts a set of new techniques that will increase the resilience and potency levels.

{% hint style="info" %}
Applying Complex CFG to a wide selection of methods can affect the performance considerably. Check out[ Attributed based obfuscation](/.net-code-obfuscation/advanced-obfuscation/attribute-based-obfuscation.md) if you want to protect specific methods with this feature.
{% endhint %}

### Enhanced Integrity

The enhanced integrity setting will add extra self-integrity and defensive checks against unwanted tampering and analysis of the application.

### String Melting

The String Melting option melts, mutates, and encrypts the strings stored in your application. The potency and resilience levels are increased.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cyphor.net/.net-code-obfuscation/code-obfuscation/body-mutations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
