← all posts

· 3 min read · by Eav Puthcambo

Two strings, one MD5

A command interpreter that authenticates commands by MD5 hash. Two traps, a little binary arithmetic, and a real HashClash collision that acts as a wildcard command.

"Blorgs! Blorgs everywhere! Can you convince the Blorg Master to hand over his flag?" Blorg Multiplier, BroncoCTF 2026 (crypto)

The service is a little command interpreter. Every command you type is checked like this:

if md5(user_in) in valid:
    ...

The goal is to get the counter blorgs from 1 to exactly 468, using at most 3 edits:

increase: blorgs = (blorgs + 1) * 2   (costs an edit)
decrease: blorgs = (blorgs - 1) * 2   (costs an edit)
none:     blorgs *= 2                 (free)
program:  register a new command name (adds md5(name) to valid)

And the flag only prints in the final else branch, which you reach with a command that is valid but isn't any of the named commands. That last condition is the whole challenge.

Trap 1: show is dead on purpose

There's a show command in the valid list, but its hash is stored in UPPERCASE (A7DD12…). Python's hexdigest() is always lowercase, so it can never match. It's a red herring.

Trap 2: program can't reach else on its own

program lets you register a name, say A, adding md5(A) to the valid set. But then typing A hits elif user_in == program, not else. Registering a new name removes the old hash, so there's only ever one custom hash, and it's always the one that's handled.

So: no valid, unhandled command exists. Unless…

…two different strings have the same MD5

If md5(B) == md5(A) but B != A, then:

  • md5(B) in valid ✅ passes the check
  • B != program ✅ skips the program branch
  • falls all the way through to else → 🚩

An MD5 collision is effectively a wildcard command.

The blorg math

First I needed to reach 468 in ≤ 3 edits without overshooting (the loop dies if blorgs > 468). Working backwards, 468 = 2⁹ − 2⁵ − 2³ − 2², which works out to three decreases mixed into the doublings:

none none none none decrease none decrease decrease none
1 → 2 → 4 → 8 → 16 → 30 → 60 → 118 → 234 → 468      (edits = 3)

Generating a real collision

MD5 identical-prefix collisions are cheap these days thanks to Marc Stevens' HashClash. md5_fastcoll spits out two different 128-byte blocks with the same hash in seconds.

The catch: the service reads commands line by line with input(), so the blocks can't contain \n, \r or \0. So I just looped with fresh seeds until I got a clean pair:

git clone https://github.com/cr-marcstevens/hashclash && cd hashclash && ./build.sh
for i in $(seq 1 200); do
  ./bin/md5_fastcoll --seed1 $RANDOM$RANDOM -o m1.bin m2.bin >/dev/null 2>&1
  python3 -c '
import sys
a, b = open("m1.bin","rb").read(), open("m2.bin","rb").read()
sys.exit(0 if a != b and not any(x in (0x0a, 0x0d, 0x00) for x in a + b) else 1)
' && break
done

One more wrinkle: encodings

The server does input() (which UTF-8 decodes) and then .encode("latin-1") before hashing. To make it hash exactly my raw bytes M, I sent:

M.decode("latin-1").encode("utf-8")

High bytes travel as valid 2-byte UTF-8 sequences, input() decodes them back to the right code points, and latin-1 turns them back into the original bytes. Round trip complete.

Putting it together

  1. program → register collision block A
  2. Do the none/decrease dance to reach 468
  3. Send collision block B
$ python exploit.py
Wow! You earned the flag: bronco{ple4s3_d0nt_l3ak_fl4g}

📂 Full writeup, checker.py and exploit.py with the embedded collision pair: ctf-writeups/crypto/…/blorg multiplier

Thanks for reading! Questions or corrections? Ping me on GitHub.

Read more

all posts →