Control-Flow Flattening

Potency High
Resilience High
Cost High

Description

Control-flow Flattening obfuscates the program's control-flow by adding opaque predicates; flattening the control-flow; and adding irrelevant code clones.

Code Annotation Example

// @jscrambler define controlFlowFlattening {features: [opaqueSteps], minimumBlockSize: 2} as cff
// @jscrambler enable cff

Option Types

Name Required Default Value Description
features No [] List of available features
minimumBlockSize No 1 The number of statements present in a block under which the transformation will skip that block. Accepts values between 1 and 4.

Features

Name Description
clones Clones are semantically equivalent copies of basic blocks that can be executed interchangeably with their original basic blocks.
deadClones Dead Clones are dummy copies of basic blocks that are never executed, but mimic and can be confused with the code that will be executed, adding up to the confusion factor.
opaqueSteps Opaque Steps obfuscates the switching variable, making it harder to understand what is the next switch case that’ll be executed.

API Parameters

Example:

{
  "keys": {
    "accessKey": "XXXXXX",
    "secretKey": "YYYYYY"
  },
  "applicationId": "ZZZZZZ",
  "params": [
    {
      "name": "controlFlowFlattening",
      "options": {
        "features": [],
        "minimumBlockSize": 1
      }
    }
  ]
}