crackme_v0.2

2 min read
by lafarge (crackmes.de) crackmes.oneMediumx86PE (Windows)solved in 1 hunsolved

Goal: write a keygen that produces a valid registration code for any username.

Status: unsolved. My keygen doesn’t produce working codes yet.

Triage

1chmod +x crackme.exe
2wine crackme.exe

It asks for a username and a registration code. The username has to be at least 4 characters. strings literally tells you to write a keygen.

Static analysis

In Ghidra, the entry function sets up a dialog box. FUN_004010ba is the dialog procedure, which handles all the user interaction:

entry: DialogBoxParamA with FUN_004010ba as the handler
entry: DialogBoxParamA with FUN_004010ba as the handler

Opening it showed a wall of raw bytes. Fix: click the start, press D (disassemble), then F (create function), and the decompiler fills in.

the decompiled dialog procedure
the decompiled dialog procedure

What each check does:

breakdown of the checks
breakdown of the checks

Patch or keygen?

  1. Patch the conditional jump (JB/JL) that leads to the error box: NOP it or turn it into a JMP. Quick, but you learn nothing.
  2. Keygen: reimplement the algorithm so any username gets a valid code. That’s the right way.

Started the keygen with the username length rule:

keygen, first version
keygen, first version

If the username is 4+ characters, the code is generated with a hard-coded algorithm:

the length check and the start of the algorithm
the length check and the start of the algorithm

Following the cross-reference to the “that’s the right code” message and scrolling up a bit lands on the serial-building loop:

the serial generation loop
the serial generation loop

Where it’s stuck

Couldn’t get the proof of concept working, and neither did the public solutions I tried. Coming back to this one.

Thoughts?