Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:0sec labs 0 Decompilation IR Lifting

From Leeroopedia
Knowledge Sources
Domains Binary_Analysis, Decompilation, Reverse_Engineering
Last Updated 2026-10-30 00:00 GMT

Overview

Technique for lifting compiled machine code into an intermediate representation (decompiled C, instruction list, call graph) that enables static and symbolic analysis.

Description

Decompilation and IR lifting is the process of translating native machine code (x86-64, ARM64, MIPS) back into a human-readable and machine-analyzable form. A decompiler backend (Ghidra, rizin, angr) disassembles the binary, reconstructs control flow, recovers data types, and emits pseudo-C code. The resulting intermediate representation includes a decompiled C function map, an instruction list with addresses, a call graph, and recovered sink addresses. This IR is the foundation for all subsequent static analysis — without it, backward taint slicing and bug-class lens application cannot proceed.

Usage

Use this principle when a binary vulnerability pipeline needs to analyze compiled code without source. The backend choice trades off quality (Ghidra produces the best pseudo-C) against freedom (rizin/r2ghidra is fully open-source) and speed (angr's VEX IR is fastest for symbolic execution).

Theoretical Basis

Decompilation involves three core transformations:

  1. Disassembly: machine bytes → instruction stream (decoded per ISA)
  2. Control flow recovery: instruction stream → basic blocks → CFG (handling indirect jumps, switch tables)
  3. Type and structure recovery: stack frame analysis → variable types → structured C (if/while/for)

The IR adapter pattern abstracts over backend differences:

# Abstract interface (NOT real implementation)
adapter = backend.analyze(binary_path)
decompiled_c = adapter.meta.decompiled_c   # dict[function_name -> C code]
instructions = adapter.all_insts()         # list[Inst] with addr, func, kind
callgraph = adapter.meta.callgraph         # dict[caller -> [callees]]

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment