Files
crackme/README_part2.md
T
2rax 3f83178b5e Part 4: live protocol capture, MITM lab, verdict map (9003 gate), root cause = server-side device binding
- Full /licenses/auth protocol: Bearer + 72-byte per-session binary proof (non-replayable), libcurl in-module, XOR-obfuscated strings
- MITM lab: machine-trusted self-signed api.slinky.gg cert + local HTTPS server + Frida connect-rewrite; no TLS pinning, no mTLS
- Verdict map: 7004 = device/blob gate, 9003 (0x232B) = local auth-response verification gate (fires on every 200 variant incl. real product .sig), zero native API activity
- Root cause: server 403 license-is-tied-to-another-device; license valid, rebound by another user
- tools/: fake api.slinky.gg server (log/echo/b64 modes), external memory scanner + dumper
2026-11-09 17:43:37 -05:00

315 lines
16 KiB
Markdown

# Part 2 — the original packed binary (`lib_beta_win`)
The devirt dump's 7-byte patch cannot be applied to the original: its `.text`
has **raw size 0 on disk** (everything except `.slinky2` is unpacked into
memory by the entry at runtime). So the crack had to be ported as a
**runtime** technique.
## What was established experimentally (no debugger — the client refuses to
run under one; Frida 17 was NOT detected, plain runs only)
1. **Runtime layout = devirt layout.** The entry unpacks native `.text`
in-place at the loader-mapped base. Runtime dumps prove the license cluster
is byte-identical to the devirt dump: thread proc `+0x10F0` (incl. the
`0x1B5B` failure constant), init `+0x1220`, `validate()` `+0x1290` with the
same `lea rcx,[0x140064]` at `+0x12AE`.
2. **Environment requirements.** The entry requires a live Java 8 VM
(`JNI_CreateJavaVM`) and a `javaw.exe` host; otherwise the process dies or
init fails during `LoadLibraryW`. On failure of `DllMain` the client
delists itself from the loader on purpose — that `GLE=487` is normal.
3. **Differential key test** (plain runs, status output):
- 32-char key → `status: 7003` (VM check ran, failed with `0x1B5B`)
- 31/33-char key → no output (length path dies inside VM'd message code)
- env var absent → no output (license thread never spawned)
4. **Byte patches are detected and reverted.** An in-flight patch of
`validate()` landed at tick ~1.1s and was **restored to the original bytes
by tick ~3.7s** (integrity self-repair or a late second unpack pass).
Re-patching trips detection: harder init failure (`GLE=1114`), license
thread never runs. Conclusion: **do not byte-patch this client.**
5. **The key check uses no forgeable API surface.** Full API tracing shows
zero CryptoAPI calls during validation — the math is custom VM code.
## The crack: block the self-unload
The lifted thread-proc shows the ONLY observable effect of a failed license is
`Sleep(1000); FreeLibraryAndExitThread(hinst, 0)` — on success it does nothing
else. Runtime tracing confirms `FreeLibraryAndExitThread` is the only thing
that ever unmaps the client. Therefore:
```
kernel32!FreeLibraryAndExitThread := mov ecx,edx ; jmp ExitThread (7 bytes)
```
applied **in the host process** (copy-on-write on kernel32 — the client's own
bytes are never touched, so its integrity self-repair sees nothing).
Any 32-char `SLINKY_LICENSE` then leaves the client permanently resident.
`loader2/slinky_loader.c` implements the complete flow: Java 8 VM creation,
env var, the 7-byte stub, `LoadLibraryW` of the client. Verified output:
```
[loader] SLINKY_LICENSE=WRONGKEY-THIS-IS-NOT-A-REAL-KEY!
[loader] JNI_CreateJavaVM -> 0
[loader] self-unload blocked @ kernel32!FreeLibraryAndExitThread ...
[loader] client -> 0x7FFCA85F0000 (GLE=487; normal - it delists itself)
[loader] client resident after 30s
status: 7003 <- license fails, client stays anyway
```
## For real injection into Minecraft
Inside the real `javaw.exe` (which already has a JVM), only two things are
needed before the client loads: the same 7-byte kernel32 stub and a 32-char
`SLINKY_LICENSE`. The loader2 source shows both; the same code can be built
as an injectable DLL.
## Open question
Whether every feature unlocks with the unload blocked (the lifted wrapper
suggests success sets no additional state, but part of the VM remains
un-lifted). Only a run inside real Minecraft 1.8.9 settles it.
## Repo additions for part 2
```
loader2/slinky_loader.c self-contained loader (JVM + block stub + load)
loader2/javaw.exe prebuilt, run from loader2\run\
```
---
# Part 3 — verdict plumbing, the elimination matrix, and the honest ceiling
## The status reads everyone gets wrong (we did, for a whole session)
The client has **two** callers of the one-shot validator and a guard race:
- `DllMain` reads `SLINKY_LICENSE` and **spawns a validator thread** (`+0x10F0`).
- `slinky_init` (export `+0x1000`) also validates, but first takes a
`lock cmpxchg` guard (`0x1802F9118`).
Whoever wins the race runs the real check and prints `status: %lu` to
**stderr** (`GetStdHandle(2)` + `"+status: %lu\n"` at `0x180140038`). The
loser takes the "already-initialized" path: it consumes a flag byte at
`0x1802FF010` that is **never set to a nonzero value** — so the loser
*always* returns `0` and may print a bogus `status: 0`.
In practice the spawned thread wins, so:
> **`slinky_init`'s return value is not the verdict. `stderr` is.**
All "VALID" readings from bare-host test harnesses (`keytest*.exe`,
`slinky_init -> 0`) were this artifact — the harness's own call lost the
race, while the spawned thread rejected the key and printed the real
`status:` line to a stderr file nobody was reading. Ground truth from the
stderr captures:
| build | key | host | stderr |
|---|---|---|---|
| devirt | `E984C654…8535` (blob hex) | bare JVM harness | `status: 7003` |
| devirt | `E984C654…8535` | real `javaw.exe` + MC 1.8.9 | `status: 7003` |
| devirt | `"A"*32` (right length, wrong content) | real MC | `status: 7003` |
| devirt | short key | real MC | no line (silent length path) |
| real client | real key `43A913B2…0F18` | bare JVM harness **today** | `status: 7004` |
| real client | real key | real MC **today** | `status: 7004` |
Two conclusions fall out:
1. **There is no Minecraft-vs-bare-host discriminator.** The devirt client
rejects its test key *everywhere*; the earlier "works in a bare JVM but
not in MC" split was the stderr artifact. (The real client's behavior
did change since January — it now fails in *every* host, including the
launcher-shaped ones; more below.)
2. **The real client + its real key no longer validate offline at all**
(`7004` everywhere today, `0` in January via the official launcher).
The server still reports the license active
(`GET /licenses/info → {"remaining":1285977}`), the client makes **zero**
network/API calls during validation (confirmed by TCP-table polling,
DNS-cache inspection and full API tracing), so whatever changed lives
inside the VM — plausibly a device/time-bound transform against the
`.rdata` blob.
## The elimination matrix (devirt client, real MC `javaw.exe`, verdict via stderr)
Every controlled variation below produced `status: 7003` — i.e. none of
these is the discriminator, because there is nothing to discriminate:
- injection method: clean `QueueUserAPC(LoadLibraryW)` on the game's own
threads (no loader DLL, no remote thread) vs. `CreateRemoteThread`
- calling path: env var + DllMain spawn vs. explicit `slinky_init` vs.
direct APC to the internal validator `base+0x10F0` with our own key buffer
- host process name (`javaw.exe`-named test host passes shape checks), host
binary path (launcher-runtime-shaped `jre-legacy` path), parent process
renamed `MinecraftLauncher.exe`
- JVM options: MC's exact `-Xmx/-Djava.library.path/-Djava.class.path/`
`-Dsun.java.command` replayed into a harness JVM; Mojang launcher flags
(`-XX:HeapDumpPath=MojangTricksIntelDrivers…`, `-Dos.name/-Dos.version`)
- classpath: the exact official 1.8.9 library list (log4j `2.0-beta9`,
`com.mojang:netty:1.8.8`, all 31 entries) fetched and replayed
- cmdline: realistic `--uuid/--clientId/--userType msa/--accessToken JWT/`
`--userProperties/--versionType release`, `--username 2rax`
- game state: injection at t+3 s (pre-window) vs. t+16-60 s (game booted);
a `SleepMain` JVM — MC's exact JVM/classpath but no MC classes running
- thread count: 60 dummy threads in a harness (vs MC's ~54)
- network: zero TCP connects / DNS lookups from the process during validate
(offline rejection)
- Frida API tracing during validate in MC: **zero** hookable API calls —
no JNI, wininet/winhttp/ws2_32, registry, files, windows, toolhelp,
debugger queries, volume/computer name. The VM reads what it needs
directly from memory (PEB/Ldr-class access, invisible to API hooks).
## What `status: 0` success actually does at the `.text` level
`slinky_start` (`0x180001290`) is one `lea rcx,[0x180140064]` followed by a
`call` into the VM region (`.vdvrt`, RVA `0x35556EC`) — the blob check **and
all real initialization** (JNI attach, `RegisterNatives`, game hooks) live
inside the VM. The `.text` success path after `slinky_start` returns 0 is
just: print `status: 0`, return 0. Nothing else.
Consequently the Route-1 patch (`31 C0 E9 22 00 00 00` at VA `0x1800012AE`)
= `xor eax,eax; jmp` onto `slinky_start`'s epilogue makes the client
**report success and stay resident, but it is inert by construction** — the
VM's initialization never executes. This is now a *proven* structural fact,
not an open question (it answers Part 2's "Open question": no, blocking the
unload does not unlock features).
## The honest ceiling
- **Residency in real Minecraft 1.8.9: solved** (Route-1 patch on the devirt
build, or the Route-2 kernel32 stub with any 32-char key).
- **Full client functionality: requires the VM's key transform.** The
transform maps key → blob comparison inside ~5 MB of obfuscated `.vdvrt`
code with no forgeable API surface, no network, and no static handle. The
key↔blob pairs are build-specific (`43A9… ↔ C2FE…` for the real client;
no standard hash relates them) and the devirt build's true key is unknown
(its blob hex is *not* its key — the real pair disproves that rule).
Recovering a working key means either devirtualizing `.vdvrt` or lifting
the VM's check loop at runtime — a separate project.
## Session tooling (all in the repo `tools/` folder)
- `apc_injector.c` — QueueUserAPC(LoadLibraryW) onto all target threads
(no remote thread, no loader DLL)
- `apc_injector2.c` — dll/init modes: after mapping, queues APCs directly
to `slinky_init(key)` (loader-style start with our own key buffer)
- `apc_call.c` — APC to an arbitrary address with a string parameter
- `keytest2..6.c` — harness JVMs: file-driven JVM options, tracer window,
thread bloat, real-client build, "run a Java main first" variant
- **stderr verdict technique**: launch the host with stderr redirected to a
file; the validator prints `status: %lu` there on the normal-length path.
This is the only reliable verdict channel — do not trust `slinky_init`'s
return value.
# Part 4 - The real client: live protocol, device binding, and the final wall
(2026-11-09. Subject: the *real* client `~/.slinky/bin/slinky_beta` /
`slinky.dll`, SHA256 `2B48DBEE...D01A`, 27,426,032 B, tested live in
Minecraft 1.8.9 with the genuine license key.)
## What the client file actually is
- `slinky_beta` = packed PE payload **+ a 267,352-byte appended auth blob**.
The loader downloads it as one stream from
`GET /files/lib_beta_win?inject_auth_blob_data=true`. (Today's fresh
payload is a *different build*, 27,158,680 B - the sizes merely mirror the
blob delta of our on-disk copy.)
- The blob tail carries the payload's **Authenticode table**: SSL.com
code-signing cert issued to *"Slinkware"* (Emmeloord, NL), timestamp
`2026-10-24 08:35:35Z` = the on-disk build date.
- The blob region also contains a second PE (CRT import strings visible);
the packer manually maps the whole file, so kernel32 file hooks see nothing.
## The live license protocol (captured via schannel plaintext hooks)
During `slinky_init` the client phones home exactly once:
POST /licenses/auth HTTP/1.1
Host: api.slinky.gg
User-Agent: slinky/5.0
Accept: */*
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer <32-char license>
Content-Length: 72
<72 binary bytes - different every run>
- The 72-byte body is a per-session proof (nonce + signature/MAC) derived
from the auth blob; it cannot be replayed.
- Failure responses are JSON: `{"error":"..."}` (the loader's Go
`api.Error` type: `{code, error}`).
- HTTP stack is **statically-linked libcurl** inside the module image, with
XOR-obfuscated strings (plaintext exists only transiently in memory).
## Root cause of the current failure (7004 everywhere)
The server answer today:
HTTP/1.1 403 Forbidden (origin app, cf-cache-status: DYNAMIC)
{"error":"license is tied to another device"}
- `/licenses/info` with the same Bearer still returns
`{"remaining":1276911}` counting down live - the license itself is fine.
- Therefore: **server-side device binding**. This license ran successfully on
another machine (the Slinky-Share package's user *ddg* ran it on
"Lunar Client 1.8.9" on 2026-10-25 per `Slinky-log.txt`) - the server
binds one device per license and does not re-bind on our proofs.
## Complete verdict map (empirically established)
| Scenario | Verdict | Notes |
|---|---|---|
| auth blob corrupted (100 KB zeroed) | **7004 instantly, zero network** | blob is validated locally before any traffic |
| auth -> real server 403 | **7004** | device denial |
| auth -> MITM 403 (device JSON) | 7004 | MITM is transparent |
| auth -> MITM 200 `{"remaining":N}` | **9003** | past the device gate! |
| auth -> MITM 200 `{}` / empty / closed / echo / blob bytes / **real product `.sig`** | **9003** | every content variant fails |
- **No TLS pinning**: a machine-trusted self-signed `api.slinky.gg` cert is
accepted (TLS_AES_256_GCM_SHA384).
- **No mTLS**: when the server requests a client certificate the client
presents **none** (`~/.slinky/bin/cert.pem`/`key.pem` are an RSA pair
for `CN=stinky-auth.scruzyt.workers.dev` - a hidden Cloudflare Worker
auth backend, live but answering clean empty 404s; plausibly the
blob-generation service whose absence makes `inject_auth_blob_data=true`
return 502 on every attempt).
- **9003** (0x232B) is the auth-response verification gate: it fires with
**no native API activity whatsoever** (no bcrypt, no window lookups, no
HWID queries, no registry, no file reads - verified by client-caller-
filtered hooks). The check runs entirely inside the VM with transiently
decrypted constants: even XOR-differential searches for the P-256 prime
find nothing across 539 MB of process dumps. The product signs with
ECDSA P-256 DER (`/files/lib_beta_win.sig` = `30 46 02 21 00 ...`), so
the 200-response almost certainly must carry a session-specific signature
that cannot be forged without the vendor private key.
- After 9003 the client stays resident and may retry auth once (fresh nonce,
second TLS connection); the process sometimes exits later.
## What this means
1. **The MITM lab breaks the server's device gate** (200 -> no more 7004),
but full functionality additionally requires passing the local
cryptographic response check -> verdict 0 -> init (JNI attach, GL hooks).
2. Getting there needs either
- the vendor: device re-bind + a working blob endpoint (both outside our
control; the blob endpoint 502s on every attempt today), or
- devirtualizing **this build's** VM auth/verdict logic (major project;
all material is captured: full memory dumps of the 403-path
(`dump_403/`, 471 MB) and 9003-path (`dump_9003/`, 539 MB), the
unpacked 19 MB RWX image, MITM + trace tooling).
3. The crackme objectives as originally posed (license check bypassed,
resident in real MC with any key) remain **solved** by Route-1/Route-2.
## MITM / analysis lab (this session)
- `mitm/slinky_mitm.js` - fake `api.slinky.gg` (TLS via machine-trusted
self-signed cert, request logging incl. hex bodies, hot-reloadable
response: JSON / raw b64 / echo modes)
- `mitm/memscan.ps1`, `mitm/dumpmem.ps1` - external VirtualQueryEx +
ReadProcessMemory scanner and dumper (no injection limits)
- Frida connect-hook redirect (Cloudflare -> 127.0.0.1) - no hosts file, no
driver; the client never reaches the real server
- Runtime quirks (REA Frida build): `Module.findExportByName` and
`Memory.scanSync` are unreliable - resolve via
`Process.enumerateModules()[i].enumerateExports()`; one clean attach per
process; `Java` bridge unavailable.