Table of Contents
IronForgeCyber
Courses
Resources
Blog
Log In


IronForgeCyber

AboutPrivacyTerms

© 2026 IronForgeCyber. All rights reserved.

  1. courses
  2. re-static-analysis
  3. intro
9 min read

What Static Analysis Is

Reverse engineering starts with a program and no source code. Someone hands you a compiled binary, and your job is to work out what it does. There are two ways to go about that. You can run the program and watch how it behaves, which is dynamic analysis. Or you can read the program itself, the instructions and data sitting in the file, without ever running it. That is static analysis, and it is what this course teaches.

Reading a binary sounds harder than running one, and at first it is. It is also the only option when a program is unsafe to run, will not run on your machine, or hides the interesting part behind a check you cannot pass yet. The rest of this page works through a small example so you can see both approaches side by side before the course starts in earnest.

A First Example

Here is a small program, chall. We do not have its source. Running it tells us what it wants:

chall
$ ./challPasscode: 1234Access denied.

It asks for a passcode, and our guess was wrong. We could keep guessing, but a passcode is a number, and there are a lot of numbers. Guessing is a poor form of dynamic analysis: we only learn about the one input we tried.

So we stop running it and look at the file instead. The file command reads the start of a file and reports what kind of file it is:

$ file challchall: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=27b45a28545016845636814f21ae13312a189b2d, for GNU/Linux 3.2.0, not stripped

That one line already says a lot. ELF is the format Linux uses for programs. x86-64 is the processor it was built for, which tells us what kind of assembly we will be reading. dynamically linked means it borrows functions like printf from the system's C library instead of carrying its own copy. And not stripped means the names of its functions are still inside, which makes our job much easier. Later lessons deal with binaries that are missing each of those conveniences.

Next, strings prints every run of readable text in the file. Most of it is noise, so we search for the word the program showed us:

$ strings chall | grep AccessAccess granted.Access denied.

Now we know something running the program never showed us: there is an Access granted. message, so a correct passcode exists. What we do not see is the passcode itself. It is a number, and numbers are stored as raw bytes, not as text, so strings cannot find it.

To find it, we read the code. objdump turns the machine code back into assembly, which is called disassembly. We ask for the main function only:

objdump
$ objdump -d -M intel --no-show-raw-insn --disassemble=main chall0000000000400486 <main>:  400486:       push   rbp  400487:       mov    rbp,rsp  40048a:       sub    rsp,0x10  40048e:       mov    DWORD PTR [rbp-0x4],0x0  400495:       mov    edi,0x401210  40049a:       mov    eax,0x0  40049f:       call   400380 <printf@plt>  4004a4:       lea    rax,[rbp-0x4]  4004a8:       mov    rsi,rax  4004ab:       mov    edi,0x40121b  4004b0:       mov    eax,0x0  4004b5:       call   400390 <__isoc99_scanf@plt>  4004ba:       cmp    eax,0x1  4004bd:       je     4004c6 <main+0x40>  4004bf:       mov    eax,0x1  4004c4:       jmp    4004eb <main+0x65>  4004c6:       mov    eax,DWORD PTR [rbp-0x4]  4004c9:       cmp    eax,0x1337  4004ce:       jne    4004dc <main+0x56>  4004d0:       mov    edi,0x40121e  4004d5:       call   400370 <puts@plt>  4004da:       jmp    4004e6 <main+0x60>  4004dc:       mov    edi,0x40122e  4004e1:       call   400370 <puts@plt>  4004e6:       mov    eax,0x0  4004eb:       leave  4004ec:       ret

If you have taken the Assembly course, you can follow this from top to bottom. If not, three lines carry the story. The call to scanf reads our input. A few lines later, cmp eax,0x1337 compares that input against a fixed value. Then jne jumps to one puts call if they differ and falls through to the other if they match. Two messages, one comparison deciding between them: that comparison is the passcode check.

Why __isoc99_scanf?
The source calls plain scanf. The C library swaps in a variant with this longer name when a program is compiled for a modern C standard. It behaves the same way for our purposes. Small surprises like this are normal: a binary records what the compiler produced, not what the programmer typed.

