Convert Figma logo to code with AI

airbus-seclab logobincat

Binary code static analyser, with IDA integration. Performs value and taint analysis, type reconstruction, use-after-free and double-free detection

1,656
159
1,656
18

Top Related Projects

7,537

A powerful and user-friendly binary analysis platform!

20,547

UNIX-like reverse engineering framework and command-line toolset

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.

7,558

Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, S390x, TriCore, X86)

2,648

Framework for lifting x86, amd64, aarch64, sparc32, and sparc64 program binaries to LLVM bitcode

7,992

RetDec is a retargetable machine-code decompiler based on LLVM.

Quick Overview

BinCAT is a static Binary Code Analysis Toolkit developed by Airbus Security Lab. It's designed for binary analysis, focusing on taint analysis, type reconstruction, and value analysis. BinCAT aims to assist reverse engineers and security researchers in understanding and analyzing binary code more efficiently.

Pros

  • Performs advanced static analysis techniques like taint analysis and type reconstruction
  • Supports multiple architectures including x86, x86-64, and ARM
  • Integrates with popular reverse engineering tools like IDA Pro
  • Provides a Python API for customization and automation

Cons

  • Steep learning curve for users unfamiliar with static analysis concepts
  • Limited documentation and examples for advanced use cases
  • May produce false positives or miss certain types of vulnerabilities
  • Requires manual configuration for optimal results in complex scenarios

Getting Started

To get started with BinCAT:

  1. Clone the repository:

    git clone https://github.com/airbus-seclab/bincat.git
    
  2. Install dependencies:

    cd bincat
    pip install -r requirements.txt
    
  3. Build BinCAT:

    make
    
  4. Install the IDA Pro plugin:

    cp -r python/idabincat ~/.idapro/plugins/
    
  5. Launch IDA Pro and use the BinCAT plugin to analyze your binary files.

For more detailed instructions and usage examples, refer to the project's documentation on GitHub.

Competitor Comparisons

7,537

A powerful and user-friendly binary analysis platform!

Pros of angr

  • More comprehensive and feature-rich binary analysis framework
  • Larger community and ecosystem with extensive documentation
  • Supports a wider range of architectures and file formats

Cons of angr

  • Steeper learning curve due to its complexity
  • Higher resource consumption, especially for large binaries
  • Can be slower for certain types of analysis compared to BinCAT

Code Comparison

BinCAT example (configuration file):

[program]
mode = protected
call_conv = cdecl
mem_model = flat
op_sz = 32
stack_width = 32

angr example (Python script):

import angr

proj = angr.Project('binary')
state = proj.factory.entry_state()
simgr = proj.factory.simulation_manager(state)
simgr.explore(find=0x400000)

Both tools offer binary analysis capabilities, but angr provides a more programmatic approach with its Python API, while BinCAT uses a configuration-based setup. angr's flexibility allows for more complex analyses, but BinCAT's simpler approach can be advantageous for specific use cases.

20,547

UNIX-like reverse engineering framework and command-line toolset

Pros of radare2

  • More comprehensive and feature-rich reverse engineering framework
  • Larger community and ecosystem with extensive documentation
  • Supports a wide range of architectures and file formats

Cons of radare2

  • Steeper learning curve due to its complexity
  • Can be resource-intensive for large binaries
  • Command syntax can be unintuitive for beginners

Code comparison

radare2:

r2 -A binary
[0x00000000]> pdf @ main

BinCAT:

from bincat import BinaryAnalyzer
analyzer = BinaryAnalyzer("binary")
analyzer.analyze()

Key differences

  • radare2 is a full-featured reverse engineering framework, while BinCAT focuses on binary code analysis and taint analysis
  • radare2 offers a command-line interface and scripting capabilities, whereas BinCAT provides a Python API
  • radare2 has a broader scope, including disassembly, debugging, and patching, while BinCAT specializes in static analysis and value tracking

