Binary Ninja
Rétro-ingénierie// DESCRIPTION
Modern binary analysis platform with powerful API and intuitive UI.
What is Binary Ninja?
Binary Ninja is a reverse engineering platform built by Vector 35 that combines a disassembler, decompiler, debugger and a very polished Python API. It runs on Windows, Linux and macOS and stands out for one thing that sets it apart from other tools: its family of intermediate languages (BNIL), which translate assembly into increasingly readable representations (LLIL, MLIL and HLIL, plus their SSA forms).
It is a commercial product with several editions, including a free edition with limitations and a cloud version. Terms and prices change over time, so always check the official website before deciding.
What Binary Ninja is used for
- Malware analysis: reading a sample's HLIL pseudocode and documenting its behavior.
- Vulnerability research: automating searches for dangerous patterns (for example,
memcpycalls with user-controlled sizes) using the API and dataflow analysis. - CTFs and crackmes: its fast interface and instant view switching make it very comfortable in competitions.
- Automation: writing plugins and scripts for repetitive tasks, from deobfuscating strings to tagging crypto functions.
Getting started with Binary Ninja
- Download the edition you want from the official website (the free one is fine for learning) or try the cloud version in your browser.
- Open a binary: Binary Ninja detects the format (PE, ELF, Mach-O) and architecture and starts automatic analysis.
- Switch between graph and linear view with the space bar, and pick the IL level (Disassembly, LLIL, MLIL, HLIL) from the selector at the top.
- Rename with
N, change types withYand comment with;. As with any decompiler, output improves with every annotation.
Practical Binary Ninja examples
Built-in Python console
Inside the UI there is a Python console with the loaded binary in the bv variable. For example, to list functions whose names suggest cryptography:
for f in bv.functions:
if "crypt" in f.name.lower():
print(hex(f.start), f.name)
And to print the high-level pseudocode of the current function:
for inst in current_function.hlil.instructions:
print(inst)
Finding references to a dangerous function
for sym in bv.get_symbols_by_name("strcpy"):
for ref in bv.get_code_refs(sym.address):
print(hex(ref.address), ref.function.name)
Headless usage
On editions that include the headless API, you can analyze binaries from a script outside the UI:
import binaryninja
with binaryninja.load("sample.bin") as bv:
print(f"{len(bv.functions)} functions found")
Only use it on your own binaries, lab samples or software you are authorized to analyze.
Pro tips
- Learn to read MLIL: it is the sweet spot between fidelity and readability when HLIL simplifies too much.
- Use the SSA forms to trace where a value comes from (useful to tell whether a size comes from user input).
- Explore the Plugin Manager: the community publishes plugins for signatures, deobfuscation, themes and more.
- Import types from C headers so structures show up by name in the pseudocode.
- Pair it with a debugger (the built-in one or x64dbg) to validate dynamically what you deduce statically.
Binary Ninja pros and cons
| Pros | Cons |
|---|---|
| Modern, fast interface | Full editions are paid |
| Very clean ILs for analysis and automation | The free edition has limitations |
| Excellent, well-documented Python API | Headless mode depends on the license |
| Cross-platform with a built-in debugger | Fewer community tutorials than Ghidra |
Binary Ninja alternatives
- Ghidra: the most complete free and open source option.
- x64dbg: for dynamic debugging on Windows.
- PEiD: to identify packers before opening the binary.
- IDA Pro: the classic commercial standard.
Frequently asked questions
Is Binary Ninja free?
It has a free edition with limitations and a cloud version, plus paid editions for personal and commercial use. Check the official website to see what each one includes and current prices.
Binary Ninja or Ghidra?
Ghidra is free and very powerful. Binary Ninja wins on user experience, speed and API. Many professionals use both depending on the task.
Is Binary Ninja legal?
Yes, reverse engineering for security, interoperability or learning purposes is a legitimate practice. Respect the licenses of the software you analyze and the laws of your country.
How do I use Binary Ninja to learn reversing?
Open simple crackmes, read the HLIL, rename and retype variables, then drop down to MLIL or assembly to understand how each construct is translated.
To practice with guided reverse engineering challenges, visit the Hackers en Acción Academy.