GO KALI FREE

Radare2

Reverse Engineering

Advancedlow risk

Radare2 (r2) is a complete open-source framework for reverse engineering and binary analysis. It bundles a disassembler, debugger, hex editor, and scripting engine into a single lightweight command-line toolkit that supports dozens of architectures and executable formats.

Installation

sudo apt install radare2

Basic Syntax

r2 [options] <binary>

Quick Facts

Full Name
Radare2 (r2)
License
GNU LGPL
Language
C
Platforms
Linux, macOS, Windows, Android (Termux)
Category
Reverse Engineering
Created By
radareorg
Architectures
30+ (x86, ARM, MIPS, RISC-V, ...)
File Formats
ELF, PE, Mach-O, DEX, raw

Tool Overview

Radare2 is a free, open-source command-line framework for reverse engineering and binary analysis. It was created in 2010 by the radareorg project and has grown into one of the most powerful and widely used reverse engineering toolkits in the cybersecurity community. Unlike GUI-heavy tools such as Ghidra or IDA Pro, Radare2 is designed from the ground up as a terminal-native application, which makes it fast, lightweight, scriptable, and perfect for headless servers, SSH sessions, and automated analysis pipelines.

At its core, Radare2 bundles four major capabilities into one toolkit: a multi-architecture disassembler that converts machine code back into human-readable assembly, a built-in debugger for stepping through live program execution, a full-featured hex editor for byte-level inspection and patching, and a scripting engine (r2pipe) that exposes the entire toolkit to Python, Ruby, Node.js, Go, and Lua programs. This combination lets a single tool handle the full reverse engineering workflow without switching applications.

Radare2 supports over 30 processor architectures — including x86, x86-64, ARM, ARM64, MIPS, RISC-V, PowerPC, and SPARC — and every major executable format: ELF (Linux), PE (Windows), Mach-O (macOS and iOS), DEX (Android), Java class files, WebAssembly, and raw firmware blobs. This breadth makes it a go-to tool for malware analysts examining Windows PE files, firmware researchers dissecting embedded device images, and CTF players tackling obscure architecture challenges.

The tool is widely used for CTF competitions, quick binary triage, automated malware analysis, binary patching, exploit development, and embedded system research. Its lightweight design means it starts instantly and runs comfortably on minimal hardware, making it ideal for the Kali Linux environment where resources may be constrained. Whether you are a beginner learning your first disassembly commands or an experienced researcher building automated analysis pipelines, Radare2 provides the depth and flexibility to support your workflow.

Common Commands

r2 -A binaryOpen binary with automatic analysis — the recommended way to start every session
aaaRun full analysis (analyze all) from inside an open r2 session
aflList all functions discovered during analysis
pdf @ mainPrint disassembly of the main function
izList all strings found in data sections of the binary
px 128Print a 128-byte hex dump at the current seek position
axt @ sym.imp.printfList cross-references (callers) of the printf import
VVEnter visual graph mode to navigate the control-flow graph interactively
s 0x00400500Seek (jump) to a specific address in the binary
iiList all imported functions from shared libraries
iEList all exported symbols the binary provides
/ flag.txtSearch the binary for the string 'flag.txt'

Step-by-Step Guide

  1. 1Open the target binary with auto-analysis using 'r2 -A ./program' so Radare2 identifies functions, strings, and cross-references automatically.
  2. 2List all discovered functions with 'afl' to get an overview of the program's structure, then seek to interesting ones with 's sym.main'.
  3. 3Disassemble the main function with 'pdf @ main' to read its assembly instructions and understand the program's entry logic.
  4. 4Extract strings with 'iz' to find hardcoded file paths, URLs, passwords, or flags that reveal what the binary does.
  5. 5Trace cross-references with 'axt' to see which functions call a given import, helping you map data flow through the program.
  6. 6Enter visual mode with 'VV' to navigate the control-flow graph interactively, following branches and loops visually.
  7. 7Debug the binary live with 'r2 -d ./program', set breakpoints with 'db', and step through execution with 'ds' and 'dc'.
  8. 8Save your analysis project with 'P myproject' so you can resume work later without re-analyzing from scratch.

Warnings

Use Cases

Malware Analysis

Inspect suspicious executables statically: list imports, extract strings, map cross-references, and identify malicious behavior without running the binary.

CTF Challenges

Solve reverse engineering CTF problems quickly with fast disassembly, visual graph mode, and multi-architecture support for obscure targets.

Binary Auditing

Audit compiled binaries for vulnerabilities by analyzing function logic, checking input validation, and tracing data flow through cross-references.

Firmware Analysis

Dissect embedded device firmware images, identify bootloader code, and reverse engineer proprietary protocols in raw binary blobs.