Use cases

  • radare2: Suitable for general-purpose reverse engineering tasks, malware analysis, and CTF challenges
  • BinCAT: Ideal for focused binary code analysis, vulnerability research, and integration into existing analysis pipelines

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.

Pros of Capstone

  • Wider architecture support (x86, ARM, MIPS, PowerPC, etc.)
  • More mature and widely adopted in the security community
  • Extensive language bindings (Python, Java, Go, etc.)

Cons of Capstone

  • Primarily focused on disassembly, not full binary analysis
  • Less emphasis on abstract interpretation and taint analysis
  • May require additional tools for more complex binary analysis tasks

Code Comparison

BinCAT (Python):

from bincat import *
analysis = Analysis('binary_file', 'x86')
result = analysis.run()
print(result.get_registers())

Capstone (Python):

from capstone import *
md = Cs(CS_ARCH_X86, CS_MODE_32)
code = b"\x55\x48\x8b\x05\xb8\x13\x00\x00"
for i in md.disasm(code, 0x1000):
    print(f"0x{i.address:x}:\t{i.mnemonic}\t{i.op_str}")

Summary

Capstone is a lightweight, multi-architecture disassembly framework, while BinCAT is a more specialized binary code analysis toolkit. Capstone excels in providing a simple interface for disassembly across various architectures, making it ideal for quick analysis and integration into other tools. BinCAT, on the other hand, offers more advanced features for in-depth binary analysis, including abstract interpretation and taint analysis, but with a narrower focus on supported architectures.

7,558

Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, S390x, TriCore, X86)

Pros of Unicorn

  • Broader architecture support (x86, ARM, MIPS, SPARC, etc.)
  • More active community and frequent updates
  • Flexible API supporting multiple programming languages

Cons of Unicorn

  • Higher learning curve for beginners
  • May require more setup and configuration
  • Less focused on binary analysis compared to BinCAT

Code Comparison

BinCAT example (Python):

from bincat import *
analyzer = Analyzer()
analyzer.load_binary("binary.exe")
analyzer.run()
results = analyzer.get_results()

Unicorn example (Python):

from unicorn import *
mu = Uc(UC_ARCH_X86, UC_MODE_32)
mu.mem_map(0x1000, 0x1000)
mu.mem_write(0x1000, b"\x41\x4a")
mu.emu_start(0x1000, 0x1002)

Summary

Unicorn is a versatile emulation framework supporting multiple architectures, while BinCAT focuses specifically on binary code analysis. Unicorn offers more flexibility and language support, but may require more setup. BinCAT provides a more streamlined experience for binary analysis tasks. Choose based on your specific needs and expertise level.

2,648

Framework for lifting x86, amd64, aarch64, sparc32, and sparc64 program binaries to LLVM bitcode

Pros of McSema

  • Supports a wider range of architectures, including x86, x86_64, ARM, and AArch64
  • Integrates with LLVM, allowing for advanced code analysis and optimization
  • More actively maintained with frequent updates and contributions

Cons of McSema

  • More complex setup and usage compared to BinCAT
  • Requires more system resources for large-scale binary analysis
  • May produce less precise results in some cases due to its more generalized approach

Code Comparison

McSema example (C++ code for lifting):

#include <remill/BC/Lifter.h>
#include <remill/OS/OS.h>

int main(int argc, char *argv[]) {
  auto binary = remill::LoadBinaryFile(argv[1]);
  auto module = remill::LiftBinaryToModule(binary);
}

BinCAT example (Python script for analysis):

from bincat import BinaryAnalyzer

analyzer = BinaryAnalyzer("binary_file")
analyzer.analyze()
result = analyzer.get_result()

Both tools aim to analyze binary code, but McSema focuses on lifting to LLVM IR for further analysis, while BinCAT provides a more straightforward approach to binary analysis with its own custom intermediate representation.

7,992

RetDec is a retargetable machine-code decompiler based on LLVM.

