Table of Contents
IronForgeCyber
Courses
Resources
Blog
Log In


IronForgeCyber

AboutPrivacyTerms

© 2026 IronForgeCyber. All rights reserved.

  1. courses
  2. re-static-analysis
  3. stripped
15 min read

Stripped Binaries

Every binary in this course so far has kept its symbol table. Ghidra showed us main, scramble and check by name, and the names did a lot of the work. Software that ships rarely leaves them in. Stripping is one command at the end of a build, it makes the file smaller, and it tells a reverse engineer less.

A stripped binary is the normal case. This lesson takes one and rebuilds its structure by hand, a function at a time, until it reads as well as the unstripped programs did. Nothing here is a new technique. It is the earlier lessons applied in order, without the names to lean on.

The Program

This lesson's chall wants a license key:

chall
$ echo 1234-5678 | ./chall== KeyCheck 2.1 ==Enter your license key.> Invalid key.

The download holds the stripped chall and, for checking your work afterwards, its source.

What Stripping Removes

file reports the difference in its last word:

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

And the symbol table is empty:

nm
$ nm challnm: chall: no symbols$ nm -D chall                 U fgets@GLIBC_2.2.5                 w __gmon_start__                 U __libc_start_main@GLIBC_2.34                 U printf@GLIBC_2.2.5                 U puts@GLIBC_2.2.50000000000403030 B stdin@GLIBC_2.2.5                 U strcspn@GLIBC_2.2.5                 U strlen@GLIBC_2.2.5

As the pipeline lesson showed, strip deletes the symbol table, which is only there for people and debuggers, and leaves the dynamic symbols alone, because the program cannot start without them. So here is what we have lost and what we still have:

Removed by stripStill there
Names of the program's own functionsNames of imported library functions
Names of its global variablesEvery string
Debug information, if there was anyEvery instruction and every constant
The entry point

The code is untouched. Not one instruction differs between a binary and its stripped copy. Stripping only removes labels, so everything we learned about reading code still applies. What we need is a way to put labels back.

A List of Nothing

Import chall into Ghidra and open Functions in the Symbol Tree. Apart from a few startup functions that Ghidra recognizes, the list reads:

FUN_004004a6
FUN_004004c1
FUN_00400516
FUN_0040058a
FUN_004005e0
FUN_00400651

Ghidra found where each function starts and ends. That part of analysis does not need names. It named each one after its address, and one of the six is main.

We know how to find it from Functions & Calls: go to entry, and take the first argument of its call to __libc_start_main. Here that is FUN_00400651. Rename it main with L. That is our first label, and it is certain.