Debugging

Debug running processes locally or remotely, set breakpoints, step through execution, and inspect register and memory state in real time.

Reverse Engineering

Understand how compiled programs work by reading assembly, following control flow, and reconstructing program logic from machine code.

Exploit Research

Identify memory corruption vulnerabilities, analyze crash behavior with the debugger, and develop working exploits against vulnerable binaries.

Security Research

Conduct deep security research on protocols, file formats, and proprietary software by combining static and dynamic analysis in one toolkit.

Key Features

Best Practices

Common Errors

Permission denied when opening binary
Run 'chmod +x ./binary' to add execute permissions, or use 'sudo' if the file is in a protected directory. For write-mode patching, open with 'r2 -w binary' and ensure you own the file.
Missing symbols — functions show as fcn.00400500
This is expected for stripped binaries. Use 'aaa' for deep analysis to identify function boundaries, then use 'afn myname @ addr' to rename functions manually as you identify them.
Cannot attach debugger — ptrace permission denied
Run 'echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope' to temporarily allow ptrace, or launch the binary directly in debug mode with 'r2 -d ./binary' instead of attaching to an existing process.
Unsupported binary format
Verify the file type with 'file ./binary'. If it is a raw binary blob, open with 'r2 -a arch -b bits binary' specifying the architecture and bits manually. Update Radare2 to the latest version for broader format support.
Installation fails — build dependencies missing
Install build tools first: 'sudo apt install build-essential git' on Debian/Ubuntu. Then re-run 'sys/install.sh'. Alternatively, install the pre-built package with 'sudo apt install radare2'.
Architecture mismatch — wrong disassembly output
Override the architecture manually with 'r2 -a arm -b 64 binary' for ARM64, or 'r2 -a x86 -b 32 binary' for 32-bit x86. Verify with 'iI' which shows the detected architecture and bits.
afl returns empty — no functions found
Run 'aaa' to perform full analysis. If still empty, the binary may be packed — use the debugger to dump unpacked code from memory, then re-analyze the dumped region.

Related Tools

Ghidra

Reverse Engineering

NSA's free GUI reverse engineering framework with a powerful decompiler and collaborative project support.

GDB

Reverse Engineering

The GNU Project debugger for stepping through program execution and analyzing crashes.

Frida

Dynamic Instrumentation

Dynamic instrumentation toolkit for hooking functions at runtime on live processes.

Binwalk

Forensics

Firmware analysis tool for extracting embedded filesystems and code from firmware images.

strings

Binary Analysis

Extract printable strings from binaries for quick triage and initial inspection.

objdump

Binary Analysis

Disassemble and inspect binary headers from the GNU binutils collection.

Frequently Asked Questions

What is Radare2?

Radare2 is a free, open-source command-line framework for reverse engineering and binary analysis. It combines a disassembler, debugger, hex editor, and scripting engine into a single lightweight toolkit that supports over 30 CPU architectures and every major executable format.

Is Radare2 free?

Yes, Radare2 is completely free and open-source software released under the GNU LGPL license. There are no paid tiers, license keys, or feature restrictions. You can use it for personal, educational, and commercial reverse engineering without any cost.

How does Radare2 work?

Radare2 loads a binary into memory, parses its file format headers (ELF, PE, Mach-O, etc.), identifies code and data sections, then runs an analysis pass that discovers functions, resolves symbols, maps cross-references, and extracts strings. You then interact with this analyzed representation through terminal commands to disassemble, debug, patch, or search the binary.

Who uses Radare2?

Radare2 is used by malware analysts, reverse engineers, CTF players, penetration testers, security researchers, firmware analysts, exploit developers, and cybersecurity students. It is especially popular among professionals who prefer terminal-based workflows and need a fast, scriptable tool for headless environments.

Can beginners learn Radare2?

Yes, beginners can learn Radare2. The learning curve is steeper than GUI tools like Ghidra, but starting with just five core commands — r2 -A, afl, pdf, iz, and VV — gives you enough to begin analyzing simple binaries. Practice on CTF challenges and crackme exercises to build confidence gradually.

Is Radare2 better than Ghidra?

Neither tool is universally better. Radare2 excels at fast CLI-based inspection, scripting, and headless automation. Ghidra excels at GUI-based deep analysis and decompilation. Many reverse engineers use both: Radare2 for quick triage and Ghidra for in-depth decompilation.

Radare2 vs IDA Pro — which should I use?

IDA Pro is a commercial product with a mature decompiler and polished GUI but costs thousands of dollars. Radare2 is free, open-source, and scriptable but has a steeper learning curve and a less mature decompiler. For budget-conscious researchers and students, Radare2 is an excellent starting point.

