Table of Contents
IronForgeCyber
Courses
Resources
Blog
Log In


IronForgeCyber

AboutPrivacyTerms

© 2026 IronForgeCyber. All rights reserved.

  1. courses
  2. re-static-analysis
  3. crackme-01
6 min read

Crackme 1: Serial Key

A crackme is a small program written to be reverse engineered. It asks for something, a password or a key, and your job is to work out what it will accept by reading the binary. These four use what the course has covered, and each one takes away a convenience the one before it had.

This first one is the friendliest. The binary has its symbols, it was built without optimization, and it wants a serial number:

chall
$ echo AAAA | ./challSerial: Invalid serial.

There is no single right answer. Many serials are valid, and the goal is to produce one.

Try it yourself first
The solution is below. You will get far more from this if you open the binary in Ghidra and work at it before reading on, even if you only get partway.

Stuck? Open one hint at a time.

Hint 1
main checks several things in a row, joined with &&. Find out how many, and treat each as its own small puzzle.
Hint 2
Two of the checks are in main itself: a length, and one specific character at one specific position.
Hint 3
The three helper functions each look at a different part of the serial. Work out which positions each one reads.
Hint 4
letters_ok multiplies each letter's position in the alphabet by a weight and takes the total modulo 26. You only need one letter to be non-zero to hit the target.

Solution

Finding the Rules

main reads a line, trims it, and then makes one decision:

Ghidra
1  sVar3 = strlen(local_28);
2  if ((((sVar3 == 0xc) && (local_22 ==

Five conditions, all of which must hold. The first two are right here:

  • sVar3 == 0xc: the serial is 12 characters long.
  • local_22 == '-': one character is a dash. Ghidra has split the buffer in two, local_28 and local_22, as we saw it do in Data & Types. The names are stack offsets, and 0x28 - 0x22 is 6, so local_22 is the character at position 6.

The other three are function calls, and each receives the whole serial.

has_prefix

Ghidra
1undefined8 has_prefix(char *param_1)
2{
3  undefined8 uVar1;
4
5  if (

Positions 0 and 1 are I and F.

digits_ok

Ghidra
1bool digits_ok(long param_1)
2{
3  int local_10;
4  int local_c;

This is the digit-summing loop from Stripped Binaries. The index runs from 2 to 5, each character must be between '0' and '9', and subtracting 0x30 turns it into a number. At the end the total must equal 0x15. So positions 2 to 5 are four digits that add up to 21.

letters_ok

Ghidra
1bool letters_ok(long param_1)
2{
3  char cVar1;
4  int local_10;

The index goes from 0 to 4, and the character read is at local_10 + 7, so this covers positions 7 to 11. Each must be an uppercase letter. cVar1 + -0x41 subtracts the code for 'A', giving the letter's place in the alphabet starting from 0. That is multiplied by local_10 + 1, a weight from 1 to 5, and added to a total. At the end, the total modulo 0x1a, which is 26, must be 7.

Building a Serial

Put the rules side by side:

PositionsRule
0 to 1IF
2 to 5Four digits that add up to 21
6-
7 to 11Five uppercase letters whose weighted total is 7 modulo 26

The digits are easy: 9930 adds up to 21.

For the letters, use the fact that A counts as zero. A serial ending AAAAA has a total of 0. The first letter has a weight of 1, so changing only that one to the letter worth 7 makes the total 7. Counting from A as 0, the letter worth 7 is H. So HAAAA works.

chall
$ echo IF9930-HAAAA | ./challSerial: Registered. Thank you!

Other serials work as well. IF6690-REVER is one. If you want more practice, write a short script that generates valid serials at random. That program is called a keygen, and writing one proves you understood every rule.

Next is Crackme 2, where the names are gone and the answer is in a table.

'-'
)
)
&&
(
iVar1
=
has_prefix
(
local_28
)
,
iVar1
!=
0
)
)
&&
3 ((iVar1 = digits_ok(local_28), iVar1 != 0 && (iVar1 = letters_ok(local_28), iVar1 != 0)))) {
4 puts("Registered. Thank you!");
5 }
6 else {
7 puts("Invalid serial.");
8 }
(
*
param_1
==
'I'
)
&&
(
param_1
[
1
]
==
'F'
)
)
{
6 uVar1 = 1;
7 }
8 else {
9 uVar1 = 0;
10 }
11 return uVar1;
12}
5
6 local_c = 0;
7 local_10 = 2;
8 while( true ) {
9 if (5 < local_10) {
10 return local_c == 0x15;
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 false;
17}
5 int local_c;
6
7 local_c = 0;
8 local_10 = 0;
9 while( true ) {
10 if (4 < local_10) {
11 return local_c % 0x1a == 7;
12 }
13 cVar1 = *(char *)(param_1 + (local_10 + 7));
14 if ((cVar1 < 'A') || ('Z' < cVar1)) break;
15 local_c = local_c + (local_10 + 1) * (cVar1 + -0x41);
16 local_10 = local_10 + 1;
17 }
18 return false;
19}