The value is written in hexadecimal. The shell can convert it:

$ printf '%d\n' 0x13374919

We have not run chall since that first wrong guess, and we now know the answer. Running it once more, this time feeding the passcode straight in, only confirms what we read:

chall
$ echo 4919 | ./challPasscode: Access granted.

That is static analysis in miniature. We identified the file, looked at its data, read its code, and came away with a fact about every possible run of the program, not only the ones we tried.

The download on this page holds the same chall, along with its source, so you can repeat each step yourself.

What We Lost

The author of chall wrote this:

source.c
1#include <stdio.h>
2
3int main(void)
4{
5    

Compare it with the disassembly. The variable name code is gone; the binary only knows it as [rbp-0x4], a position on the stack. The if and else are gone too, replaced by a compare and two jumps. Even the number changed its appearance, from 4919 to 0x1337. Nothing was hidden on purpose. Compilers keep what the processor needs and throw the rest away.

Most of this course is about getting that lost meaning back. A decompiler helps: it reads the assembly and writes out C that would compile to something similar. The three you will hear about most are:

  • Ghidra, free and open source, and the one this course uses
  • IDA, the long-time commercial standard, with a free edition
  • Binary Ninja, a newer commercial tool, also with a free edition

A decompiler's output is a best guess, not the original source. It will give you local_c where the author wrote code, and it will sometimes get types or loops wrong. Learning to read that output, correct it, and know when not to trust it is the skill this course teaches.

Static and Dynamic Analysis

Neither approach replaces the other. They answer different questions:

Static analysisDynamic analysis
The program isread, never runrun and observed
It answerswhat could this program do?what is it doing right now?
It coversevery path through the codeonly the paths you trigger
It struggles whenthe code is large, packed or obfuscatedthe program will not run or detects you
Typical toolsfile, strings, objdump, Ghidragdb, strace, ltrace

In practice you move between the two. Static analysis tells you where to look, and a debugger confirms what a confusing piece of code really does. This course stays on the static side so that the habit of reading comes first. A sibling course on dynamic analysis picks up from the other direction.

It also helps to know where this course sits next to the rest of the site:

  • The GDB and Radare2 guides explain how to drive those tools. This course links to them instead of repeating them.
  • Binary Exploitation is about making a program do what you want. Reverse engineering comes first: you have to understand a program before you can break it.

This Is Hard

This example took four commands because the program was under twenty lines long, compiled without optimization, and kept its function names. Real targets are thousands of functions, optimized until the assembly no longer resembles the source, and often stripped of every name.

Nobody reads a binary like that from start to finish. The work is closer to exploring a city without a map: find a landmark, such as a string or a library call, work outward from it, name things as you understand them, and accept that most of the program will stay unread. Progress is slow, and being stuck is the normal state. That is true for experienced reverse engineers too, so do not take it as a sign that you are doing it wrong.

Before You Start

You will get the most from this course if you can already:

  • read and write basic C, at the level of the C Programming course
  • follow simple x86-64 assembly: registers, mov, cmp, jumps and call, as covered in Assembly 101
  • move around a Linux terminal

The commands on this page come from binutils, which is installed on most Linux systems already. Orienting Ghidra covers installing the decompiler.

Where the Course Goes

  • Foundations: what compiling throws away, and how to set up your tools.
  • Reading Decompilation: control flow, data and types, functions, and the strings and constants that act as landmarks.
  • Harder Targets: stripped and statically-linked binaries, obfuscated checks, languages other than C, and programs that fight back.
  • Challenges: four crackmes, programs like this one that get steadily less cooperative.

Next up is The Compile Pipeline in Reverse, which follows a C program through the compiler to see what survives the trip.

int
code
=
0
;
6
7 printf("Passcode: ");
8 if (scanf("%d", &code) != 1)
9 return 1;
10
11 if (code == 4919)
12 puts("Access granted.");
13 else
14 puts("Access denied.");
15
16 return 0;
17}