What Is Reverse Engineering? Software, Tools and Law
What reverse engineering is, how it works on software, common tools, legitimate uses like security research and interoperability, and where the law draws lines.
Reverse engineering is the process of taking a finished product apart to understand how it works, without access to its original design. In software, that usually means analysing a compiled program or a protocol to work out what it does, because the source code is not available. People do it to find security flaws, analyse malware, make systems work together, recover lost knowledge and learn.
This guide explains how software reverse engineering works, the main techniques and tools, what it is used for, and where the legal and ethical limits sit. It is educational, not legal advice.
Key takeaways
- Reverse engineering works backwards from a finished product to its design.
- Static analysis examines the code without running it. Dynamic analysis watches it run.
- Core tools are a disassembler, a decompiler and a debugger.
- Legitimate uses include security research, malware analysis, interoperability and recovering legacy systems.
- The law varies by country and by purpose. Contracts, licences and anti-circumvention rules can all apply.
How software reverse engineering works
Programs are normally shipped as compiled machine code, which a CPU can run but a person cannot easily read. Compilers throw away names, comments and structure, so you start with raw instructions and rebuild an understanding of the logic.
The usual workflow:
- Define the goal. What do you want to learn: how a file format works, whether a binary is malicious, how a protocol authenticates?
- Identify the target. File type, architecture (x86-64, ARM), language and any packing or obfuscation.
- Survey it. List strings, imports, exported functions and resources for clues.
- Analyse statically. Disassemble and decompile to read the logic and trace how data flows.
- Analyse dynamically. Run it in a safe environment, set breakpoints, watch memory, files and network traffic.
- Document the findings. Rename functions, note structures and write down the behaviour you confirmed.
Static vs dynamic analysis
| Static analysis | Dynamic analysis | |
|---|---|---|
| What it does | Reads the code without running it | Runs the code and observes it |
| Strength | Safe, covers code paths that rarely run | Shows real behaviour and decrypted data |
| Weakness | Obfuscation and packing make it hard | Risky for malware, may miss unexecuted paths |
| Typical tools | Disassembler, decompiler | Debugger, tracer, network monitor |
Real work mixes both: read statically to form a theory, then confirm it dynamically.
Common tools
| Job | Examples |
|---|---|
| Disassembly and decompilation | Ghidra (released as open source by the NSA in 2019), IDA, Binary Ninja, radare2 and Cutter |
| Debugging | GDB, LLDB, x64dbg, WinDbg |
| Dynamic instrumentation | Frida |
| Managed languages | ILSpy for .NET, jadx for Android and Java bytecode |
| Network and protocols | Wireshark, mitmproxy |
| Binary inspection | strings, objdump, hex editors |
Pick tools by target. A Java or .NET app decompiles back to near-original code, while a native C++ binary yields much rougher output.
What is reverse engineering used for?
- Security research. Finding vulnerabilities in software you did not write, so they can be reported and fixed.
- Malware analysis. Working out what a sample does, how it spreads and how to detect it.
- Interoperability. Making your product work with another system whose protocol or file format is undocumented.
- Legacy recovery. Understanding old software when the source and the original developers are gone.
- Compatibility and bug fixing. Finding why a closed-source library misbehaves.
- Learning. Studying how real programs are built, a common step in capture-the-flag competitions.
Obstacles you will meet
- Obfuscation. Renaming, control-flow tricks and string encryption designed to slow you down.
- Packers and protectors. Code that unpacks itself only at run time.
- Anti-debugging. Checks that detect a debugger and change behaviour.
- Encryption. Traffic or data you cannot read without the key. See symmetric vs asymmetric encryption and encryption vs hashing for the building blocks.
- Missing context. Without symbols or documentation, the original intent is a guess.
Is reverse engineering legal?
It depends on the country, your purpose and what you agree to. There is no single global answer, so treat this as orientation only and ask a lawyer about a specific project.
Points that commonly matter:
- Copyright and licences. Many software licences forbid reverse engineering, and breaching them can be a contract issue even where the law allows the activity.
- Anti-circumvention law. In the US, the DMCA restricts bypassing technical protection measures. Section 1201(f) contains an exception for analysing a program to achieve interoperability with an independently created program, and there are exceptions for some security research, but their scope is narrow and has been contested. The Copyright Office also runs a periodic process that grants temporary exemptions.
- Trade secrets. Independently analysing a product you obtained lawfully is generally treated differently from using secrets obtained improperly, but the details vary.
- Other countries. The EU and others have their own rules on decompiling software for interoperability.
- Authorisation. Testing systems you do not own, such as live servers, can break computer misuse laws regardless of how you analysed the code.
Practical habits that keep you on safer ground: work only on software you own or have permission to analyse, read the licence, keep a record of why you did it, follow responsible disclosure when you find a flaw, and never publish working exploits or circumvention tools without understanding the legal risk.
Reverse engineering beyond software
The same idea applies to hardware (analysing chips and boards), mechanical parts, file formats and network protocols. Protocol work often needs nothing more than watching traffic and documenting what each message does.
How to start learning
- Learn how programs run. Understand memory, the stack and basic assembly for one architecture. See CPU, cache, RAM and SSD speeds for the hardware picture.
- Install a free tool such as Ghidra and open small programs you wrote yourself.
- Do beginner challenges such as crackmes and capture-the-flag exercises, which are legal practice targets.
- Practise on your own builds. Compile a program, strip it, then try to recover its logic.
- Join a community and read published malware and vulnerability write-ups.
Where this meets product work
Teams use these skills when they audit third-party libraries, check what a mobile app sends over the network, or make a new product talk to an undocumented legacy system. If you need a system integrated or reviewed, get a scope estimate. For related legal questions on data collection, read is web scraping legal?.
FAQ
What is reverse engineering in simple terms?
Taking a finished product apart to learn how it works when you do not have the original plans. In software, that means studying a compiled program or protocol instead of reading its source code.
What is the difference between static and dynamic analysis?
Static analysis reads the code without running it. Dynamic analysis runs the program and watches what it does. Most investigations use both.
What tools do reverse engineers use?
Common choices are Ghidra, IDA, Binary Ninja and radare2 for disassembly and decompiling, GDB or x64dbg for debugging, Frida for instrumentation and Wireshark for network traffic.
Is reverse engineering illegal?
Not by default, but it depends on the country, your purpose, the software licence and whether you bypass protection measures. Interoperability and security research often have exceptions, but they are limited. Get legal advice for a specific case.
Can you reverse engineer any program?
Often partly, but not always completely. Obfuscation, encryption and missing information can make full recovery impractical, and decompiled output is rarely identical to the original source.
How do I get started with reverse engineering?
Learn basic assembly and how programs use memory, install Ghidra, practise on your own small programs and legal crackme or capture-the-flag challenges, and read published analyses.