Ghidra
1undefined8 FUN_00400651(void)
2{
3  int iVar1;
4  undefined8 uVar2;
5

The structure is readable already, because the library calls and strings are all still here. Something is called, a prompt is printed, something fills a 32-byte buffer, and something else decides between Invalid key. and License accepted.. Three unknown functions are called, and the third is the one that matters. We name them in order of how easy they are.

Naming From Strings

Ghidra
1void FUN_004004a6(void)
2{
3  puts("== KeyCheck 2.1 ==");
4  puts("Enter your license key."

This one prints two lines and does nothing else. Call it banner.

That took a few seconds, and it is worth doing even for a function this dull. Every function you name is one you never have to open again, and its name now appears wherever it is called. In a large binary, most of the early progress comes from clearing away functions like this one.

Naming From Calls

Ghidra
1bool FUN_004004c1(char *param_1,int param_2)
2{
3  char *pcVar1;
4

There are no helpful strings here, but there are two library calls, and library functions are documented. fgets reads a line of input into a buffer. strcspn with "\n" finds the position of the first newline, and the next line overwrites that position with a zero byte, which cuts the newline off. The function reads a line and trims it. Call it read_line, and while you are there, press F and name its parameters buf and size. Notice that Ghidra already typed param_1 as char *: it knows the signature of fgets, so it knows what kind of thing gets passed to it. Library calls give you types as well as meaning.

This is the general method for a stripped binary: work outward from the imports. The imports are the only names you have, and each one says something about every function that calls it. Ghidra can list the callers of any function. Click an import and press Ctrl+Shift+F, or use the Function Call Trees window. For this program the result is:

ImportCalled fromSuggests
putsFUN_004004a6, FUN_00400651Prints fixed messages
printfFUN_00400651Prints the prompt
fgets, strcspnFUN_004004c1Reads and cleans up input
strlenFUN_004005e0Cares how long a string is

In a big program, this table is how you choose where to start. Functions that call socket and recv handle the network. Functions that call fopen handle files. A function that calls strcmp or memcmp is comparing something, and in a license check that is the place to look first.

Naming From Behavior

The table leaves two functions out, FUN_00400516 and FUN_0040058a. They call nothing and mention no strings. These have to be read.

Ghidra
1int FUN_00400516(long param_1,int param_2)
2{
3  int local_10;
4

Take it a piece at a time, using the last three lessons:

  • *(char *)(param_1 + local_10) reads one byte at an offset that goes up by one each time round. param_1 is a pointer to characters, and local_10 is an index into them. It is a string, or at least a buffer of text.
  • The loop runs while local_10 is less than param_2, so param_2 is a count.
  • Each character is tested against '0' and '9'. If it is outside that range, the function gives up and returns -1.
  • Otherwise the character has 0x30 subtracted and is added to local_c. 0x30 is the character code of '0', so subtracting it turns the character '7' into the number 7. This is the standard way to convert a digit.

So the function adds up the first param_2 digits of a string, and fails if any of them is not a digit. Call it digit_sum.

Ghidra
1undefined8 FUN_0040058a(long param_1,long param_2)
2{
3  int local_c;
4
5

Two character pointers this time, and a loop over four positions. It compares character local_c of the first with character 3 - local_c of the second: position 0 against 3, 1 against 2, and so on. It returns 1 if all four pairs match. So it checks that one four-character piece is the other one backwards. Call it mirrored.

A name does not have to be what the author chose. It has to be accurate, and it has to mean something to you next week. If you are unsure of a function, give it a name that says so, such as maybe_parse_header. A hedged name is far more useful than FUN_00400516, and you can correct it later.

The Payoff

With the helpers named and their parameters typed, the check function and main look like this:

Ghidra
1int check_key(char *key)
2{
3  int iVar1;

This is as readable as anything from the unstripped lessons, and every name in it came from us. The rules for a valid key can be read straight off check_key:

  1. It is 9 characters long.
  2. Character 4 is a dash.
  3. The first four characters are digits that add up to 0x14, which is 20.
  4. The last four characters, starting at position 5, are the first four reversed.

2990 adds up to 20, and reversed it is 0992:

chall
$ echo 2990-0992 | ./chall== KeyCheck 2.1 ==Enter your license key.> License accepted.

Notice the order we worked in. We did not start with the check function, even though it was the goal. We named the functions it depends on first, starting with the easiest, and by the time we reached the check it had nothing unknown left in it. Working from the bottom of the call tree upward is usually faster than going straight at the hard part.

Keeping Notes

On a real target this process takes hours or days, across many sittings, and what you worked out on Monday has to still be there on Thursday. Ghidra is the notebook.

  • Rename as you go. Do not wait until you are sure. Every L is a note that shows up everywhere the function or variable is used.
  • Fix signatures with F once you know a function's parameters. The types carry into every caller.
  • Comment with ; for anything a name cannot hold: "returns -1 on a non-digit", "checked against 20".
  • Bookmark with Ctrl+D to mark places you want to come back to, and find them again under Window > Bookmarks.
  • Save. Names, types, comments and bookmarks all live in the Ghidra project, and they are there when you open it again.

Agree with yourself on a few conventions. A common one is a prefix for confidence, such as maybe_ for guesses, so that you can tell at a glance which names are solid.

Summary

  • Stripping removes the names of the program's own functions and variables. It leaves the code, the strings, the imports and the entry point.
  • Find main from the entry point's call to __libc_start_main.
  • Name functions from the evidence that survives: the strings they use, the library functions they call, and, when there is neither, what the code does.
  • Work outward from imports, and upward from the bottom of the call tree, so that the hard functions are made of things you have already named.
  • Keep your progress in the tool as names, signatures, comments and bookmarks.

Stripping still left us the imports. The next lesson, Statically-Linked Binaries, takes those away too.

undefined1 local_28
[
32
]
;
6
7 FUN_004004a6();
8 printf("> ");
9 iVar1 = FUN_004004c1(local_28,0x20);
10 if (iVar1 == 0) {
11 uVar2 = 1;
12 }
13 else {
14 iVar1 = FUN_004005e0(local_28);
15 if (iVar1 == 0) {
16 puts("Invalid key.");
17 }
18 else {
19 puts("License accepted.");
20 }
21 uVar2 = 0;
22 }
23 return uVar2;
24}
)
;
5 return;
6}
size_t
sVar2
;
5
6 pcVar1 = fgets(param_1,param_2,stdin);
7 if (pcVar1 != (char *)0x0) {
8 sVar2 = strcspn(param_1,"\n");
9 param_1[sVar2] = '\0';
10 }
11 return pcVar1 != (char *)0x0;
12}
int
local_c
;
5
6 local_c = 0;
7 local_10 = 0;
8 while( true ) {
9 if (param_2 <= local_10) {
10 return local_c;
11 }
12 if ((*(char *)(param_1 + local_10) < '0') || ('9' < *(char *)(param_1 + local_10))) break;
13 local_c = local_c + *(char *)(param_1 + local_10) + -0x30;
14 local_10 = local_10 + 1;
15 }
16 return -1;
17}
local_c
=
0
;
6 while( true ) {
7 if (3 < local_c) {
8 return 1;
9 }
10 if (*(char *)(param_1 + local_c) != *(char *)(param_2 + (3 - local_c))) break;
11 local_c = local_c + 1;
12 }
13 return 0;
14}
4
size_t
sVar2
;
5
6 sVar2 = strlen(key);
7 if (sVar2 == 9) {
8 if (key[4] == '-') {
9 iVar1 = digit_sum(key,4);
10 if (iVar1 == 0x14) {
11 iVar1 = mirrored(key,key + 5);
12 }
13 else {
14 iVar1 = 0;
15 }
16 }
17 else {
18 iVar1 = 0;
19 }
20 }
21 else {
22 iVar1 = 0;
23 }
24 return iVar1;
25}
26
27int main(void)
28{
29 int iVar1;
30 char local_28 [32];
31
32 banner();
33 printf("> ");
34 iVar1 = read_line(local_28,0x20);
35 if (iVar1 == 0) {
36 iVar1 = 1;
37 }
38 else {
39 iVar1 = check_key(local_28);
40 if (iVar1 == 0) {
41 puts("Invalid key.");
42 }
43 else {
44 puts("License accepted.");
45 }
46 iVar1 = 0;
47 }
48 return iVar1;
49}