From 3f83178b5ea6f0af3b135909699279842303f84d Mon Sep 17 00:00:00 2001 From: 2rax <17+2rax@noreply.skidsolutions.xyz> Date: Mon, 9 Nov 2026 17:43:37 -0500 Subject: [PATCH] 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 --- README_part2.md | 113 +++++++++++++++++++++++++++++++++++++++++++ tools/dumpmem.ps1 | 59 ++++++++++++++++++++++ tools/memscan.ps1 | 92 +++++++++++++++++++++++++++++++++++ tools/slinky_mitm.js | 77 +++++++++++++++++++++++++++++ 4 files changed, 341 insertions(+) create mode 100644 tools/dumpmem.ps1 create mode 100644 tools/memscan.ps1 create mode 100644 tools/slinky_mitm.js diff --git a/README_part2.md b/README_part2.md index 1826e6c..8f67105 100644 --- a/README_part2.md +++ b/README_part2.md @@ -199,3 +199,116 @@ unload does not unlock features). 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. diff --git a/tools/dumpmem.ps1 b/tools/dumpmem.ps1 new file mode 100644 index 0000000..fa81085 --- /dev/null +++ b/tools/dumpmem.ps1 @@ -0,0 +1,59 @@ +param([int]$TargetPid = 0, [string]$OutDir = "") +$t = "C:\Users\nicot\AppData\Local\Temp\opencode" +if (-not $TargetPid) { $TargetPid = [int](Get-Content "$t\mcgame\pid.txt") } +if (-not $OutDir) { $OutDir = "$t\dump" } +"dumping unpacked regions of pid $TargetPid to $OutDir..." + +Add-Type @' +using System; +using System.Runtime.InteropServices; +public class Mem2 { + [DllImport("kernel32.dll")] public static extern IntPtr OpenProcess(uint a, bool b, int pid); + [DllImport("kernel32.dll")] public static extern bool ReadProcessMemory(IntPtr h, IntPtr addr, byte[] buf, IntPtr size, out IntPtr read); + [DllImport("kernel32.dll")] public static extern IntPtr CloseHandle(IntPtr h); + [StructLayout(LayoutKind.Explicit)] + public struct MBI { + [FieldOffset(0)] public IntPtr BaseAddress; + [FieldOffset(8)] public IntPtr AllocationBase; + [FieldOffset(16)] public uint AllocationProtect; + [FieldOffset(24)] public IntPtr RegionSize; + [FieldOffset(32)] public uint State; + [FieldOffset(36)] public uint Protect; + [FieldOffset(40)] public uint Type; + } + [DllImport("kernel32.dll")] public static extern IntPtr VirtualQueryEx(IntPtr h, IntPtr addr, ref MBI mbi, IntPtr len); +} +'@ + +$h = [Mem2]::OpenProcess(0x0410, $false, $TargetPid) +if ($h -eq [IntPtr]::Zero) { "OpenProcess FAILED"; exit 1 } +New-Item -ItemType Directory -Force $OutDir | Out-Null + +$addr = [IntPtr]::Zero +$total = 0; $files = 0 +while ($true) { + $mbi = New-Object Mem2+MBI + $r = [Mem2]::VirtualQueryEx($h, $addr, [ref]$mbi, [IntPtr]::new([System.Runtime.InteropServices.Marshal]::SizeOf([type][Mem2+MBI]))) + if ($r -eq [IntPtr]::Zero) { break } + $base = [long]$mbi.BaseAddress + $size = [long]$mbi.RegionSize + if ($size -le 0) { break } + $prot = $mbi.Protect -band 0xFF + $interesting = ($mbi.State -eq 0x1000) -and ($mbi.Type -eq 0x20000) -and ($prot -eq 0x02 -or $prot -eq 0x04 -or $prot -eq 0x20 -or $prot -eq 0x40) -and ($base -ge 0x1000000) -and ($base -lt 0x100000000) -and ($size -ge 4096) + if ($interesting) { + $cap = [Math]::Min($size, 64MB) + $buf = New-Object byte[] $cap + $read = [IntPtr]::Zero + if ([Mem2]::ReadProcessMemory($h, $mbi.BaseAddress, $buf, [IntPtr]$cap, [ref]$read) -and [long]$read -gt 4096) { + $p = switch ($prot) { 0x02 { "r" } 0x04 { "rw" } 0x20 { "rx" } 0x40 { "rwx" } default { "p$prot" } } + $fn = "{0}\{1:X12}_{2}_{3}.bin" -f $OutDir, $base, $p, [int]$read + [System.IO.File]::WriteAllBytes($fn, $buf[0..([int]$read-1)]) + "saved {0} ({1} bytes)" -f $fn, [int]$read + $total += [int]$read; $files++ + } + } + $addr = [IntPtr]($base + $size) + if ($addr -eq [IntPtr]::Zero) { break } +} +[Mem2]::CloseHandle($h) | Out-Null +"done: $files regions, $([Math]::Round($total/1MB)) MB" diff --git a/tools/memscan.ps1 b/tools/memscan.ps1 new file mode 100644 index 0000000..bfd5106 --- /dev/null +++ b/tools/memscan.ps1 @@ -0,0 +1,92 @@ +param([int]$TargetPid = 0) +$t = "C:\Users\nicot\AppData\Local\Temp\opencode" +if (-not $TargetPid) { $TargetPid = [int](Get-Content "$t\mcgame\pid.txt") } +"scanning pid $TargetPid memory..." + +Add-Type @' +using System; +using System.Runtime.InteropServices; +public class Mem { + [DllImport("kernel32.dll")] public static extern IntPtr OpenProcess(uint a, bool b, int pid); + [DllImport("kernel32.dll")] public static extern bool ReadProcessMemory(IntPtr h, IntPtr addr, byte[] buf, IntPtr size, out IntPtr read); + [DllImport("kernel32.dll")] public static extern IntPtr CloseHandle(IntPtr h); + [StructLayout(LayoutKind.Explicit)] + public struct MBI { + [FieldOffset(0)] public IntPtr BaseAddress; + [FieldOffset(8)] public IntPtr AllocationBase; + [FieldOffset(16)] public uint AllocationProtect; + [FieldOffset(24)] public IntPtr RegionSize; + [FieldOffset(32)] public uint State; + [FieldOffset(36)] public uint Protect; + [FieldOffset(40)] public uint Type; + } + [DllImport("kernel32.dll")] public static extern IntPtr VirtualQueryEx(IntPtr h, IntPtr addr, ref MBI mbi, IntPtr len); +} +'@ + +$h = [Mem]::OpenProcess(0x0410, $false, $TargetPid) +if ($h -eq [IntPtr]::Zero) { "OpenProcess FAILED"; exit 1 } +$L1 = [System.Text.Encoding]::GetEncoding(28591) + +$needles = @( + "licenses/auth", "api.slinky", "remaining", "slinky/5.0", "POST /", "Authorization", + "auth_blob", "inject_auth_blob", "session", "signature", "device_id", "hwid", + "BEGIN PUBLIC KEY", "slinky_beta", ".slinky", "status: %lu", "BEGIN_BLOB" +) +$byteNeedles = @( + @{ n = "const 0x232B (9003)"; s = ($L1.GetString([byte[]](0x2B,0x23,0x00,0x00))) }, + @{ n = "const 0x1B5B (7003)"; s = ($L1.GetString([byte[]](0x5B,0x1B,0x00,0x00))) }, + @{ n = "const 0x1B5C (7004)"; s = ($L1.GetString([byte[]](0x5C,0x1B,0x00,0x00))) } +) + +function Show-Hit([string]$tag, [long]$base, [uint32]$prot, [uint32]$typ, [string]$regionStr, [int]$idx, [int]$needleLen) { + $p = "" + if ($prot -band 0x10) { $p = "R" } elseif ($prot -band 0x20) { $p = "RW" } elseif ($prot -band 0x40) { $p = "RX" } elseif ($prot -band 0x80) { $p = "RWX" } else { $p = ("0x{0:X}" -f $prot) } + $tt = switch ($typ) { 0x1000000 { "IMG" } 0x40000 { "MAP" } 0x20000 { "PRV" } default { ("0x{0:X}" -f $typ) } } + $s0 = [Math]::Max(0, $idx - 24) + $len = [Math]::Min(130, $regionStr.Length - $s0) + $ctxv = $regionStr.Substring($s0, $len) -replace '[^\x20-\x7e]', '.' + "{0} @ 0x{1:X12} [{2} {3}] :: {4}" -f $tag, ($base + $idx), $p, $tt, $ctxv +} + +$addr = [IntPtr]::Zero +$regions = 0; $readMB = 0; $hits = 0 +$endMax = [long]::MaxValue +while ($true) { + $mbi = New-Object Mem+MBI + $r = [Mem]::VirtualQueryEx($h, $addr, [ref]$mbi, [IntPtr]::new([System.Runtime.InteropServices.Marshal]::SizeOf([type][Mem+MBI]))) + if ($r -eq [IntPtr]::Zero) { break } + $base = [long]$mbi.BaseAddress + $size = [long]$mbi.RegionSize + if ($size -le 0) { break } + if ($base -ge $endMax) { break } + if ($mbi.State -eq 0x1000 -and ($mbi.Protect -band 0xFF) -ne 0x01 -and ($mbi.Protect -band 0xFF) -ne 0x00) { + $regions++ + $cap = [Math]::Min($size, 256MB) + $buf = New-Object byte[] $cap + $read = [IntPtr]::Zero + if ([Mem]::ReadProcessMemory($h, $mbi.BaseAddress, $buf, [IntPtr]$cap, [ref]$read) -and [long]$read -gt 0) { + $readMB += ([long]$read) / 1MB + $rs = $L1.GetString($buf, 0, [int]$read) + foreach ($nd in $needles) { + $i = 0; $count = 0 + while (($i = $rs.IndexOf($nd, $i)) -ge 0 -and $count -lt 5) { + Show-Hit "[STR $($nd.Substring(0,[Math]::Min(18,$nd.Length)))]" $base $mbi.Protect $mbi.Type $rs $i $nd.Length + $hits++; $count++; $i += $nd.Length + } + } + foreach ($bn in $byteNeedles) { + $i = 0; $count = 0 + while (($i = $rs.IndexOf($bn.s, $i)) -ge 0 -and $count -lt 5) { + Show-Hit $bn.n $base $mbi.Protect $mbi.Type $rs $i 4 + $hits++; $count++; $i += 4 + } + } + } + } + $addr = [IntPtr]($base + $size) + if ($addr -eq [IntPtr]::Zero) { break } +} +[Mem]::CloseHandle($h) | Out-Null +"" +"regions committed: $regions, read: $([Math]::Round($readMB)) MB, hits: $hits" diff --git a/tools/slinky_mitm.js b/tools/slinky_mitm.js new file mode 100644 index 0000000..c6ed20a --- /dev/null +++ b/tools/slinky_mitm.js @@ -0,0 +1,77 @@ +// Fake api.slinky.gg for MITM experiments. +// Logs every request (headers + hex body) to server.log. +// Serves status/body from response.json (re-read per request). +'use strict'; +const tls = require('tls'); +const fs = require('fs'); +const path = require('path'); + +const DIR = 'C:/Users/nicot/AppData/Local/Temp/opencode/mitm'; +const PFX = path.join(DIR, 'slinky.pfx'); +const LOG = path.join(DIR, 'server.log'); +const CFG = path.join(DIR, 'response.json'); + +function log(s) { try { fs.appendFileSync(LOG, s + '\n'); } catch (e) {} } + +const server = tls.createServer({ + pfx: fs.readFileSync(PFX), + passphrase: 'slinkymitm', + requestCert: true, + rejectUnauthorized: false, + ALPNProtocols: ['http/1.1'], +}, (socket) => { + log('=== TLS handshake from ' + socket.remoteAddress + ':' + socket.remotePort + + ' alpn=' + socket.alpnProtocol + ' cipher=' + socket.getCipher().name + ' ==='); + try { + const pc = socket.getPeerCertificate(); + if (pc && Object.keys(pc).length > 0) { + log('>>> CLIENT CERT PRESENTED: subject=' + JSON.stringify(pc.subject) + ' issuer=' + JSON.stringify(pc.issuer) + + ' fpr=' + pc.fingerprint + ' valid=' + pc.valid_from + ' -> ' + pc.valid_to); + } else { + log('>>> no client certificate presented'); + } + } catch (e) { log('cert read err: ' + e.message); } + let buf = Buffer.alloc(0); + socket.on('data', (d) => { + buf = Buffer.concat([buf, d]); + // process as many pipelined requests as are complete + for (;;) { + const idx = buf.indexOf('\r\n\r\n'); + if (idx === -1) break; + const head = buf.slice(0, idx).toString('latin1'); + let cl = 0; + const m = head.match(/Content-Length:\s*(\d+)/i); + if (m) cl = parseInt(m[1], 10); + if (buf.length < idx + 4 + cl) break; + const body = buf.slice(idx + 4, idx + 4 + cl); + log('--- REQUEST ---\n' + head + '\nBODY(' + body.length + 'B hex): ' + body.toString('hex')); + let status = 200, payload = Buffer.from(''); + let ct = 'application/json'; + try { + const cfg = JSON.parse(fs.readFileSync(CFG, 'utf8')); + status = cfg.status || 200; + if (cfg.echo) { + payload = body; // challenge-response test: echo client's own body + } else if (cfg.bodyB64) { + payload = Buffer.from(cfg.bodyB64, 'base64'); + } else { + payload = Buffer.from(cfg.body || '', 'utf8'); + } + ct = cfg.contentType || 'application/json'; + } catch (e) { + status = 500; payload = Buffer.from('{"error":"mitm cfg error"}'); + } + const reason = status === 200 ? 'OK' : (status === 403 ? 'Forbidden' : (status === 404 ? 'Not Found' : 'Status')); + const resp = 'HTTP/1.1 ' + status + ' ' + reason + '\r\n' + + 'Content-Type: ' + ct + '\r\n' + + 'Content-Length: ' + payload.length + '\r\n' + + 'Connection: keep-alive\r\n\r\n'; + log('--- RESPONSE ' + status + ' body: ' + payload.toString('latin1').slice(0, 200)); + socket.write(Buffer.concat([Buffer.from(resp), payload])); + buf = buf.slice(idx + 4 + cl); + } + }); + socket.on('error', (e) => log('sock err: ' + e.message)); +}); +server.listen(443, '127.0.0.1', () => { console.log('mitm listening 127.0.0.1:443'); }); +server.on('error', (e) => { console.log('server err: ' + e.message); process.exit(1); });