# Slinky crackme — cracked Target: `lib_beta_win_unpacked.devirt.bin` — the **Slinky Minecraft client** DLL (PE x86-64, 55,961,600 bytes, image base `0x180000000`, SHA-256 `a225f9b51903982fbb5a9f65a5f80f0964b71091b52f90199fd6cea85054ff4f`), an unpacked + devirtualized VMProtect dump (custom sections `.slinky0/.slinky1/.slinky2`, `.vdvrt`, leftover VMP bytecode/handlers). Result: **any 32-character license key is accepted** — 7-byte patch, verified dynamically (`status: 0`, DLL no longer self-unloads). ``` key='WRONGKEY-THIS-IS-NOT-A-REAL-KEY!' (len 32) [host] init -> 1; validation thread spawned; waiting... [host] survived 12s - DLL still mapped status: 0 ``` --- ## 1. The license mechanism All offsets are RVAs from image base `0x180000000`. ``` DllMain (VM entry 0x35053D7) └─> init +0x1220 (reason == DLL_PROCESS_ATTACH) ├─ hinstDLL -> global 0x2F9110 ├─ _wgetenv(L"SLINKY_LICENSE") <-- key source: env var └─ CreateThread(NULL, NULL, +0x10F0, key, 0, NULL) thread +0x10F0 ├─ wcslen(key) must == 0x20 (32 chars) else "Invalid license key", ret 0x1B5B ├─ UTF-16 -> byte fold (mod 127) into 33-byte stack buffer ├─ lock cmpxchg one-shot guard @ 0x2F9118 ├─ call validate() +0x1290 │ ├─ lea rcx, [0x140064] ; 16-byte blob: │ │ E9 84 C6 54 98 46 2E 0B B9 87 71 36 F4 36 85 35 │ ├─ call 0x1835556EC ; mutated VMP stubs (.vdvrt) -> VM │ ├─ call 0x18356D25F ; handlers in .slinky0/.slinky2 │ └─ call 0x18354E385 ; (hash + HWID fingerprint; un-lifted) │ returns EAX: 0 == valid ├─ EAX != 0 → fprintf(stderr, "status: %lu", code) │ Sleep(1000); FreeLibraryAndExitThread(hinst, 0) <-- self-unload └─ EAX == 0 → "status: 0", DLL stays loaded ``` Supporting evidence: imports `CryptAcquireContextA / CryptCreateHash / CryptHashData / CryptGetHashParam`, `BCryptGenRandom`, `IPHLPAPI` (HWID); strings `"SLINKY_LICENSE"` (UTF-16), `"Invalid license key"`, `"status: %lu"`, `"Authentication failed: %s"`, `"API error: status %u"`. ## 2. How it was reversed (methodology) 1. **Static triage without a decompiler.** No Ghidra/IDA/Hopper provider was available, so: objdump section/PE-header dumps, a raw keyword scan found the license strings, and IAT slots were resolved by hand from the import table (`_wgetenv`, `CreateThread`, `CloseHandle`, `Sleep`, `FreeLibraryAndExitThread`, `__acrt_iob_func`). RIP-relative `lea` targets were computed from a full `.text` disassembly to find the code referencing each string → located the license cluster at the very start of `.text`. 2. **Function bounds via `.pdata`.** The data-directory exception table was a stale protector artifact, but the on-disk `.pdata` section had 8,818 real RUNTIME_FUNCTION entries — that gave `validate()` = `0x180001290–0x18000F7D4` (57 KB, mostly inline VM bytecode) and proved the license thread/init were clean native code. 3. **Dynamic analysis, three attempts.** - Plain `LoadLibraryW` host → process killed inside the packer entry (VMP anti-host/anti-analysis checks). - Frida spawn+attach → detected, killed via a path that bypassed hooks. - **Manual mapping** at the preferred base `0x180000000` + calling the clean init `+0x1220` directly → license thread runs. 4. **gdb + hardware breakpoints.** Software bps and inline hooks are detectable/CRC-checked; hardware bps (4 slots) + a Python driver that distinguishes breakpoint SIGTRAPs from VMP's *exception-based control flow* (deliberate `int3`/SEGV handled by the packer's own VEH) let me follow the thread into the VM. 5. **Why standalone VM execution fails.** The devirtualizer only lifted part of the logic; the VMP stubs still verify packer runtime state (initialized by the original entry, which refuses non-Minecraft hosts and fails its own integrity checks in the rebuilt image) → computed-context loads fault at `0x180A6F4DF` / `0x1820DD058` whenever the VM is entered. 6. **Conclusion: don't fight the VM — bypass it.** The wrapper is clean native code and returns `EAX` straight from `validate()`; the VM's only observable effect on the wrapper is that return value. Forcing it to 0 = success, without executing any un-lifted bytecode. ## 3. The crack `validate()` @ `+0x1290` patched to return 0 unconditionally: ``` file offset 0x6AE (VA 0x1800012AE) original: 48 8D 0D AF ED 13 00 lea rcx,[0x180140064] ; -> VM calls patched: 31 C0 E9 22 00 00 00 xor eax,eax ; EAX = 0 = valid jmp 0x1800012D7 ; -> epilogue ``` Patched file SHA-256: `2a71d3850ed15d275850f6c20cfb689f886ee1ecf641a848e3c45edddccd2820` Reproduce with `patch/crack_patch.py`. ## 4. Repo contents ``` patch/crack_patch.py applies the 7-byte crack to the devirt binary loader/slinky_crack.c manual-map test loader (maps at 0x180000000, calls loader/slinky_crack.exe clean init +0x1220, sets SLINKY_LICENSE from argv[1]) hosts/ the other loader variants used during analysis gdb/ hardware-breakpoint + SIGTRAP-passing debug drivers analysis/ slinky_pe.txt full PE headers + import table slinky_funcs.xml .pdata function bounds (8,818 functions) slinky_validate.asm validate() disassembly ``` Excluded for size (rebuild locally): the original binaries, the 261 MB `.i64`, the full 38 MB `.text` disassembly. `crack_patch.py` regenerates the cracked binary from `lib_beta_win_unpacked.devirt.bin`. ## 5. Notes / limits - The key's cryptographic check itself lives in un-lifted VM bytecode (consumes the 16-byte blob; CryptoAPI + HWID fingerprint). A genuine *keygen* would require lifting that bytecode — the shipped `.i64` is the right artifact. The patch instead makes any 32-char key validate, which is sufficient. - VM'd message functions (`+0x55680`, the failure dialog path) can only run in the real injected (Minecraft) process; the patched success path avoids them.