What you'll need before launching Ghidra
Ghidra is a free static software analysis framework from the NSA, open-sourced in 2019. Its main advantage over IDA Free is its built-in decompiler, which converts machine code into C-like pseudocode without a license or additional modules. Binary code reading skills aren't just required for CTFs—malware analysis, vulnerability scanning in proprietary software, and IoT device firmware hacking all start with the same tools. For more details, see our review of creating CTF tasks .
To work you need three things:
JDK 21+ — Ghidra 11.x runs on Java. Linux: sudo apt install openjdk-21-jdk. Windows: installer with adoptium.net. Verification: java -versionThe terminal should show version 21 or higher.
Ghidra 11.x — the latest version can be downloaded from ghidra-sre.org or GitHub. No installation required: unzip the ZIP archive (~300 MB), run via ghidraRunon Linux/macOS or ghidraRun.baton Windows.
RAM : Minimum 4 GB, comfortable 8 GB. Ghidra on the JVM uses a noticeable amount of memory during automated analysis—4 GB will be tight for large binaries.
A virtual machine for entry-level CTF tasks is a good idea, but it's a good habit. VirtualBox or VMware Workstation Player are free, and disable networking within the VM. Running an unfamiliar binary on the host OS is a surefire way to reinstall the system.
Pre-Disassembler Reconnaissance: File, Strings, and Ltrace
Every CTF task in the reverse category should be analyzed not with Ghidra, but with the terminal. Three commands can sometimes solve the problem in seconds—without even running the disassembler.
file crackme— will show the format (ELF, PE, Mach-O), architecture (x86-64, ARM, MIPS), link type and the presence of symbols. Output strippedmeans that the function mainwon't show up in Ghidra by name—you'll have to search for it manually (we'll discuss this below). Conclusion statically linked— the binary drags library functions inside itself, the list of symbols will be noticeably longer than usual.
strings crackme— all readable text lines from the file. Messages "Wrong password", "Correct!", file paths—these are all hints for what functions to look for in Ghidra. On Easy-level tasks, a surprising number of crackmes are closed with this single command: sometimes the flag is in plaintext. See the format string? flag{...}— check immediately before opening anything else. Based on my experience solving problems on picoCTF and crackmes.one, this works more often than I'd like to admit.
ltrace ./crackme— intercepts calls to library functions at startup. If the binary compares input through strcmp, ltrace will show both arguments: strcmp("ваш_ввод", "настоящий_пароль"). The password is on the screen. Note: ltrace only works with dynamically linked binaries—it intercepts calls through PLT. For statically linked ones ( filewill show statically linked) ltrace won't catch anything. Then try strace ./crackme— intercepts system calls, useful if the program reads data from a file. Another pitfall: the compiler sometimes inlines strcmp, and ltrace won't see it.
Three checks take seconds. In CTF blitzes, the difference between first and tenth place is often measured precisely by whether a participant started with stringsor immediately went into the Ghidra disassembler.
Importing the binary into Ghidra and running automatic analysis
Launch Ghidra. The project manager will appear when you first launch it. Close the "Tip of the Day" pop-up—there's nothing useful there.
Create a project. File → New Project → Non-Shared Project → specify the directory and name. One task per project. Variable renaming, comments, and annotations are preserved between sessions. You can come back a week later and see exactly the context you've developed—unlike a one-time analysis in the terminal.
Import a file. File → Import File → select the binary or drag it directly into the project window. Ghidra will automatically detect the format, architecture, bit depth, and the intended compiler. For standard ELF and PE formats, you don't need to change the import settings—click OK.
Autoanalysis. Double-clicking a file in the project will open the Code Browser, the main working window. Ghidra will ask "Analyze now?"—accept the default settings. Autoanalysis will detect function boundaries, build cross-references (xrefs), extract text strings, and identify library calls. For small CTF binaries, the process takes seconds; for larger files, up to a couple of minutes.
For Windows PE files, check the external function parameter propagation options in the analysis window. Ghidra will insert imported Windows API parameters directly into the decompiled code, making pseudocode much easier to read.
After the automated analysis, you'll see an interface with a dozen panels. You only need four to solve CTF problems. Close the rest—they're just a nuisance at the start.
Four Code Browser windows for analyzing binaries
Symbol Tree and Listing - Assembly Code and Navigation
Symbol Tree — the left panel. A tree of all program symbols: functions, imports, exports, and labels. Expand the Functions branch — you'll find it here. mainDouble-clicking will move Listing and Decompiler to the selected function.
Expand Imports - this is a snapshot of what the binary can do. WriteProcessMemory or VirtualAlloc— the code can modify itself at runtime. socket, connect— network activity. At entry-level CTFs, imports are usually minimal ( stdio, string), but the habit of checking is formed here. In real-world malware analysis, looking at imports is the first thing an analyst does.
Listing is the central panel. Disassembled code: addresses on the left, mnemonics on the right ( MOV, CMP, JNE, CALL). Double-click on the address CALLtransfers inside the called function, Alt+←Returns back. Right-click → Patch Instruction allows you to change instructions directly in the listing—a technique for patching conditional jumps in CTFs.
Decompiler - Reading Ghidra pseudocode
The right panel displays C-like pseudocode from the built-in binary decompiler. This is the main tool when analyzing binaries, especially at the start.
Keyword: highlighting a line in the decompiler highlights the corresponding assembly code in Listing—and vice versa. See? if (iVar1 == 0)on the right - look CMP And JNZon the left. This synchronization is invaluable for learning. After a dozen such comparisons, the assembler no longer seems like a random set of symbols. The connection between ifin the decompiler and a couple CMP+ the conditional jump in the listing becomes tangible - that's the very moment when the fundamentals of reverse engineering start to "click".
The decompiler is not perfect: variables are named iVar1, uVar2, types are defined with errors. But for beginners, this is much better than wading through dozens of assembly instructions without context.
Defined Strings - the shortest path to the target function
Window → Defined Strings. All text strings in the binary are listed together. Double-clicking takes you to the string in the Listing. Right-clicking → References → Show References to Address shows all the places where the string is used. A cross-reference (xref) will lead to the function where the password or flag is checked.
At the entry-level CTF, Defined Strings solves the problem regularly. Find the string "Correct!" or "Wrong", navigate to xref, and you're inside the target function. The "string → xref → function" pattern works for the vast majority of Easy tasks.
Pressing F1 while hovering over any interface element brings up contextual help—use it while you're getting the hang of it. According to the Introduction to Reverse Engineering with Ghidra course on Hackaday.io, this is one of the most underrated navigation tricks in Ghidra for beginners.
From iVar1 to Clear Code: Renaming and Typing
The decompiler produces working pseudocode, but reading it in its raw form is torture. iVar1may be the result strcmp, param_1— a pointer to user input, local_28— a password buffer. Until variables are renamed, the logic is hidden behind automatic names.
Two tricks that dramatically speed up reading pseudocode in Ghidra:
Renaming variables. Right-click the variable in the Decompiler window → Rename Variable. Give it a meaningful name: iVar1 → strcmp_result, local_28 → user_input, param_1 → argcGhidra automatically synchronizes names between the decompiler and the listing. After renaming three or four key variables, the pseudocode reads like regular C.
Correcting function signatures. Right-click on the function name → Edit Function Signature. If Ghidra made a mistake with the parameter types (determined intinstead of char *), correct it manually—the decompiled code will instantly become clearer. It's especially helpful when, instead of working with strings, Ghidra shows you the arithmetic long.
Example: After auto-analyzing a simple crack, Ghidra decompiler shows:
undefined8 main(void) {
int iVar1;
char local_28 [28];
puts("Enter password:");
fgets(local_28, 0x1c, stdin);
iVar1 = strcmp(local_28, "s3cr3t_fl4g");
if (iVar1 == 0) {
puts("Correct!");
}
else {
puts("Wrong!");
}
return 0;
}
Even without renaming it is visible: strcmpcompares the input ( local_28) with a reference line "s3cr3t_fl4g"The flag was found. But in real CTF problems, the password is rarely in cleartext—it's usually encrypted or pieced together. Renaming variables helps restore logic when the code is more complex than one. strcmpThe code from the decompiler window is copied directly—convenient for CTF writeups.
Ghidra is a free static software analysis framework from the NSA, open-sourced in 2019. Its main advantage over IDA Free is its built-in decompiler, which converts machine code into C-like pseudocode without a license or additional modules. Binary code reading skills aren't just required for CTFs—malware analysis, vulnerability scanning in proprietary software, and IoT device firmware hacking all start with the same tools. For more details, see our review of creating CTF tasks .
To work you need three things:
JDK 21+ — Ghidra 11.x runs on Java. Linux: sudo apt install openjdk-21-jdk. Windows: installer with adoptium.net. Verification: java -versionThe terminal should show version 21 or higher.
Ghidra 11.x — the latest version can be downloaded from ghidra-sre.org or GitHub. No installation required: unzip the ZIP archive (~300 MB), run via ghidraRunon Linux/macOS or ghidraRun.baton Windows.
RAM : Minimum 4 GB, comfortable 8 GB. Ghidra on the JVM uses a noticeable amount of memory during automated analysis—4 GB will be tight for large binaries.
A virtual machine for entry-level CTF tasks is a good idea, but it's a good habit. VirtualBox or VMware Workstation Player are free, and disable networking within the VM. Running an unfamiliar binary on the host OS is a surefire way to reinstall the system.
Pre-Disassembler Reconnaissance: File, Strings, and Ltrace
Every CTF task in the reverse category should be analyzed not with Ghidra, but with the terminal. Three commands can sometimes solve the problem in seconds—without even running the disassembler.
file crackme— will show the format (ELF, PE, Mach-O), architecture (x86-64, ARM, MIPS), link type and the presence of symbols. Output strippedmeans that the function mainwon't show up in Ghidra by name—you'll have to search for it manually (we'll discuss this below). Conclusion statically linked— the binary drags library functions inside itself, the list of symbols will be noticeably longer than usual.
strings crackme— all readable text lines from the file. Messages "Wrong password", "Correct!", file paths—these are all hints for what functions to look for in Ghidra. On Easy-level tasks, a surprising number of crackmes are closed with this single command: sometimes the flag is in plaintext. See the format string? flag{...}— check immediately before opening anything else. Based on my experience solving problems on picoCTF and crackmes.one, this works more often than I'd like to admit.
ltrace ./crackme— intercepts calls to library functions at startup. If the binary compares input through strcmp, ltrace will show both arguments: strcmp("ваш_ввод", "настоящий_пароль"). The password is on the screen. Note: ltrace only works with dynamically linked binaries—it intercepts calls through PLT. For statically linked ones ( filewill show statically linked) ltrace won't catch anything. Then try strace ./crackme— intercepts system calls, useful if the program reads data from a file. Another pitfall: the compiler sometimes inlines strcmp, and ltrace won't see it.
Three checks take seconds. In CTF blitzes, the difference between first and tenth place is often measured precisely by whether a participant started with stringsor immediately went into the Ghidra disassembler.
Importing the binary into Ghidra and running automatic analysis
Launch Ghidra. The project manager will appear when you first launch it. Close the "Tip of the Day" pop-up—there's nothing useful there.
Create a project. File → New Project → Non-Shared Project → specify the directory and name. One task per project. Variable renaming, comments, and annotations are preserved between sessions. You can come back a week later and see exactly the context you've developed—unlike a one-time analysis in the terminal.
Import a file. File → Import File → select the binary or drag it directly into the project window. Ghidra will automatically detect the format, architecture, bit depth, and the intended compiler. For standard ELF and PE formats, you don't need to change the import settings—click OK.
Autoanalysis. Double-clicking a file in the project will open the Code Browser, the main working window. Ghidra will ask "Analyze now?"—accept the default settings. Autoanalysis will detect function boundaries, build cross-references (xrefs), extract text strings, and identify library calls. For small CTF binaries, the process takes seconds; for larger files, up to a couple of minutes.
For Windows PE files, check the external function parameter propagation options in the analysis window. Ghidra will insert imported Windows API parameters directly into the decompiled code, making pseudocode much easier to read.
After the automated analysis, you'll see an interface with a dozen panels. You only need four to solve CTF problems. Close the rest—they're just a nuisance at the start.
Four Code Browser windows for analyzing binaries
Symbol Tree and Listing - Assembly Code and Navigation
Symbol Tree — the left panel. A tree of all program symbols: functions, imports, exports, and labels. Expand the Functions branch — you'll find it here. mainDouble-clicking will move Listing and Decompiler to the selected function.
Expand Imports - this is a snapshot of what the binary can do. WriteProcessMemory or VirtualAlloc— the code can modify itself at runtime. socket, connect— network activity. At entry-level CTFs, imports are usually minimal ( stdio, string), but the habit of checking is formed here. In real-world malware analysis, looking at imports is the first thing an analyst does.
Listing is the central panel. Disassembled code: addresses on the left, mnemonics on the right ( MOV, CMP, JNE, CALL). Double-click on the address CALLtransfers inside the called function, Alt+←Returns back. Right-click → Patch Instruction allows you to change instructions directly in the listing—a technique for patching conditional jumps in CTFs.
Decompiler - Reading Ghidra pseudocode
The right panel displays C-like pseudocode from the built-in binary decompiler. This is the main tool when analyzing binaries, especially at the start.
Keyword: highlighting a line in the decompiler highlights the corresponding assembly code in Listing—and vice versa. See? if (iVar1 == 0)on the right - look CMP And JNZon the left. This synchronization is invaluable for learning. After a dozen such comparisons, the assembler no longer seems like a random set of symbols. The connection between ifin the decompiler and a couple CMP+ the conditional jump in the listing becomes tangible - that's the very moment when the fundamentals of reverse engineering start to "click".
The decompiler is not perfect: variables are named iVar1, uVar2, types are defined with errors. But for beginners, this is much better than wading through dozens of assembly instructions without context.
Defined Strings - the shortest path to the target function
Window → Defined Strings. All text strings in the binary are listed together. Double-clicking takes you to the string in the Listing. Right-clicking → References → Show References to Address shows all the places where the string is used. A cross-reference (xref) will lead to the function where the password or flag is checked.
At the entry-level CTF, Defined Strings solves the problem regularly. Find the string "Correct!" or "Wrong", navigate to xref, and you're inside the target function. The "string → xref → function" pattern works for the vast majority of Easy tasks.
Pressing F1 while hovering over any interface element brings up contextual help—use it while you're getting the hang of it. According to the Introduction to Reverse Engineering with Ghidra course on Hackaday.io, this is one of the most underrated navigation tricks in Ghidra for beginners.
From iVar1 to Clear Code: Renaming and Typing
The decompiler produces working pseudocode, but reading it in its raw form is torture. iVar1may be the result strcmp, param_1— a pointer to user input, local_28— a password buffer. Until variables are renamed, the logic is hidden behind automatic names.
Two tricks that dramatically speed up reading pseudocode in Ghidra:
Renaming variables. Right-click the variable in the Decompiler window → Rename Variable. Give it a meaningful name: iVar1 → strcmp_result, local_28 → user_input, param_1 → argcGhidra automatically synchronizes names between the decompiler and the listing. After renaming three or four key variables, the pseudocode reads like regular C.
Correcting function signatures. Right-click on the function name → Edit Function Signature. If Ghidra made a mistake with the parameter types (determined intinstead of char *), correct it manually—the decompiled code will instantly become clearer. It's especially helpful when, instead of working with strings, Ghidra shows you the arithmetic long.
Example: After auto-analyzing a simple crack, Ghidra decompiler shows:
undefined8 main(void) {
int iVar1;
char local_28 [28];
puts("Enter password:");
fgets(local_28, 0x1c, stdin);
iVar1 = strcmp(local_28, "s3cr3t_fl4g");
if (iVar1 == 0) {
puts("Correct!");
}
else {
puts("Wrong!");
}
return 0;
}
Even without renaming it is visible: strcmpcompares the input ( local_28) with a reference line "s3cr3t_fl4g"The flag was found. But in real CTF problems, the password is rarely in cleartext—it's usually encrypted or pieced together. Renaming variables helps restore logic when the code is more complex than one. strcmpThe code from the decompiler window is copied directly—convenient for CTF writeups.