Radare2 vs Ghidra — what is the difference?

Radare2 is a CLI-first tool that is lightweight, fast, and ideal for quick inspection and scripting. Ghidra is a GUI-first tool from the NSA that provides a powerful decompiler and collaborative project management. Radare2 starts instantly; Ghidra requires Java and takes longer to load. Choose Radare2 for speed and automation, Ghidra for visual decompilation.

Radare2 vs Binary Ninja — how do they compare?

Binary Ninja is a commercial reverse engineering platform with a modern GUI and an intermediate-language-based decompiler. Radare2 is free and CLI-based. Binary Ninja offers a smoother visual experience and better IL analysis; Radare2 offers greater flexibility, no cost, and superior scripting for automation pipelines.

Can Radare2 debug programs?

Yes, Radare2 includes a built-in debugger. Launch it with 'r2 -d ./program', set breakpoints with 'db <addr>', step through instructions with 'ds', continue execution with 'dc', and inspect registers with 'dr'. It supports both local and remote debugging via the r2pipe protocol.

Can Radare2 analyze malware?

Yes, Radare2 is widely used for malware analysis. You can statically inspect suspicious binaries by listing imports, extracting strings, disassembling functions, and mapping cross-references. For dynamic analysis, use the debugger to observe runtime behavior. Always analyze malware in an isolated virtual machine.

How do I install Radare2 on Kali Linux?

On Kali Linux, install Radare2 with 'sudo apt install radare2'. For the latest version, build from source with 'git clone https://github.com/radareorg/radare2 && cd radare2 && sys/install.sh'. Verify the installation with 'r2 -v'.

What file formats does Radare2 support?

Radare2 supports ELF (Linux), PE (Windows), Mach-O (macOS/iOS), DEX (Android), Java class files, WebAssembly, raw firmware blobs, and many more. It automatically detects the format when you open a file.

Does Radare2 have a decompiler?

Radare2 includes a decompiler through the r2dec plugin and the retdec integration, which converts assembly to pseudo-C code. However, the decompiler is less mature than Ghidra's or IDA Pro's Hex-Rays. For heavy decompilation work, many users combine Radare2 with Ghidra.

What is r2pipe?

r2pipe is a scripting interface that lets you control Radare2 from external programs written in Python, Ruby, Node.js, Go, Lua, and other languages. You send r2 commands as strings and receive text or JSON responses, enabling fully automated analysis pipelines.

Can Radare2 patch binaries?

Yes, Radare2 can patch binaries. Use 'wx <hex> @ <addr>' to write hex bytes at a specific address, or 'wa <instruction> @ <addr>' to write an assembly instruction. Save changes with 'wF' or 'r2 -w' (write mode). This is useful for modifying license checks or fixing vulnerabilities.

What is the difference between r2 and rizin?

Rizin is a fork of Radare2 created by part of the original team. It shares the same core architecture but has a reorganized command structure and different development priorities. Radare2 (r2) remains the more widely adopted project with the larger community and ecosystem.

Can Radare2 analyze Android APKs?

Radare2 can analyze DEX files and Java class files inside an APK. First extract the APK with a tool like APKTool, then open the classes.dex file with 'r2 -A classes.dex'. For full APK reverse engineering, combine Radare2 with JADX and APKTool for resource extraction and Java decompilation.

Is Radare2 good for CTF challenges?

Yes, Radare2 is one of the most popular tools for reverse engineering CTF challenges. Its speed, scripting capabilities, and support for obscure architectures make it ideal for time-pressured competitions. The visual graph mode is especially helpful for quickly understanding crackme logic.

Does Radare2 support remote debugging?

Yes, Radare2 supports remote debugging. Start a debug server with 'r2 -a gdbserver://:9090 ./program' on the target machine, then connect from another machine with 'r2 -d gdb://target-ip:9090'. This is useful for debugging embedded devices or analyzing malware on isolated systems.

Tags

#reverse-engineering#binary-analysis#framework#disassembler#debugger#hex-editor#ctf#malware-analysis#cybersecurity#kali-linux

Output Explanation

Radare2 presents an interactive terminal interface. After running 'afl' you see a numbered table of functions with their addresses, sizes, and names — for example '0x00400546  12  main'. The 'pdf' command outputs a vertical block of assembly instructions with address prefixes, opcodes, and operand annotations. Hex dumps ('px') display raw bytes in a classic offset-hex-ASCII layout. Visual mode ('VV') replaces the terminal with an interactive ASCII-art control-flow graph where nodes represent basic blocks and arrows show jump targets. All output is text-based, which makes it easy to copy, grep, or pipe into other tools.

Ethical Usage Notice

This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.