Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
obfuscation_detection — Binary Ninja plugin to identify obfuscated code and other interesting code constructs | Kitploit
Tools/GitHubGitHub/mrphrazer/obfuscation_detection
Static AnalysisReverse EngineeringMalware AnalysisBinary AnalysisFirmware Analysis
GitHubmrphrazer/obfuscation_detection

obfuscation_detection

Binary Ninja plugin to identify obfuscated code and other interesting code constructs

View Repository
67274365 months agoReviewed by Kitploit

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

Obfuscation Detection (v2.4)

Author: Tim Blazytko

Automatically detect obfuscated code and other interesting code constructs

Description:

Obfuscation Detection is a Binary Ninja plugin to detect obfuscated code and interesting code constructs (e.g., state machines) in binaries. Given a binary, the plugin eases analysis by identifying code locations which might be worth a closer look during reverse engineering.

Based on various heuristics, the plugin pinpoints functions that contain complex or uncommon code constructs. Such code constructs may implement

  • obfuscated code
  • state machines and protocols
  • C&C server communication
  • string decryption routines
  • cryptographic algorithms

The following blog posts provide more information about the underlying heuristics and demonstrate their use cases:

  • Automated Detection of Control-flow Flattening
  • Automated Detection of Obfuscated Code
  • Statistical Analysis to Detect Uncommon Code
  • Identification of API Functions in Binaries

Some example use cases can be found in examples. Furthermore, the REcon talk "Unveiling Secrets in Binaries using Code Detection Strategies" demonstrates some use cases. The slides can be found here; the recording can be found here.

Core Features

  • identifies interesting code constructs in large binaries
  • highlights disaligned instructions in Binary Ninja's graph view
  • efficient and architecture-agnostic implementation
  • runs as a background task
  • automatically tags identified functions with the corresponding heuristic or utility
  • can be used in UI and headless mode

Installation

The tool can be installed using Binary Ninja's plugin manager.

For the headless version, follow these steps:

git clone https://github.com/mrphrazer/obfuscation_detection.git
cd obfuscation_detection

# install obfuscation_detection
pip install .

Usage

The plugin can be used in the user interface and in headless mode.

User Interface

Choose Plugins -> Obfuscation Detection to run individual heuristics, or Plugins -> Obfuscation Detection -> Utils to run individual utility detections. The Plugins -> Obfuscation Detection -> All command runs all heuristics and all utilities together.

Plugin Menu

The results are displayed in the Log window:

Binary Ninja Log

By clicking on the identified function addresses, Binary Ninja navigates to the selected function.

Headless

To use the plugin in headless mode, run scripts/detect_obfuscation.py:

$ python3 scripts/detect_obfuscation.py <binary>

This runs all heuristics and all utilities. For machine-readable output, pass --json:

$ python3 scripts/detect_obfuscation.py --json <binary>

The JSON payload contains all results under the detections key. Each detection has a stable id for automation and a human-readable name. Each tagged function finding includes the tag type and description used by the Binary Ninja plugin.

To run only the state machine heuristic in headless mode, use scripts/detect_state_machine.py:

$ python3 scripts/detect_state_machine.py [--json] <binary>

Detection Heuristics

The plugin implements various detection heuristics to detect different code constructs. In the following, we briefly describe the individual heuristics and explain their usage.

Large Basic Block

The large basic block heuristic identifies the top 10% of functions with the largest average number of instructions per basic block. It allows to detect

  • unrolled code
  • cryptographic implementations
  • initialization routines
  • arithmetic obfuscation / Mixed Boolean-Arithmetic

Complex Function

The complex function heuristic identifies the top 10% of functions with the most complex control-flow graphs (based on cyclomatic complexity). It allows to identify

  • complex dispatching routines and protocols
  • state machines
  • functions obfuscated with opaque predicates

State Machine

The state machine heuristic uses graph-theoretic properties to identify functions implementing state machines. Usually, such state machines can be represented as switch statements that are dispatched in a loop. The heuristic allows to identify

  • network protocol dispatching
  • file parsing logic
  • C&C server communication / command dispatching
  • control-flow flattening

Uncommon Instruction Sequence

The uncommon instruction sequence heuristic performs a statistical analysis to identify the top 10% of functions whose code patterns deviate from a pre-computed ground truth. This way, the heuristic allows to identify

  • cryptographic implementations
  • intense usage of floating point arithmetic
  • arithmetic obfuscation / Mixed Boolean-Arithmetic
  • generic obfuscation patterns

Overlapping Instruction

The overlapping instruction heuristic identifies functions with disaligned instructions (instruction bytes are shared by two different instructions). The heuristic identifies

  • broken disassembly (e.g., data which is marked as code)
  • opaque predicates which jump into other instructions

If the heuristic is used in Binary Ninja's user interface, overlapping instructions are also highlighted in the graph view.

Most Called Function

The most called function heuristic identifies the top 10% of functions with the largest number of calls from different functions. This way, the heuristic can identify

  • string decryption routines
  • library functions in statically linked binaries

Loop Frequency

The heuristic identifies functions with a high number of loops. These kind of functions might implement

  • a complex parsing logic for structured data formats
  • intensive algorithmic computations

The heuristic also helps pinpointing potential performance bottlenecks.

Irreducible Loop

The heuristic identifies functions with rare and complex loop structures that typically suggest

  • aggressive compiler optimizations
  • hand-written assembly
  • usage of goto statements
  • obfuscated code

XOR Decryption Loop

The heuristic identifies functions which perform an XOR operation with a constant inside of a loop. This way, the heuristic can identify

  • string decryption routines
  • code decryption stubs
  • cryptographic implementations

Complex Arithmetic Expression

The heuristic identifies functions in which the expressions have more than one arithmetic operation and one boolean operation simultaneously. This way, the heuristic can identify

  • mixed-boolean arithmetic obfuscation
  • initialization routine
  • cryptographic implementations

Duplicate Subgraph

The heuristic uses an iterative context-hashing approach to detect repeated multi-block structures within each function’s control-flow graph. By comparing each block’s opcode signature along with the signatures of its successors, the heuristic identifies subgraphs that are duplicated or near-duplicated in a single function. This helps pinpoint:

Download Tool