easy_reverse

1 min read
by cbm-hackers crackmes.oneEasyx86-64ELFsolved in 20 min

Goal: get the binary to print its flag.

Triage

Downloaded it, chmod +x, ran it: it wants a password.

In Ghidra there’s a secret flag path, but no hard-coded password to pull out, so this one has to be solved at runtime.

Dynamic analysis

Loaded it in gdb and ran disass main. There are two cmp instructions that decide whether you pass:

main, with the two checks at +40 and +64
main, with the two checks at +40 and +64
  • main+40: cmp $0xa, %rax, compares the result of strlen against 10
  • main+64: cmp $0x40, %al, compares one character of the input against 0x40

Solution

Break on both checks, then overwrite the register each time so the comparison passes:

1break *main+40      # first check (length == 10)
2break *main+64      # second check (char == 0x40)
3run 1               # any password works
4set $rax=10         # at bp 1: make the length check pass
5continue
6set $rax=0x40       # at bp 2: make the char check pass
7continue            # flag prints

Flag: flag{1}

Thoughts?