mirror of
https://github.com/qybaihe/bla.git
synced 2026-11-20 08:20:59 +08:00
feat(challenge): CrackMe v8 Aegis — 2.0 engine + R1–R12 recipes
Graduate the standing red/blue entitlement design into the public CrackMe. Rebuild with bla harden bankrupt + --self-seal (no --allow-*): SHA-256(key) mask KDF, commitment outside XOR, seed-derived rounds/pad3, arity-2 / export-order / unlock body-index hygiene. Meridian v7 stays historical (cleartext private; cannot honestly re-harden without the maintainer store).
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
name: CrackMe v8 solve (Aegis)
|
||||
description: Submit a proof-of-solve for Aegis (CrackMe v8)
|
||||
title: "CrackMe v8 solve: <short method>"
|
||||
labels: ["crackme", "challenge"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Prove a break of [Aegis / CrackMe v8](https://github.com/qybaihe/bla/tree/main/challenge/v8) by posting the **SHA-256 of the FLAG** (not the raw FLAG). It must match `flagSha256` in `challenge/v8/SEAL.json`.
|
||||
- type: dropdown
|
||||
id: surface
|
||||
attributes:
|
||||
label: Primary surface used
|
||||
options:
|
||||
- Executed hardened app (intended)
|
||||
- Full WASM reverse of unlock
|
||||
- Packaging / lint footgun (should be closed in 2.0)
|
||||
- BLA product gap / generic harden bypass
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: flag_sha256
|
||||
attributes:
|
||||
label: SHA-256 of the FLAG
|
||||
description: Lowercase hex. Prefer not to paste the raw FLAG unless you intend public disclosure.
|
||||
placeholder: a1b2c3…
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: method
|
||||
attributes:
|
||||
label: Method notes
|
||||
description: What you recovered (KDF, commitment layout, body-index, etc.) and whether a general BLA bypass was involved.
|
||||
validations:
|
||||
required: true
|
||||
@@ -53,6 +53,8 @@ jobs:
|
||||
env:
|
||||
CRACKME_V6_KEY: ${{ secrets.CRACKME_V6_KEY }}
|
||||
CRACKME_V6_FLAG: ${{ secrets.CRACKME_V6_FLAG }}
|
||||
CRACKME_V8_KEY: ${{ secrets.CRACKME_V8_KEY }}
|
||||
CRACKME_V8_FLAG: ${{ secrets.CRACKME_V8_FLAG }}
|
||||
run: npm run crackme:seal
|
||||
|
||||
- name: Run Counter-REA showcase benchmark
|
||||
|
||||
@@ -24,3 +24,6 @@ challenge/v6/hardened/core.wasm
|
||||
|
||||
# CrackMe v7 private fixture
|
||||
challenge/v7/.fixture/
|
||||
|
||||
# CrackMe v8 fixture builds
|
||||
challenge/v8/.fixture/
|
||||
|
||||
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- **CrackMe v8 Aegis:** product entitlement challenge rebuilt with bla-agents **2.0** (`bankrupt` + `--self-seal`, no `--allow-*`). Absorbs red/blue R1–R12 recipes (SHA-256(key) mask KDF, commitment outside XOR, seed-derived rounds/pad3, arity-2 / export-order / unlock body-index hygiene). Meridian v7 remains a historical snapshot (cleartext private; not re-hardened).
|
||||
|
||||
## [2.0.0] — 2026-11-03
|
||||
|
||||
Major MCP + Skill 2.0 release. Red/Blue R1–R12 packaging gates that held under adversarial
|
||||
|
||||
+9
-9
@@ -1,24 +1,24 @@
|
||||
# BLA CrackMe
|
||||
|
||||
BLA 对外发布的逆向 / 防护挑战。当前主挑战是 **v7 Meridian**。
|
||||
BLA 对外发布的逆向 / 防护挑战。当前主挑战是 **v8 Aegis**。
|
||||
|
||||
## v7 — Meridian(当前)
|
||||
## v8 — Aegis(当前)
|
||||
|
||||
真实小型工程计算器,经 `bla harden`(bankrupt、llm-directives OFF)硬化后发布。
|
||||
通过 `license activate` 解锁 Meridian Pro,打印激活证书。
|
||||
产品 entitlement 门禁,经 `bla harden`(bankrupt + `--self-seal`,无 `--allow-*`)硬化后发布。
|
||||
吸收红蓝 R1–R12 站住的配方(SHA-256 KDF、commitment 外置、随机 rounds/pad3、arity-2 / export-order / body-index 卫生)。
|
||||
|
||||
```bash
|
||||
npm run crackme:v7 -- calc "sqrt(2)*sin(pi/4)"
|
||||
npm run crackme:v7 -- license activate 'XXXXX-XXXXX-XXXXX-XXXXX'
|
||||
npm run crackme:v8 -- '<16-char-key>'
|
||||
```
|
||||
|
||||
设计说明:[`v7/DESIGN.md`](./v7/DESIGN.md) · 承诺摘要:[`v7/SEAL.json`](./v7/SEAL.json)
|
||||
设计说明:[`v8/DESIGN.md`](./v8/DESIGN.md) · 承诺摘要:[`v8/SEAL.json`](./v8/SEAL.json)
|
||||
|
||||
## 历史
|
||||
|
||||
| 版本 | 状态 | 说明 |
|
||||
|---|---|---|
|
||||
| v7 Meridian | **当前** | 真实应用 + 整钥链式 ARX + 自完整性 |
|
||||
| v6 Harden-Native | 快照(1.6.1) | `challenge/v6/`,已被 v7 取代 |
|
||||
| v8 Aegis | **当前** | 2.0 引擎 + R1–R12 配方;unlock-in-WASM |
|
||||
| v7 Meridian | 快照 | `challenge/v7/`,明文在私有 store,未用 2.0 重 harden |
|
||||
| v6 Harden-Native | 快照(1.6.1) | `challenge/v6/`,教学用 lane / preserve-exports |
|
||||
| v6-tiered-protect | 归档 | `challenge/archive/v6-tiered-protect/`(#38) |
|
||||
| v5.2 | 归档 | `challenge/archive/v5/` |
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
# CrackMe v8 — Aegis Design
|
||||
|
||||
> Status: **successor to CrackMe v7 Meridian**. Built with **bla-agents 2.0**
|
||||
> after red/blue rounds 1–12; the published tree **is** `hardenProject()` output.
|
||||
|
||||
## Product framing
|
||||
|
||||
Aegis is a small entitlement unlock:
|
||||
|
||||
| Command | Behavior |
|
||||
|---|---|
|
||||
| `node license.cjs <16-char-key>` | Unlock certificate / FLAG on success; uniform `DENIED` otherwise |
|
||||
|
||||
There is no in-browser panel derive. `panel.html` is operator UI only.
|
||||
|
||||
## Why not re-harden Meridian v7
|
||||
|
||||
Meridian cleartext + `gen.mjs` live in a **maintainer-private store** (only
|
||||
hardened + SEAL are in git). Round-1 already recorded that an honest 2.0
|
||||
re-harden of v7 is impossible without that store. Aegis is the public
|
||||
graduation of the standing red/blue entitlement design instead.
|
||||
|
||||
## Recipes absorbed from R1–R12
|
||||
|
||||
| Round | Lesson | Aegis response |
|
||||
|---|---|---|
|
||||
| R1 | Stable WASM ABI + independent 1-byte lanes | No `wasmPreserveExports` / no lane tables; bankrupt rename default |
|
||||
| R2–R4 | Reversible seals, JS AES unwrap, panel oracles, soft self-seal | One-way SHA-256 seal; no AES unwrap; no panel derive; **`--self-seal`** |
|
||||
| R5–R6 | Hydrate dump / XOR-mask sidecar | Unlock stays in WASM; no mask sidecar |
|
||||
| R7–R9 | Seal.revision XOR-KP + weak mask KDF + structure KP | **SHA-256(key) mask KDF**; commitment **outside** XOR; seed-derived rounds+pad3 |
|
||||
| R10–R12 | Arity-2 alias stack / export-order / body idx 0 | Prefer arity-2 aliases; export-order shuffle; unlock body-index scatter |
|
||||
| P2 | Full WASM RE + SMT | **Honest residual** — not refused as a packaging lint |
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
challenge/v8/hardened/
|
||||
license.cjs ← hardened host gate (arity + FLAG + certificateSha256)
|
||||
panel.html ← hardened operator UI (no token derive)
|
||||
core.wasm.gz ← unlock-in-WASM (gzipped; ~7 MB raw)
|
||||
seal.json ← runtime one-way seal (revision + certificateSha256)
|
||||
challenge/v8/SEAL.json ← public digests / knobs only
|
||||
```
|
||||
|
||||
### Unlock (happy path)
|
||||
|
||||
1. Host loads hardened `core.wasm`, finds **arity-2** exports (order/name-independent).
|
||||
2. Invokes candidates; accepts UTF-8 matching `FLAG{…}`.
|
||||
3. Requires `SHA-256(result) === seal.certificateSha256`.
|
||||
4. Inside WASM: `mask = SHA-256(key[16])`, unmask pack
|
||||
`salt||rounds||pad3||entropyPad[32]||clen||cipher`, compare clear commitment
|
||||
segment to `SHA-256(ARX_state)`, decrypt certificate.
|
||||
|
||||
Wrong key / honeypot canary / missing sibling → uniform deny (honeypots never
|
||||
call WASM unlock).
|
||||
|
||||
## Honest scope
|
||||
|
||||
Solvable by a determined reverse engineer who recovers the in-WASM unlock
|
||||
(SHA-256 KDF + ARX + commitment layout) and searches the key space — **not**
|
||||
by packaging footguns that R1–R12 closed. Gates do **not** claim white-box
|
||||
secrecy against full WASM RE / online SMT.
|
||||
|
||||
## Maintainer recipe
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
CRACKME_V8_KEY='…' CRACKME_V8_FLAG='FLAG{…}' npm run crackme:v8:build
|
||||
npm run crackme:v8:seal
|
||||
# fixture-only CI path (no release secrets):
|
||||
npm run crackme:v8:build -- --fixture
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
# Aegis (CrackMe v8)
|
||||
|
||||
Offline product entitlement gate shipped as a **real `bla harden` output**
|
||||
(bankrupt + `--self-seal`, **no** `--allow-*`). Absorbs the red/blue R1–R12
|
||||
recipes that held under BLA 2.0 packaging gates.
|
||||
|
||||
```bash
|
||||
npm run crackme:v8 -- '<16-char-key>'
|
||||
```
|
||||
|
||||
Rules, commitment digests, and design rationale live in
|
||||
[`DESIGN.md`](./DESIGN.md) and [`SEAL.json`](./SEAL.json).
|
||||
|
||||
This supersedes CrackMe v7 Meridian (still under `../v7/` for history).
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"schema": "bla-crackme-v8-seal/v1",
|
||||
"mode": "release",
|
||||
"product": "Aegis",
|
||||
"blaVersion": "2.0.0",
|
||||
"recipe": "npm run crackme:v8:build (hardenProject == `bla harden <dir> --intensity bankrupt --seed <seed> --self-seal`)",
|
||||
"seed": "bla-crackme-v8-aegis-2026-11",
|
||||
"intensity": "bankrupt",
|
||||
"selfSeal": true,
|
||||
"llmDirectives": false,
|
||||
"emitManifest": false,
|
||||
"keySha256": "2b91c07f1035e2ae45a85916af9df33e14da9c8e2e71b8a0a7f2b6f6b00e349e",
|
||||
"flagSha256": "df777780af5a9e99813bf3b8dafc223c65876c220cf847afa95164f10f026a74",
|
||||
"artifacts": {
|
||||
"license.cjs": {
|
||||
"sha256": "e4c8fe01dd228dea9373f20575aa68e2ba3d598b060508fe0f1ed17bbd4ed5ec",
|
||||
"bytes": 228842
|
||||
},
|
||||
"panel.html": {
|
||||
"sha256": "64b27d9637489f1195568ea2a1f1fab08b81e239091a0dfc972adf3df423dcac",
|
||||
"bytes": 122767
|
||||
},
|
||||
"core.wasm.gz": {
|
||||
"sha256": "cb9f3998d973d35e3f8f7b083f13f9b2763c370632555a1e0de6f3cd635f226a",
|
||||
"bytes": 21347
|
||||
},
|
||||
"seal.json": {
|
||||
"sha256": "9b057120186e6b32d223ee598606a6acf5265b418cf077469a71c807eafd7a5b",
|
||||
"bytes": 654
|
||||
},
|
||||
"core.wasm": {
|
||||
"sha256": "e80b050886eda3399d3bb61aa7f4eb464d58da6f6cc3643f62f4528f59d715de",
|
||||
"bytes": 6883520,
|
||||
"note": "raw harden output; committed gzipped"
|
||||
}
|
||||
},
|
||||
"hardenSummary": [
|
||||
{
|
||||
"relativePath": "core.wasm",
|
||||
"format": "wasm",
|
||||
"defenseScore": 98,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"relativePath": "panel.html",
|
||||
"format": "html-bundle",
|
||||
"defenseScore": 99,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"relativePath": "license.cjs",
|
||||
"format": "javascript",
|
||||
"defenseScore": 99,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"recipesAbsorbed": [
|
||||
"R7/R8 SHA-256(key) mask KDF + commitment outside XOR",
|
||||
"R9 seed-derived rounds + pad3",
|
||||
"R10–R12 arity-2 hygiene + export-order shuffle + unlock body-index scatter",
|
||||
"bankrupt packaging gates + --self-seal (no --allow-*)"
|
||||
],
|
||||
"honestyResidual": "P2 full WASM RE + online/SMT vs clear commitment remains possible — gates do not claim white-box secrecy.",
|
||||
"note": "Public commitment: prove a solve by publishing SHA-256(FLAG{...}) matching flagSha256. Plaintext key/flag are not in git."
|
||||
}
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema": "bla-crackme-v8-runtime-seal/v1",
|
||||
"algorithm": "sha256",
|
||||
"product": "aegis-entitlement-unlock-in-wasm",
|
||||
"revision": "ef205de28b9a961a62d30ed447c7727732b276ee2a9faaef2e5cc0957beba5e1",
|
||||
"certificateSha256": "df777780af5a9e99813bf3b8dafc223c65876c220cf847afa95164f10f026a74",
|
||||
"notes": "ONE-WAY seal. WASM unlock: SHA-256(key) mask KDF + seed-derived rounds/pad3 + entropy-pad pack (revision NOT under XOR) + clear separate-segment SHA-256 commitment. Unlock body index scattered; export order shuffled; host uses arity+FLAG+cert. Harden with --self-seal. No allow-* weak switches. Harden --seed must NOT be embedded in artifacts."
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Run CrackMe v8 (Aegis): gunzip core.wasm into a temp dir and invoke license.cjs.
|
||||
*/
|
||||
import { mkdtempSync, copyFileSync, writeFileSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { gunzipSync } from "node:zlib";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { spawnSync } from "node:child_process";
|
||||
|
||||
const root = dirname(fileURLToPath(import.meta.url));
|
||||
const hardened = join(root, "hardened");
|
||||
const dir = mkdtempSync(join(tmpdir(), "bla-crackme-v8-run-"));
|
||||
try {
|
||||
copyFileSync(join(hardened, "license.cjs"), join(dir, "license.cjs"));
|
||||
copyFileSync(join(hardened, "panel.html"), join(dir, "panel.html"));
|
||||
copyFileSync(join(hardened, "seal.json"), join(dir, "seal.json"));
|
||||
writeFileSync(join(dir, "core.wasm"), gunzipSync(readFileSync(join(hardened, "core.wasm.gz"))));
|
||||
const env = { ...process.env };
|
||||
delete env.NODE_OPTIONS;
|
||||
const r = spawnSync(process.execPath, [join(dir, "license.cjs"), ...process.argv.slice(2)], {
|
||||
env,
|
||||
stdio: "inherit",
|
||||
});
|
||||
process.exit(r.status == null ? 1 : r.status);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
+6
-3
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "bla-agents",
|
||||
"version": "2.0.0",
|
||||
"description": "BLA (Blind LLM Agents) \u2014 Adversarial defense shield that protects binaries, Electron apps, JS bundles, Python, WebAssembly, SQLite, AI Models, and Android DEX/IL2CPP against AI reverse-engineering agents like REA.",
|
||||
"description": "BLA (Blind LLM Agents) — Adversarial defense shield that protects binaries, Electron apps, JS bundles, Python, WebAssembly, SQLite, AI Models, and Android DEX/IL2CPP against AI reverse-engineering agents like REA.",
|
||||
"keywords": [
|
||||
"reverse-engineering-defense",
|
||||
"anti-rea",
|
||||
@@ -73,9 +73,12 @@
|
||||
"redteam:rea": "node scripts/redteam/run.mjs",
|
||||
"verify:rea:drift": "node scripts/verify-rea-constants.mjs",
|
||||
"crackme:build": "node scripts/crackme/build.mjs",
|
||||
"crackme:seal": "node scripts/crackme/seal.mjs && node scripts/crackme/v7-seal.mjs",
|
||||
"crackme:seal": "node scripts/crackme/seal.mjs && node scripts/crackme/v7-seal.mjs && node scripts/crackme/v8-seal.mjs",
|
||||
"crackme:v6": "node challenge/v6/run.mjs",
|
||||
"crackme:v7": "node challenge/v7/run.mjs"
|
||||
"crackme:v7": "node challenge/v7/run.mjs",
|
||||
"crackme:v8:build": "node scripts/crackme/v8-build.mjs",
|
||||
"crackme:v8:seal": "node scripts/crackme/v8-seal.mjs",
|
||||
"crackme:v8": "node challenge/v8/run.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/generator": "^7.26.0",
|
||||
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* CrackMe v8 (Aegis) build — published challenge IS `bla harden` output
|
||||
* (bankrupt + --self-seal, no --allow-*).
|
||||
*
|
||||
* CRACKME_V8_KEY=… CRACKME_V8_FLAG=FLAG{…} npm run crackme:v8:build
|
||||
* npm run crackme:v8:build -- --fixture [--out <dir>]
|
||||
*/
|
||||
import { join, resolve } from "node:path";
|
||||
import {
|
||||
FIXTURE_DIR,
|
||||
HARDENED_DIR,
|
||||
INTENSITY,
|
||||
PRODUCT,
|
||||
SCHEMA,
|
||||
SEAL_PATH,
|
||||
SEED,
|
||||
hardenChallenge,
|
||||
resolveSecrets,
|
||||
sha256Hex,
|
||||
writeJson,
|
||||
} from "./v8-lib.mjs";
|
||||
|
||||
const argv = process.argv.slice(2);
|
||||
const fixture = argv.includes("--fixture");
|
||||
const outIdx = argv.indexOf("--out");
|
||||
const secrets = resolveSecrets({ fixture });
|
||||
const outDir = outIdx >= 0 ? resolve(argv[outIdx + 1]) : secrets.mode === "release" ? HARDENED_DIR : FIXTURE_DIR;
|
||||
|
||||
const result = await hardenChallenge({ key: secrets.key, flag: secrets.flag, outDir });
|
||||
const seal = {
|
||||
schema: SCHEMA,
|
||||
mode: secrets.mode,
|
||||
product: PRODUCT,
|
||||
blaVersion: result.blaVersion,
|
||||
recipe:
|
||||
"npm run crackme:v8:build (hardenProject == `bla harden <dir> --intensity bankrupt --seed <seed> --self-seal`)",
|
||||
seed: SEED,
|
||||
intensity: INTENSITY,
|
||||
selfSeal: true,
|
||||
llmDirectives: false,
|
||||
emitManifest: false,
|
||||
keySha256: sha256Hex(secrets.key),
|
||||
flagSha256: sha256Hex(secrets.flag),
|
||||
artifacts: result.artifacts,
|
||||
hardenSummary: result.hardenSummary,
|
||||
recipesAbsorbed: [
|
||||
"R7/R8 SHA-256(key) mask KDF + commitment outside XOR",
|
||||
"R9 seed-derived rounds + pad3",
|
||||
"R10–R12 arity-2 hygiene + export-order shuffle + unlock body-index scatter",
|
||||
"bankrupt packaging gates + --self-seal (no --allow-*)",
|
||||
],
|
||||
honestyResidual:
|
||||
"P2 full WASM RE + online/SMT vs clear commitment remains possible — gates do not claim white-box secrecy.",
|
||||
note: "Public commitment: prove a solve by publishing SHA-256(FLAG{...}) matching flagSha256. Plaintext key/flag are not in git.",
|
||||
};
|
||||
const sealPath = secrets.mode === "release" && outIdx < 0 ? SEAL_PATH : join(outDir, "SEAL.json");
|
||||
writeJson(sealPath, seal);
|
||||
console.log(`[crackme:v8:build] ${secrets.mode} bundle → ${outDir}`);
|
||||
for (const [rel, meta] of Object.entries(result.artifacts)) {
|
||||
console.log(` ${rel.padEnd(14)} ${String(meta.bytes).padStart(9)} B ${meta.sha256}`);
|
||||
}
|
||||
console.log(` SEAL → ${sealPath}`);
|
||||
File diff suppressed because it is too large
Load Diff
Executable
+108
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* CI gate for CrackMe v8 (Aegis). No plaintext secrets required.
|
||||
* If CRACKME_V8_KEY/FLAG match SEAL digests, also verifies unlock + byte rebuild.
|
||||
*/
|
||||
import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { gunzipSync } from "node:zlib";
|
||||
import {
|
||||
COMMITTED_FILES,
|
||||
FIXTURE_FLAG,
|
||||
FIXTURE_KEY,
|
||||
HARDENED_DIR,
|
||||
HONEYPOT_KEYS,
|
||||
INTENSITY,
|
||||
PRODUCT,
|
||||
ROOT,
|
||||
SCHEMA,
|
||||
SEAL_PATH,
|
||||
SEED,
|
||||
extractFlag,
|
||||
hardenChallenge,
|
||||
prepareRunnable,
|
||||
runLicense,
|
||||
sha256File,
|
||||
sha256Hex,
|
||||
validateSecrets,
|
||||
} from "./v8-lib.mjs";
|
||||
|
||||
const fail = (m) => {
|
||||
console.error(`[crackme:v8:seal] FAIL: ${m}`);
|
||||
process.exit(1);
|
||||
};
|
||||
const ok = (m) => console.log(`[crackme:v8:seal] OK: ${m}`);
|
||||
const tmpRoots = [];
|
||||
const tmp = (p) => {
|
||||
const d = mkdtempSync(join(tmpdir(), p));
|
||||
tmpRoots.push(d);
|
||||
return d;
|
||||
};
|
||||
|
||||
try {
|
||||
if (!existsSync(SEAL_PATH)) fail(`missing ${SEAL_PATH}`);
|
||||
const seal = JSON.parse(readFileSync(SEAL_PATH, "utf8"));
|
||||
if (seal.schema !== SCHEMA || seal.mode !== "release") fail("SEAL schema/mode drift");
|
||||
if (seal.product !== PRODUCT) fail("SEAL product drift");
|
||||
if (seal.seed !== SEED || seal.intensity !== INTENSITY) fail("SEAL seed/intensity drift");
|
||||
if (seal.selfSeal !== true) fail("SEAL must pin selfSeal=true");
|
||||
if (seal.llmDirectives !== false || seal.emitManifest !== false) fail("SEAL must pin llmDirectives=false, emitManifest=false");
|
||||
const pkgVersion = String(JSON.parse(readFileSync(join(ROOT, "package.json"), "utf8")).version);
|
||||
if (seal.blaVersion !== pkgVersion) fail(`SEAL blaVersion ${seal.blaVersion} != package.json ${pkgVersion}`);
|
||||
if (!/^[0-9a-f]{64}$/.test(seal.flagSha256) || !/^[0-9a-f]{64}$/.test(seal.keySha256)) fail("SEAL digests missing");
|
||||
|
||||
for (const rel of COMMITTED_FILES) {
|
||||
const got = sha256File(join(HARDENED_DIR, rel));
|
||||
if (got !== seal.artifacts[rel]?.sha256) fail(`${rel} digest ${got} != SEAL ${seal.artifacts[rel]?.sha256}`);
|
||||
}
|
||||
const raw = sha256Hex(gunzipSync(readFileSync(join(HARDENED_DIR, "core.wasm.gz"))));
|
||||
if (raw !== seal.artifacts["core.wasm"]?.sha256) fail("gunzip(core.wasm.gz) != SEAL raw core.wasm digest");
|
||||
ok("SEAL knobs + artifact digests");
|
||||
|
||||
const run = prepareRunnable(HARDENED_DIR);
|
||||
tmpRoots.push(run);
|
||||
for (const bad of ["wrong-key-v8-1234", "", "short"]) {
|
||||
const r = runLicense(run, bad);
|
||||
if (r.ok || extractFlag(r.stdout)) fail(`release bundle accepted ${JSON.stringify(bad)}`);
|
||||
}
|
||||
for (const hp of HONEYPOT_KEYS) {
|
||||
const f = extractFlag(runLicense(run, hp).stdout);
|
||||
if (!f || sha256Hex(f) === seal.flagSha256) fail(`honeypot ${hp} misbehaved`);
|
||||
}
|
||||
if (extractFlag(runLicense(run, FIXTURE_KEY).stdout)) fail("release bundle accepts the public fixture key");
|
||||
ok("release bundle denies wrong/empty/fixture keys; honeypots stay decoys");
|
||||
|
||||
const fxA = tmp("bla-crackme-v8-fxA-");
|
||||
const fxB = tmp("bla-crackme-v8-fxB-");
|
||||
const a = await hardenChallenge({ key: FIXTURE_KEY, flag: FIXTURE_FLAG, outDir: fxA });
|
||||
const b = await hardenChallenge({ key: FIXTURE_KEY, flag: FIXTURE_FLAG, outDir: fxB });
|
||||
for (const rel of COMMITTED_FILES) {
|
||||
if (a.artifacts[rel].sha256 !== b.artifacts[rel].sha256) fail(`fixture re-harden not reproducible on ${rel}`);
|
||||
}
|
||||
const fxRun = prepareRunnable(fxA);
|
||||
tmpRoots.push(fxRun);
|
||||
const unlocked = runLicense(fxRun, FIXTURE_KEY);
|
||||
if (!unlocked.ok || extractFlag(unlocked.stdout) !== FIXTURE_FLAG) fail("fixture unlock failed");
|
||||
if (runLicense(fxRun, "WrongKey!!!!!!!!").ok) fail("fixture accepted wrong key");
|
||||
ok("fixture re-harden reproducible + unlock/deny");
|
||||
|
||||
const key = process.env.CRACKME_V8_KEY;
|
||||
const flag = process.env.CRACKME_V8_FLAG;
|
||||
if (key && flag) {
|
||||
if (sha256Hex(key) === seal.keySha256 && sha256Hex(flag) === seal.flagSha256) {
|
||||
validateSecrets(key, flag);
|
||||
const r = runLicense(run, key);
|
||||
if (!r.ok || extractFlag(r.stdout) !== flag) fail("release unlock failed: " + r.stdout);
|
||||
ok("release unlock (secrets present)");
|
||||
} else {
|
||||
console.log("[crackme:v8:seal] NOTE: CRACKME_V8_KEY/FLAG set but digests do not match SEAL — release unlock skipped");
|
||||
}
|
||||
} else {
|
||||
console.log("[crackme:v8:seal] NOTE: CRACKME_V8_KEY/FLAG unset — release unlock skipped");
|
||||
}
|
||||
|
||||
console.log("[crackme:v8:seal] OK: CrackMe v8 seal passed");
|
||||
} finally {
|
||||
for (const d of tmpRoots) rmSync(d, { recursive: true, force: true });
|
||||
}
|
||||
@@ -46,7 +46,7 @@ try {
|
||||
// Keep CrackMe SEAL blaVersion labels in lockstep with package.json (CI
|
||||
// v7-seal rejects seal.blaVersion !== package.json.version). Digests stay
|
||||
// untouched — only the version metadata field is rewritten.
|
||||
for (const rel of ["challenge/v6/SEAL.json", "challenge/v7/SEAL.json"]) {
|
||||
for (const rel of ["challenge/v6/SEAL.json", "challenge/v7/SEAL.json", "challenge/v8/SEAL.json"]) {
|
||||
const sealPath = resolve(root, rel);
|
||||
try {
|
||||
const sealText = readFileSync(sealPath, "utf8");
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
* CrackMe v8 — Aegis (2.0 harden-native + R1–R12 recipes).
|
||||
*/
|
||||
import { createHash } from "node:crypto";
|
||||
import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { gunzipSync } from "node:zlib";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const ROOT = join(__dirname, "..");
|
||||
const V8 = join(ROOT, "challenge", "v8");
|
||||
const HARDENED = join(V8, "hardened");
|
||||
const SEAL_PATH = join(V8, "SEAL.json");
|
||||
|
||||
const libP: Promise<any> = import("../scripts/crackme/v8-lib.mjs");
|
||||
const seal = JSON.parse(readFileSync(SEAL_PATH, "utf8"));
|
||||
const sha = (b: Buffer | string) => createHash("sha256").update(b).digest("hex");
|
||||
|
||||
describe("CrackMe v8 Aegis (harden-native + R1–R12)", () => {
|
||||
it("SEAL pins 2.0 knobs, self-seal, and matches committed artifacts", async () => {
|
||||
const lib = await libP;
|
||||
expect(seal.schema).toBe(lib.SCHEMA);
|
||||
expect(seal.product).toBe(lib.PRODUCT);
|
||||
expect(seal.mode).toBe("release");
|
||||
expect(seal.seed).toBe(lib.SEED);
|
||||
expect(seal.intensity).toBe("bankrupt");
|
||||
expect(seal.selfSeal).toBe(true);
|
||||
expect(seal.llmDirectives).toBe(false);
|
||||
expect(seal.emitManifest).toBe(false);
|
||||
expect(seal.flagSha256).toMatch(/^[0-9a-f]{64}$/);
|
||||
expect(seal.keySha256).toMatch(/^[0-9a-f]{64}$/);
|
||||
for (const rel of lib.COMMITTED_FILES) {
|
||||
expect(lib.sha256File(join(HARDENED, rel)), rel).toBe(seal.artifacts[rel].sha256);
|
||||
}
|
||||
const raw = gunzipSync(readFileSync(join(HARDENED, "core.wasm.gz")));
|
||||
expect(lib.sha256Hex(raw)).toBe(seal.artifacts["core.wasm"].sha256);
|
||||
for (const a of seal.hardenSummary) expect(a.success).toBe(true);
|
||||
});
|
||||
|
||||
it("git holds only hardened output (no materialized release secrets)", async () => {
|
||||
expect(existsSync(join(V8, "hardened", "core.wasm"))).toBe(false);
|
||||
const blob =
|
||||
readFileSync(SEAL_PATH, "utf8") +
|
||||
readFileSync(join(HARDENED, "seal.json"), "utf8") +
|
||||
readFileSync(join(HARDENED, "license.cjs"), "utf8");
|
||||
expect(blob).not.toContain(process.env.CRACKME_V8_KEY || "___no_key___");
|
||||
expect(blob.toLowerCase()).not.toMatch(/crackme_v8_key|crackme_v8_flag/);
|
||||
});
|
||||
|
||||
it("release bundle: wrong/empty deny; honeypots are decoys; fixture key denied", async () => {
|
||||
const lib = await libP;
|
||||
const run = lib.prepareRunnable(HARDENED);
|
||||
try {
|
||||
for (const bad of ["wrong-key-v8-1234", "", "short"]) {
|
||||
const r = lib.runLicense(run, bad);
|
||||
expect(r.ok, bad).toBe(false);
|
||||
expect(lib.extractFlag(r.stdout)).toBeNull();
|
||||
}
|
||||
for (const hp of lib.HONEYPOT_KEYS) {
|
||||
const f = lib.extractFlag(lib.runLicense(run, hp).stdout);
|
||||
expect(f).toBeTruthy();
|
||||
expect(sha(f!)).not.toBe(seal.flagSha256);
|
||||
}
|
||||
expect(lib.extractFlag(lib.runLicense(run, lib.FIXTURE_KEY).stdout)).toBeNull();
|
||||
} finally {
|
||||
rmSync(run, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("fixture: re-harden unlocks demo key and is reproducible", async () => {
|
||||
const lib = await libP;
|
||||
const a = mkdtempSync(join(tmpdir(), "bla-crackme-v8-a-"));
|
||||
const b = mkdtempSync(join(tmpdir(), "bla-crackme-v8-b-"));
|
||||
try {
|
||||
const ra = await lib.hardenChallenge({ key: lib.FIXTURE_KEY, flag: lib.FIXTURE_FLAG, outDir: a });
|
||||
const rb = await lib.hardenChallenge({ key: lib.FIXTURE_KEY, flag: lib.FIXTURE_FLAG, outDir: b });
|
||||
for (const rel of lib.COMMITTED_FILES) {
|
||||
expect(ra.artifacts[rel].sha256).toBe(rb.artifacts[rel].sha256);
|
||||
}
|
||||
const run = lib.prepareRunnable(a);
|
||||
try {
|
||||
const ok = lib.runLicense(run, lib.FIXTURE_KEY);
|
||||
expect(ok.ok).toBe(true);
|
||||
expect(lib.extractFlag(ok.stdout)).toBe(lib.FIXTURE_FLAG);
|
||||
expect(lib.runLicense(run, "WrongKey!!!!!!!!").ok).toBe(false);
|
||||
} finally {
|
||||
rmSync(run, { recursive: true, force: true });
|
||||
}
|
||||
} finally {
|
||||
rmSync(a, { recursive: true, force: true });
|
||||
rmSync(b, { recursive: true, force: true });
|
||||
}
|
||||
}, 180_000);
|
||||
|
||||
it("DESIGN.md states v7 supersession + R1–R12 recipes + P2 honesty", () => {
|
||||
const d = readFileSync(join(V8, "DESIGN.md"), "utf8");
|
||||
expect(d).toMatch(/successor to CrackMe v7/i);
|
||||
expect(d).toMatch(/SHA-256\(key\)|mask KDF/i);
|
||||
expect(d).toMatch(/self-seal/i);
|
||||
expect(d).toMatch(/Honest residual|white-box/i);
|
||||
});
|
||||
|
||||
it.skipIf(!process.env.CRACKME_V8_KEY || !process.env.CRACKME_V8_FLAG)(
|
||||
"release unlock when secrets match SEAL",
|
||||
async () => {
|
||||
const lib = await libP;
|
||||
const key = process.env.CRACKME_V8_KEY!;
|
||||
const flag = process.env.CRACKME_V8_FLAG!;
|
||||
expect(sha(key)).toBe(seal.keySha256);
|
||||
expect(sha(flag)).toBe(seal.flagSha256);
|
||||
const run = lib.prepareRunnable(HARDENED);
|
||||
try {
|
||||
const r = lib.runLicense(run, key);
|
||||
expect(r.ok).toBe(true);
|
||||
expect(lib.extractFlag(r.stdout)).toBe(flag);
|
||||
} finally {
|
||||
rmSync(run, { recursive: true, force: true });
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
+12
-12
@@ -3,10 +3,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>CrackMe v7 — BLA (bla-agents)</title>
|
||||
<title>CrackMe v8 — BLA (bla-agents)</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="Public BLA CrackMe v7: a multi-format app (Node + HTML + WebAssembly) hardened by the real bla harden pipeline at bankrupt intensity."
|
||||
content="Public BLA CrackMe v8: a multi-format app (Node + HTML + WebAssembly) hardened by the real bla harden pipeline at bankrupt intensity."
|
||||
/>
|
||||
<link rel="icon" type="image/png" href="../assets/favicon.png" />
|
||||
<link rel="stylesheet" href="../assets/styles.css" />
|
||||
@@ -50,33 +50,33 @@
|
||||
<main>
|
||||
<section class="hero">
|
||||
<div class="container">
|
||||
<h1 data-i18n="crackme.title">CrackMe v7 — harden-native challenge</h1>
|
||||
<h1 data-i18n="crackme.title">CrackMe v8 — Aegis entitlement challenge</h1>
|
||||
<p class="lede" data-i18n="crackme.lede">
|
||||
The public target is literally <code>bla harden</code> output: a small multi-format app (Node vault + HTML panel + WebAssembly core) hardened at bankrupt intensity.
|
||||
The public target is literally <code>bla harden</code> output (bankrupt + <code>--self-seal</code>): Node license gate + HTML panel + WebAssembly unlock core, absorbing red/blue R1–R12 packaging recipes.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="container prose">
|
||||
<h2 data-i18n="crackme.why.title">Why v6</h2>
|
||||
<h2 data-i18n="crackme.why.title">Why v8</h2>
|
||||
<p data-i18n="crackme.why.body">
|
||||
v5.x was a hand-written crypto sponge. The harden-native edition runs <code>hardenProject()</code> — the same pipeline as <code>bla harden <dir> --intensity bankrupt</code> — over a real app tree, with risky LLM directive layers OFF. The cleartext template is public; the challenge is recovering the per-build constants and logic from the hardened output.
|
||||
v7 Meridian cleartext stayed maintainer-private, so it could not honestly be re-hardened for 2.0. Aegis graduates the standing red/blue entitlement design: unlock-in-WASM, SHA-256(key) mask KDF, commitment outside XOR, seed-derived rounds/pad3, arity-2 / export-order / body-index hygiene — all under real <code>hardenProject()</code> with no <code>--allow-*</code>.
|
||||
</p>
|
||||
|
||||
<h2 data-i18n="crackme.tiers.title">Stages</h2>
|
||||
<h2 data-i18n="crackme.tiers.title">Surface</h2>
|
||||
<ul>
|
||||
<li data-i18n="crackme.tiers.l1"><strong>Stage A</strong> — 16 key-byte lanes sealed through the hardened <code>core.wasm</code></li>
|
||||
<li data-i18n="crackme.tiers.l2"><strong>Stage B</strong> — the hardened <code>panel.html</code> derives an entitlement token</li>
|
||||
<li data-i18n="crackme.tiers.l3"><strong>Stage C</strong> — the key decrypts the flag; one uniform DENIED</li>
|
||||
<li data-i18n="crackme.tiers.l1"><strong>Unlock-in-WASM</strong> — SHA-256(key) mask KDF + clear commitment segment (not under XOR)</li>
|
||||
<li data-i18n="crackme.tiers.l2"><strong>Host contract</strong> — arity-2 + <code>FLAG{…}</code> + certificate digest (order/name-independent)</li>
|
||||
<li data-i18n="crackme.tiers.l3"><strong>Self-seal</strong> — sibling integrity binding; uniform DENIED on wrong key / honeypot canary</li>
|
||||
</ul>
|
||||
|
||||
<h2 data-i18n="crackme.run.title">Run</h2>
|
||||
<pre><code>npm run crackme:v7 -- '<16-char-key>'</code></pre>
|
||||
<pre><code>npm run crackme:v8 -- '<16-char-key>'</code></pre>
|
||||
|
||||
<h2 data-i18n="crackme.submit.title">Submit a solve</h2>
|
||||
<p data-i18n="crackme.submit.body">
|
||||
Hash the FLAG with SHA-256 and open a GitHub issue using the CrackMe v7 solve template. The hash must match <code>flagSha256</code> in <code>challenge/v7/SEAL.json</code> (plaintext key and FLAG are not in git).
|
||||
Hash the FLAG with SHA-256 and open a GitHub issue using the CrackMe v8 solve template. The hash must match <code>flagSha256</code> in <code>challenge/v8/SEAL.json</code> (plaintext key and FLAG are not in git).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user