← all posts

· 3 min read · by Eav Puthcambo

Beating a time-locked crackme without beating the clock

An obfuscated Windows crackme only works during a 4-hour CTF window. Turns out CBC mode and a leaked PDB path mean you don't need the window at all.

a_matter_of_time, Crackmes.one Reverse Engineering CTF 2026 (author: @heapsoverflow)

Run this crackme and it greets you with a little story about January 19, 2038, then promptly tells you:

Time's up. Every old system switched to 64-bit but at what cost... You can still try though.
Wrong timing.

The binary only decrypts its flag if you run it during the CTF's 4-hour window. The window had long passed by the time I sat down with it. Here's how I got the flag anyway, and why the time lock barely mattered.

The setup

The challenge description gave away the crypto: AES-128-CBC, where

  • the key is a "discoverable username"
  • the IV is an "amalgamated value from UNIX decimal timestamps"

So I needed three things: the key, the IV, and the ciphertext.

The key was in the build artifacts

Early triage of the PE turned up an embedded PDB path, which MSVC leaves behind for debug symbols:

C:\Users\nicetryboogeyman\cmo\x64\Release\cmo.pdb

nicetryboogeyman is exactly 16 characters, the size of an AES-128 key. Nice try indeed. 🙃

Fighting the obfuscation (or rather, not)

The binary was run through the author's own bin2bin obfuscator. There was an ~80 KB .ch section full of code that .pdata didn't cover, control-flow flattening with junk bytes, and every string XOR-encrypted and assembled from shuffled chunks at runtime.

I could have untangled the string builder statically. Instead, I wrote a small pure-Python Windows debugger with ctypes that:

  1. launches the binary under DEBUG_ONLY_THIS_PROCESS with piped stdin/stdout
  2. lets it run until it has decoded its own secrets
  3. walks its memory with VirtualQueryEx + ReadProcessMemory and greps for printable strings

That gave me the ciphertext, sitting in memory as hex, already decoded by the program itself:

4c4635258cf6eca5d80b8e050a9e5b04 f1a9c979bc55f3f4773971ed2f81a969 67bb3569fa002f549cc970a18779b3a7

I also tried hooking the time APIs to fake being inside the window. Hooking NtQuerySystemTime did fire, but the gate's verdict didn't change, because it reads the clock through a path that bypasses the hook. But it turned out not to matter at all.

Why the clock doesn't matter: CBC math

In CBC mode, every block after the first is decrypted like this:

P[i] = AES_dec(C[i]) XOR C[i-1]      for i ≥ 1

Notice what's not in that formula: the IV. The IV only affects block 0. So with just the key, I could decrypt blocks 1 and 2 immediately:

blocks 1-2  ->  t0_l34rn_fr0M_n0T_t0_l1V3_1n}\x03\x03\x03

Clean PKCS#7 padding confirmed both the key and the ciphertext alignment. That's two-thirds of the flag without ever touching the time-derived IV.

Recovering the IV with known plaintext

For block 0, IV = AES_dec(C[0]) XOR P[0]. I know the flag format starts with CMO{, so:

IV[0:4] = AES_dec(C[0])[0:4] XOR "CMO{"  =  "0000"

So the IV is a zero-padded decimal string, which matches "decimal timestamps." The real value turned out to be 0000000537068053:

[+] FLAG: CMO{5h3_p4St_1s_t0_l34rn_fr0M_n0T_t0_l1V3_1n}

"The past is to learn from, not to live in." Fitting for a challenge I solved after the clock ran out.

An honest caveat

The "IV is 16 ASCII digits" constraint narrows things a lot, but it doesn't uniquely pin block 0. For example, CMO{7h3_p4St… with a different all-digit IV also decrypts to something readable. Known plaintext gets you close; only the real IV value (from reversing its construction or running in-window) is truly authoritative. It's a good reminder that a charset constraint narrows the search but doesn't always solve it.

📂 Full writeup plus solve.py, memdump.py and timehook.py: ctf-writeups/reverse/…/a_matter_of_time

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

Read more

all posts →