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:
echo AAAA | ./challSerial: Invalid serial.There is no single right answer. Many serials are valid, and the goal is to produce one.
Stuck? Open one hint at a time.
main checks several things in a row, joined with &&. Find out how many, and treat each as its own small puzzle.main itself: a length, and one specific character at one specific position.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.main reads a line, trims it, and then makes one decision:
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_prefix1undefined8 has_prefix(char *param_1)
2{
3 undefined8 uVar1;
4
5 if (Positions 0 and 1 are I and F.
digits_ok1bool 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_ok1bool 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.
Put the rules side by side:
| Positions | Rule |
|---|---|
| 0 to 1 | IF |
| 2 to 5 | Four digits that add up to 21 |
| 6 | - |
| 7 to 11 | Five 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.
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.