Pros of RetDec

  • More comprehensive decompilation capabilities, supporting multiple architectures
  • Active development with regular updates and improvements
  • Extensive documentation and user-friendly interface

Cons of RetDec

  • Larger resource footprint and slower processing times
  • Less focused on specific binary analysis tasks compared to BinCAT

Code Comparison

RetDec (C++):

void decompile(const std::string& inputFile) {
    auto decompiler = retdec::Decompiler::createDecompiler();
    decompiler->decompile(inputFile);
    auto code = decompiler->getOutputCode();
}

BinCAT (Python):

def analyze_binary(binary_path):
    analyzer = BinCAT(binary_path)
    analyzer.run_analysis()
    results = analyzer.get_results()

RetDec offers a more general-purpose decompilation approach, while BinCAT focuses on specific binary analysis tasks. RetDec's code demonstrates its decompilation process, whereas BinCAT's code shows its analysis functionality. RetDec is written in C++, which may contribute to its performance characteristics, while BinCAT uses Python, potentially offering easier extensibility but with potential performance trade-offs.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Introduction

What is BinCAT?

BinCAT is a static Binary Code Analysis Toolkit, designed to help reverse engineers, directly from IDA or using Python for automation.

It features:

  • value analysis (registers and memory)
  • taint analysis
  • type reconstruction and propagation
  • backward and forward analysis
  • use-after-free and double-free detection

In action

You can check (an older version of) BinCAT in action here:

Check the tutorial out to see the corresponding tasks.

Quick FAQ

Supported host platforms:

  • IDA plugin: all, version 7.4 or later (Only Python 3 is supported)
  • analyzer (local or remote): Linux, Windows, macOS (maybe)

Supported CPU for analysis (for now):

  • x86-32
  • x86-64
  • ARMv7
  • ARMv8
  • PowerPC

Installation

Only IDA v7.4 or later is supported

Older versions may work, but we won't support them.

Binary distribution install (recommended)

The binary distribution includes everything needed:

  • the analyzer
  • the IDA plugin

Install steps:

  • Extract the binary distribution of BinCAT (not the git repo)
  • In IDA, click on "File -> Script File..." menu (or type ALT-F7)
  • Select install_plugin.py
  • BinCAT is now installed in your IDA user dir
  • Restart IDA

Manual installation

Analyzer

The analyzer can be used locally or through a Web service.

On Linux:

On Windows:

IDA Plugin

BinCAT should work with IDA on Wine, once pip is installed:

Using BinCAT

Quick start

  • Load the plugin by using the Ctrl-Shift-B shortcut, or using the Edit -> Plugins -> BinCAT menu

  • Go to the instruction where you want to start the analysis

  • Select the BinCAT Configuration pane, click <-- Current to define the start address

  • Launch the analysis

Configuration

Global options can be configured through the Edit/BinCAT/Options menu.

Default config and options are stored in $IDAUSR/idabincat/conf.

Options

  • "Use remote bincat": select if you are running docker in a Docker container
  • "Remote URL": http://localhost:5000 (or the URL of a remote BinCAT server)
  • "Autostart": autoload BinCAT at IDA startup
  • "Save to IDB": default state for the save to idb checkbox

Documentation

A manual is provided and check here for a description of the configuration file format.

A tutorial is provided to help you try BinCAT's features.

Article and presentations about BinCAT

Licenses

BinCAT is released under the GNU Affero General Public Licence.

The BinCAT OCaml code includes code from the original Ocaml runtime, released under the LGPLv2.

The BinCAT IDA plugin includes code from python-pyqt5-hexview by Willi Ballenthin, released under the Apache License 2.0.

BinCAT includes a modified copy of newspeak.

Automated builds

Windows

Automated builds are performed automatically (see azure-pipelines.yml). The latest builds and test results can be accessed here

Linux

Automated builds are performed automatically using GitHub Actions (see here), results can be obtained on GitHub's Actions tab.