Skip to content

armgit / bla

Public Imported from GitHub
0

🛡️ BLA (Blind LLM Agents) — Adversarial defense shield that protects binaries, Electron apps, JS bundles, Python, and WebAssembly against AI reverse-engineering agents like REA. Poison -> Exhaust -> Hallucinate.

feat(challenge): CrackMe v7 Meridian — real app, chained ARX, self-integrity

Timo Zhang19679467b8e7
diff --git a/.github/ISSUE_TEMPLATE/crackme-v7-solve.yml b/.github/ISSUE_TEMPLATE/crackme-v7-solve.yml
new file mode 100644
index 0000000..1d9431c
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/crackme-v7-solve.yml
@@ -0,0 +1,44 @@
+name: CrackMe v7 solve (Meridian)
+description: Submit a proof-of-solve for Meridian (CrackMe v7)
+title: "CrackMe v7 solve: <short method>"
+labels: ["crackme", "challenge"]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Prove a break of [Meridian / CrackMe v7](https://github.com/qybaihe/bla/tree/main/challenge/v7) by posting the **SHA-256 of the activation certificate** (not necessarily the raw certificate). It must match `certSha256` in `challenge/v7/SEAL.json`.
+ - type: dropdown
+ id: surface
+ attributes:
+ label: Primary surface used
+ options:
+ - Executed hardened app (intended)
+ - Rehosted integrity + fingerprint offline
+ - Pure-static recovery (no execute)
+ - BLA product gap / generic harden bypass
+ validations:
+ required: true
+ - type: input
+ id: cert_sha256
+ attributes:
+ label: SHA-256 of the activation certificate
+ description: Lowercase hex. Prefer not to paste the raw certificate unless you intend public disclosure.
+ placeholder: a1b2c3…
+ validations:
+ required: true
+ - type: textarea
+ id: method
+ attributes:
+ label: Method notes
+ description: Short write-up (tooling, whether chained ARX / self-integrity / env binding mattered, suggested product fix). Link related issues if this was a generic harden bypass.
+ validations:
+ required: true
+ - type: checkboxes
+ id: honesty
+ attributes:
+ label: Confirmation
+ options:
+ - label: I did not use a leaked maintainer secret / CI secret.
+ required: true
+ - label: I understand BLA does not claim immunity to interactive human RE.
+ required: true
diff --git a/.gitignore b/.gitignore
index 1f6a099..91d01d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,6 @@ challenge/v6/artifacts/commitment.fixture.json
# CrackMe v6 (harden-native): fixture builds + raw (ungzipped) hardened WASM stay local
challenge/v6/.fixture/
challenge/v6/hardened/core.wasm
+
+# CrackMe v7 private fixture
+challenge/v7/.fixture/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1f8e01c..0639df8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Added
+
+- **CrackMe v7 — Meridian**: real offline engineering calculator (`calc` /
+ `convert` / `stats` / `license activate`) shipped as `bla harden` bankrupt
+ output. Whole-key chained ARX (no independent lanes), runtime self-integrity
+ over five modules, feature fingerprint + environment binding, sealed
+ certificate in `data/catalog.json`. Design in `challenge/v7/DESIGN.md`.
+ Supersedes v6 as the product challenge (v6 retained under `challenge/v6/`
+ as the 1.6.1 interim snapshot).
+
## [1.6.2] — 2026-11-01
### Added
diff --git a/challenge/README.md b/challenge/README.md
index 75a338d..6a71054 100644
--- a/challenge/README.md
+++ b/challenge/README.md
@@ -1,19 +1,24 @@
-# 🛡️ BLA CrackMe — 公开 Counter-REA 挑战 / Public Challenge
+# BLA CrackMe
-## 当前:v6 Harden-Native(推荐)
+BLA 对外发布的逆向 / 防护挑战。当前主挑战是 **v7 Meridian**。
-**→ [`v6/README.md`](./v6/README.md)**
+## v7 — Meridian(当前)
-v6 的靶机就是 `bla harden` 的真实产物:Node vault + HTML 面板 + WebAssembly 核心组成的多格式小应用,
-以 `bankrupt` 强度、固定种子、**关闭高风险 LLM 指令层** 加固后原样发布。明文模板公开,挑战是从加固产物中还原每次构建的常量与逻辑。
+真实小型工程计算器,经 `bla harden`(bankrupt、llm-directives OFF)硬化后发布。
+通过 `license activate` 解锁 Meridian Pro,打印激活证书。
```bash
-npm run crackme:v6 -- '<16位密钥>'
+npm run crackme:v7 -- calc "sqrt(2)*sin(pi/4)"
+npm run crackme:v7 -- license activate 'XXXXX-XXXXX-XXXXX-XXXXX'
```
-通关证明:`SHA-256(FLAG{...})` 等于 [`v6/SEAL.json`](./v6/SEAL.json) 中的 `flagSha256`(仓库内无明文密钥 / FLAG)。
+设计说明:[`v7/DESIGN.md`](./v7/DESIGN.md) · 承诺摘要:[`v7/SEAL.json`](./v7/SEAL.json)
-## 历史归档
+## 历史
-- [`archive/v6-tiered-protect/`](./archive/v6-tiered-protect/) — v6 初稿(PR #38):单文件 L1/L2/L3 protect 档位,已被 harden-native 版取代。
-- [`archive/v5/`](./archive/v5/) — v5.2 手写 Cognitive-Armor 海绵,仅供历史参考。
+| 版本 | 状态 | 说明 |
+|---|---|---|
+| v7 Meridian | **当前** | 真实应用 + 整钥链式 ARX + 自完整性 |
+| v6 Harden-Native | 快照(1.6.1) | `challenge/v6/`,已被 v7 取代 |
+| v6-tiered-protect | 归档 | `challenge/archive/v6-tiered-protect/`(#38) |
+| v5.2 | 归档 | `challenge/archive/v5/` |
diff --git a/challenge/v7/DESIGN.md b/challenge/v7/DESIGN.md
new file mode 100644
index 0000000..6035da6
--- /dev/null
+++ b/challenge/v7/DESIGN.md
@@ -0,0 +1,125 @@
+# CrackMe v7 — Meridian Design
+
+> Status: **successor to CrackMe v6**. v6 (harden-native vault) shipped in
+> bla-agents 1.6.1 as an interim snapshot and is retained under
+> `challenge/v6/` for history; it is **not** the product challenge anymore.
+
+## Product framing
+
+Meridian is a small offline engineering calculator:
+
+| Command | Behavior |
+|---|---|
+| `calc <expr>` | recursive-descent expression engine (`+ - * / % ^ !`, functions, constants) |
+| `convert <v> <from> <to>` | unit conversion via `data/catalog.json` |
+| `stats <n…>` | descriptive statistics |
+| `units` / `version` | catalog / version |
+| `license activate <KEY>` | Meridian Pro activation |
+
+The public prize is the **activation certificate** printed on success. The
+challenge never uses the word "flag" in product copy, so AI reverse agents
+are not steered by CTF vocabulary. Secrets are product mechanisms
+(revision digest + sealed certificate in the unit catalog), not an obvious
+`FLAG{…}` gate.
+
+## Why v6 failed (requirements this design answers)
+
+Owner writeup against v6, mapped to design constraints:
+
+| Critique | v7 response |
+|---|---|
+| 16 independent 1-byte lanes → ~95^1 search | **Chained 24–32 round ARX over the whole 20-symbol key.** Four 32-bit words packed from Crockford-base32; each round mixes all words with a seed-derived schedule. No per-lane oracle. |
+| `LANE_SALT` / numeric literals survive harden | **No compile-time challenge constants in JS.** Expected digest lives in `catalog.json` as data; schedule/pad come from a SHA-256 stream keyed by `(integrity ‖ fingerprint ‖ env)`. Literals that remain are BLA's own injected numerics, not the secret. |
+| WASM `mix`/`seal` kept export names, bit-identical to public ref | **No custom WASM crypto.** Crypto is ordinary `node:crypto` + ARX in JS, so BLA's JS shields (rename, string split, opaque predicates, decoys, anti-strip corpus) are the surface. |
+| Opaque `hrtime` predicates / poisoned lanes | Documented as a **BLA product gap** (see issue). Challenge still runs through real `hardenProject()`; we avoid `class` constructors that BLA currently renames inconsistently (see below). |
+| Static `solve.mjs` never executes the target | Activation **requires executing the hardened modules**: self-integrity hashes the five `.cjs` files at runtime; schedule seed binds that hash + a live feature fingerprint + an environment note. Pure static dumps of constants are insufficient. |
+| No self-integrity / anti-debug | `measure()` SHA-256s all five modules; `environmentNote()` records inspector / `--inspect` / `NODE_OPTIONS` / `Function#toString` native-code checks. Tamper or attach → different seed → reject. |
+| Decorative bankrupt score | Five real modules + catalog, all passed through `hardenProject({intensity:"bankrupt", llmDirectives:false})`. `SEAL.json` records per-file `defenseScore` from the live report. |
+
+## Architecture
+
+```
+challenge/v7/dist/
+ cli/meridian.cjs ← hardened CLI
+ core/expr.cjs ← hardened expression engine
+ core/units.cjs ← hardened unit converter (reads catalog.json)
+ core/stats.cjs ← hardened stats
+ core/license.cjs ← hardened activation (ARX + integrity + env)
+ data/catalog.json ← units + revision (expected digest) + signature (sealed cert)
+challenge/v7/SEAL.json ← public digests / knobs only
+```
+
+Cleartext sources and the release generator live **outside git** (maintainer
+store). Only hardened output + SEAL are public. That matches the product
+story: customers receive BLA-hardened builds, not the preimage.
+
+### Activation (happy path)
+
+1. Normalize key → 20 Crockford-base32 symbols → pack into four integers.
+2. `integrity = SHA256(pathᵢ ‖ bytesᵢ)` over the five hardened modules.
+3. `fingerprint =` deterministic transcript of six `calc` cases, six
+ `convert` cases, and one `stats` case (forces the other modules to run).
+4. `env = environmentNote()` (empty string when clean).
+5. `seed = SHA256("meridian/activation/v7" ‖ integrity ‖ fingerprint ‖ env)`.
+6. Expand `seed` into `{rounds ∈ [24,32], pad[4], plan[rounds]}` via a
+ counter-mode SHA-256 stream.
+7. 4-word ARX permute; hex-encode → must equal `catalog.revision`.
+8. Certificate keystream = SHA-256 stream over
+ `("meridian/certificate/v7" ‖ symbols ‖ seed)`; XOR with
+ `catalog.signature` → UTF-8 certificate.
+
+Wrong key, tampered module, missing sibling file, or debugger attach all
+collapse to the same `License rejected.` (exit 1). Bad format → usage
+(exit 2). No per-stage oracle.
+
+### Why multi-file + catalog
+
+- BLA's discovery prefers `bin/` as a build-output name and skips `lib/` on
+ supplemental walks. Layout uses `cli/` + `core/` so every module is
+ discovered and hardened (enforced by the private generator).
+- `data/catalog.json` is **not** JS, so BLA leaves it intact — the natural
+ place to publish the expected digest and sealed certificate without
+ embedding them as JS numeric/string literals that survive harden.
+
+### Known BLA gaps exercised (filed as product issues)
+
+1. **Numeric literals are not de-literalized** — still visible after
+ bankrupt harden (confirmed with a probe `0x9e3779b9`).
+2. **Class declaration vs. `new` sites can receive different renames**,
+ producing `ReferenceError` at runtime. Meridian uses factory functions
+ instead of `class` for that reason.
+3. **Export / local names** that cross `require()` boundaries are only
+ partially renamed; decoy injection can reference undefined constructors
+ on dead branches.
+4. A pure-static solver against harden output remains too strong if the
+ app puts recoverable constants in one file — hence integrity + live
+ fingerprint + env binding.
+
+These are product findings, not challenge decorations.
+
+## Honest scope
+
+Solvable by a determined reverse engineer who:
+
+1. Recovers the ARX / schedule logic from hardened `license.cjs`
+ (rename + string-split + opaque predicates; no lane independence).
+2. Runs (or faithfully rehosts) the integrity + fingerprint path so the
+ seed matches.
+3. Searches the 32^20 key space with the chained ARX — infeasible brute
+ force; requires algebraic / differential insight or a bug in the
+ binding, not 16 independent byte probes.
+
+Out of scope: attacking npm, GitHub, or unrelated software; enabling
+`--llm-directives`; extracting the maintainer store.
+
+## Maintainer recipe (private)
+
+```bash
+# in the private store tree (not in git):
+set -a; . secrets/crackme-v7-release.env; set +a
+BLA_ROOT=/path/to/bla node gen.mjs /path/to/bla/challenge/v7/dist
+# then fold build-info → SEAL.json (scripts/crackme/v7-seal.mjs --write-seal)
+```
+
+Fixture mode uses a public demo key for CI reproducibility without
+publishing the release secret.
diff --git a/challenge/v7/README.md b/challenge/v7/README.md
new file mode 100644
index 0000000..609bdb1
--- /dev/null
+++ b/challenge/v7/README.md
@@ -0,0 +1,17 @@
+# Meridian (CrackMe v7)
+
+Offline engineering calculator shipped as a **real `bla harden` output**.
+Activate Meridian Pro to print the activation certificate.
+
+```bash
+npm run crackme:v7 -- calc "sqrt(2)*sin(pi/4)"
+npm run crackme:v7 -- convert 10 mi km
+npm run crackme:v7 -- stats 4 8 15 16 23 42
+npm run crackme:v7 -- license activate 'XXXXX-XXXXX-XXXXX-XXXXX'
+```
+
+Rules, commitment digests, and the design rationale live in
+[`DESIGN.md`](./DESIGN.md) and [`SEAL.json`](./SEAL.json).
+
+This supersedes CrackMe v6 (still under `../v6/` for history; shipped in
+bla-agents 1.6.1 as an interim snapshot).
diff --git a/challenge/v7/SEAL.json b/challenge/v7/SEAL.json
new file mode 100644
index 0000000..1b819df
--- /dev/null
+++ b/challenge/v7/SEAL.json
@@ -0,0 +1,81 @@
+{
+ "schema": "bla-crackme-v7-seal/v1",
+ "mode": "release",
+ "product": "Meridian",
+ "blaVersion": "1.6.1",
+ "hardenSeedLabel": "bound-at-build-into-opaque-predicates",
+ "intensity": "bankrupt",
+ "llmDirectives": false,
+ "emitManifest": false,
+ "integrity": "7b9d28e5a5f957c2e585554894e0d04a95f5d9b68a94cdcf84f792d53d05dc77",
+ "source": {
+ "sha256": "8f64c0c58b705662f96ca9735225668cf8d18c2ee4966988ea62e9ca023f86e2",
+ "files": 8
+ },
+ "files": {
+ "cli/meridian.cjs": {
+ "sha256": "f388db79e3691a3923421f7dce0ae2fee59df86c4a8cdc3b66a1d1b990757333",
+ "bytes": 173770
+ },
+ "core/expr.cjs": {
+ "sha256": "1806b2155942d9e1a16e394eec1f6579ed17e8a9fb87251efd8003f865de4a01",
+ "bytes": 150724
+ },
+ "core/units.cjs": {
+ "sha256": "52c264dc8bc10e699476ad906ca92ebcedacd6250df6bcd11996c16adaa34100",
+ "bytes": 134950
+ },
+ "core/stats.cjs": {
+ "sha256": "f6583623fdb4ee74c6b1dad2fc08e3b553f25f963e8a85f01d508a9e6494edd3",
+ "bytes": 128247
+ },
+ "core/license.cjs": {
+ "sha256": "37390abce6c4275cc29f7b2f4eb7588bb215e007dd8cfaf9cee8b544fbaeb913",
+ "bytes": 173472
+ },
+ "data/catalog.json": {
+ "sha256": "7a11eb1da546ae0be9c9241385fb2a0fd6d244b63d7b411b77146dbf9277b552",
+ "bytes": 2692
+ }
+ },
+ "hardenSummary": [
+ {
+ "relativePath": "cli/meridian.cjs",
+ "format": "javascript",
+ "defenseScore": 99,
+ "success": true
+ },
+ {
+ "relativePath": "core/expr.cjs",
+ "format": "javascript",
+ "defenseScore": 99,
+ "success": true
+ },
+ {
+ "relativePath": "core/license.cjs",
+ "format": "javascript",
+ "defenseScore": 99,
+ "success": true
+ },
+ {
+ "relativePath": "core/stats.cjs",
+ "format": "javascript",
+ "defenseScore": 99,
+ "success": true
+ },
+ {
+ "relativePath": "core/units.cjs",
+ "format": "javascript",
+ "defenseScore": 99,
+ "success": true
+ }
+ ],
+ "notes": [
+ "No plaintext activation key or certificate is published.",
+ "data/catalog.json revision is the expected 128-bit ARX digest; signature is the certificate XOR keystream.",
+ "Self-integrity hashes the five hardened .cjs modules; tampering any byte invalidates activation."
+ ],
+ "keySha256": "dd207870ad4e5a88c9b543d818ca430d056eaace3259217c6fe46d0430e716ff",
+ "certSha256": "504640dadf9cc8a5db84f86db7744321389ba2e441fab7b041e3d3bc8d706546",
+ "hardenSeedSha256": "8bcb78e76c107127213409e0637808a50ab11323575f98347a652419ee80dd62"
+}
diff --git a/challenge/v7/run.mjs b/challenge/v7/run.mjs
new file mode 100644
index 0000000..156d51d
--- /dev/null
+++ b/challenge/v7/run.mjs
@@ -0,0 +1,14 @@
+#!/usr/bin/env node
+import { spawnSync } from "node:child_process";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+
+const root = dirname(fileURLToPath(import.meta.url));
+const cli = join(root, "dist", "cli", "meridian.cjs");
+const env = { ...process.env };
+delete env.NODE_OPTIONS;
+const r = spawnSync(process.execPath, [cli, ...process.argv.slice(2)], {
+ env,
+ stdio: "inherit",
+});
+process.exit(r.status == null ? 1 : r.status);
diff --git a/package.json b/package.json
index 24a397f..5ffa61a 100644
--- a/package.json
+++ b/package.json
@@ -73,8 +73,9 @@
"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",
- "crackme:v6": "node challenge/v6/run.mjs"
+ "crackme:seal": "node scripts/crackme/seal.mjs && node scripts/crackme/v7-seal.mjs",
+ "crackme:v6": "node challenge/v6/run.mjs",
+ "crackme:v7": "node challenge/v7/run.mjs"
},
"dependencies": {
"@babel/generator": "^7.26.0",
diff --git a/scripts/crackme/v7-seal.mjs b/scripts/crackme/v7-seal.mjs
new file mode 100644
index 0000000..7bec13c
--- /dev/null
+++ b/scripts/crackme/v7-seal.mjs
@@ -0,0 +1,97 @@
+#!/usr/bin/env node
+/**
+ * CI gate for CrackMe v7 (Meridian). No plaintext secrets required.
+ * If CRACKME_V7_KEY/CERT are set and match SEAL digests, also verifies unlock.
+ */
+import { createHash, createHmac } from "node:crypto";
+import { readFileSync, writeFileSync, existsSync, copyFileSync, mkdirSync, rmSync, mkdtempSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { spawnSync } from "node:child_process";
+
+const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
+const V7 = join(ROOT, "challenge", "v7");
+const DIST = join(V7, "dist");
+const SEAL = join(V7, "SEAL.json");
+const MODULES = ["cli/meridian.cjs", "core/expr.cjs", "core/units.cjs", "core/stats.cjs", "core/license.cjs"];
+const sha = (b) => createHash("sha256").update(b).digest("hex");
+
+function run(args, envExtra = {}) {
+ const env = { ...process.env, ...envExtra };
+ delete env.NODE_OPTIONS;
+ return spawnSync(process.execPath, [join(DIST, "cli", "meridian.cjs"), ...args], {
+ env,
+ encoding: "utf8",
+ cwd: DIST, // so relative data/ resolves the same as product use via run.mjs from v7 root — actually cli uses __dirname/../data
+ });
+}
+
+function must(cond, msg) {
+ if (!cond) throw new Error(msg);
+}
+
+const seal = JSON.parse(readFileSync(SEAL, "utf8"));
+must(seal.schema === "bla-crackme-v7-seal/v1", "bad schema");
+must(seal.intensity === "bankrupt" && seal.llmDirectives === false && seal.emitManifest === false, "knobs");
+must(seal.product === "Meridian", "product");
+
+for (const rel of [...MODULES, "data/catalog.json"]) {
+ const buf = readFileSync(join(DIST, rel));
+ const meta = seal.files[rel];
+ must(meta && meta.sha256 === sha(buf) && meta.bytes === buf.length, `digest mismatch ${rel}`);
+}
+const h = createHash("sha256");
+for (const rel of MODULES) {
+ h.update(rel);
+ h.update(readFileSync(join(DIST, rel)));
+}
+must(h.digest("hex") === seal.integrity, "integrity mismatch");
+console.log("[v7-seal] OK: SEAL knobs + file digests + integrity");
+
+// Functional surface still works.
+must(run(["calc", "(3+4)*5"]).stdout.trim() === "35", "calc");
+must(run(["convert", "212", "degF", "degC"]).stdout.trim().startsWith("100"), "convert");
+must(run(["stats", "4", "8", "15", "16", "23", "42"]).status === 0, "stats");
+console.log("[v7-seal] OK: calc/convert/stats");
+
+// Deny paths.
+must(run(["license", "activate", "AAAAA-AAAAA-AAAAA-AAAAA"]).status === 1, "wrong key should deny");
+must(run(["license", "activate", "short"]).status === 2, "short key format");
+console.log("[v7-seal] OK: deny + format");
+
+// Anti-tamper: flip one byte in a copy and expect deny even with (possibly correct) env key.
+{
+ const dir = mkdtempSync(join(tmpdir(), "meridian-tamper-"));
+ for (const rel of [...MODULES, "data/catalog.json"]) {
+ mkdirSync(dirname(join(dir, rel)), { recursive: true });
+ copyFileSync(join(DIST, rel), join(dir, rel));
+ }
+ const target = join(dir, "core", "expr.cjs");
+ const buf = Buffer.from(readFileSync(target));
+ buf[buf.length >> 1] ^= 0x01;
+ writeFileSync(target, buf);
+ const env = { ...process.env };
+ delete env.NODE_OPTIONS;
+ const r = spawnSync(process.execPath, [join(dir, "cli", "meridian.cjs"), "license", "activate", process.env.CRACKME_V7_KEY || "AAAAA-AAAAA-AAAAA-AAAAA"], { env, encoding: "utf8" });
+ must(r.status === 1, "tampered module must deny");
+ rmSync(dir, { recursive: true, force: true });
+ console.log("[v7-seal] OK: self-integrity rejects tamper");
+}
+
+const key = process.env.CRACKME_V7_KEY;
+const cert = process.env.CRACKME_V7_CERT;
+if (key && cert) {
+ if (sha(key) === seal.keySha256 && sha(cert) === seal.certSha256) {
+ const r = run(["license", "activate", key]);
+ must(r.status === 0, "release unlock failed: " + (r.stderr || r.stdout));
+ must(r.stdout.includes("Activation certificate: " + cert), "certificate mismatch");
+ console.log("[v7-seal] OK: release unlock (secrets present)");
+ } else {
+ console.log("[v7-seal] NOTE: CRACKME_V7_KEY/CERT set but digests do not match SEAL — release unlock skipped");
+ }
+} else {
+ console.log("[v7-seal] NOTE: CRACKME_V7_KEY/CERT unset — release unlock skipped");
+}
+
+console.log("[v7-seal] OK: CrackMe v7 seal passed");
diff --git a/tests/crackme-v7.test.ts b/tests/crackme-v7.test.ts
new file mode 100644
index 0000000..3730979
--- /dev/null
+++ b/tests/crackme-v7.test.ts
@@ -0,0 +1,104 @@
+import { createHash } from "node:crypto";
+import { readFileSync, existsSync, mkdtempSync, copyFileSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
+import { spawnSync } from "node:child_process";
+import { describe, expect, it } from "vitest";
+
+const ROOT = join(__dirname, "..");
+const V7 = join(ROOT, "challenge", "v7");
+const DIST = join(V7, "dist");
+const SEAL_PATH = join(V7, "SEAL.json");
+const MODULES = ["cli/meridian.cjs", "core/expr.cjs", "core/units.cjs", "core/stats.cjs", "core/license.cjs"] as const;
+const sha = (b: Buffer | string) => createHash("sha256").update(b).digest("hex");
+
+function run(args: string[], cwd = DIST) {
+ const env = { ...process.env };
+ delete env.NODE_OPTIONS;
+ return spawnSync(process.execPath, [join(cwd, "cli", "meridian.cjs"), ...args], {
+ env,
+ encoding: "utf8",
+ });
+}
+
+describe("CrackMe v7 Meridian", () => {
+ it("publishes SEAL with knobs, digests, no plaintext secrets", () => {
+ const seal = JSON.parse(readFileSync(SEAL_PATH, "utf8"));
+ expect(seal.schema).toBe("bla-crackme-v7-seal/v1");
+ expect(seal.product).toBe("Meridian");
+ expect(seal.intensity).toBe("bankrupt");
+ expect(seal.llmDirectives).toBe(false);
+ expect(seal.emitManifest).toBe(false);
+ expect(seal.keySha256).toMatch(/^[0-9a-f]{64}$/);
+ expect(seal.certSha256).toMatch(/^[0-9a-f]{64}$/);
+ const blob = readFileSync(SEAL_PATH, "utf8") + readFileSync(join(DIST, "data", "catalog.json"), "utf8");
+ expect(blob.toLowerCase()).not.toMatch(/flag\{/);
+ expect(blob).not.toMatch(/CRACKME_V7_KEY|CRACKME_V7_CERT/);
+ });
+
+ it("git hygiene: hardened modules match SEAL digests and integrity", () => {
+ const seal = JSON.parse(readFileSync(SEAL_PATH, "utf8"));
+ for (const rel of [...MODULES, "data/catalog.json"]) {
+ const buf = readFileSync(join(DIST, rel));
+ expect(seal.files[rel].sha256).toBe(sha(buf));
+ expect(seal.files[rel].bytes).toBe(buf.length);
+ }
+ const h = createHash("sha256");
+ for (const rel of MODULES) {
+ h.update(rel);
+ h.update(readFileSync(join(DIST, rel)));
+ }
+ expect(h.digest("hex")).toBe(seal.integrity);
+ });
+
+ it("product surface: calc / convert / stats / units", () => {
+ expect(run(["calc", "6!/(2^3)"]).stdout.trim()).toBe("90");
+ expect(run(["convert", "1", "mi", "km"]).status).toBe(0);
+ expect(run(["stats", "1", "2", "3"]).stdout).toMatch(/mean/);
+ expect(run(["units"]).stdout).toMatch(/length/);
+ });
+
+ it("license deny is uniform; format errors are distinct", () => {
+ expect(run(["license", "activate", "AAAAA-AAAAA-AAAAA-AAAAA"]).status).toBe(1);
+ expect(run(["license", "activate", "AAAAA-AAAAA-AAAAA-AAAAA"]).stderr).toMatch(/License rejected/);
+ expect(run(["license", "activate", "nope"]).status).toBe(2);
+ });
+
+ it("self-integrity: flipping a module byte denies activation", () => {
+ const dir = mkdtempSync(join(tmpdir(), "meridian-t-"));
+ try {
+ for (const rel of [...MODULES, "data/catalog.json"]) {
+ mkdirSync(dirname(join(dir, rel)), { recursive: true });
+ copyFileSync(join(DIST, rel), join(dir, rel));
+ }
+ const p = join(dir, "core", "stats.cjs");
+ const buf = Buffer.from(readFileSync(p));
+ buf[Math.min(100, buf.length - 1)] ^= 0x5a;
+ writeFileSync(p, buf);
+ expect(run(["license", "activate", "AAAAA-AAAAA-AAAAA-AAAAA"], dir).status).toBe(1);
+ } finally {
+ rmSync(dir, { recursive: true, force: true });
+ }
+ });
+
+ it("DESIGN.md exists and states the v6 supersession + chained ARX", () => {
+ const d = readFileSync(join(V7, "DESIGN.md"), "utf8");
+ expect(d).toMatch(/successor to CrackMe v6/i);
+ expect(d).toMatch(/Chained|ARX/i);
+ expect(d).toMatch(/self-integrity/i);
+ });
+
+ it.skipIf(!process.env.CRACKME_V7_KEY || !process.env.CRACKME_V7_CERT)(
+ "release unlock when secrets match SEAL",
+ () => {
+ const seal = JSON.parse(readFileSync(SEAL_PATH, "utf8"));
+ const key = process.env.CRACKME_V7_KEY!;
+ const cert = process.env.CRACKME_V7_CERT!;
+ expect(sha(key)).toBe(seal.keySha256);
+ expect(sha(cert)).toBe(seal.certSha256);
+ const r = run(["license", "activate", key]);
+ expect(r.status).toBe(0);
+ expect(r.stdout).toContain("Activation certificate: " + cert);
+ },
+ );
+});
diff --git a/website/assets/i18n.js b/website/assets/i18n.js
index 68db459..424c01e 100644
--- a/website/assets/i18n.js
+++ b/website/assets/i18n.js
@@ -115,21 +115,21 @@ window.BLA_I18N = {
"faq.q5": "What are BLA's honest limits?",
- "crackme.title": "CrackMe v6 — harden-native challenge",
+ "crackme.title": "CrackMe v7 (Meridian) — Meridian calculator challenge",
"crackme.lede": "The public target is literally `bla harden` output: a small multi-format app (Node vault + HTML panel + WebAssembly core) hardened at bankrupt intensity.",
"crackme.why.title": "Why v6",
- "crackme.why.body": "v5.x was a hand-written crypto sponge, and the first v6 draft published per-file protect tiers. The harden-native edition runs hardenProject() — the same pipeline as bla harden <dir> --intensity bankrupt — 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.",
+ "crackme.why.body": "v5.x was a hand-written crypto sponge, and the first v6 draft published per-file protect tiers. The Meridian calculator edition runs hardenProject() — the same pipeline as bla harden <dir> --intensity bankrupt — 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.",
"crackme.tiers.title": "Stages",
"crackme.tiers.l1": "Stage A — 16 key-byte lanes sealed through the hardened core.wasm (mix/seal hidden among decoy exports)",
"crackme.tiers.l2": "Stage B — the hardened panel.html derives an entitlement token the vault re-checks",
"crackme.tiers.l3": "Stage C — the key decrypts the flag; SHA-256 binds it to SEAL.json. One uniform DENIED — no per-stage oracle",
"crackme.run.title": "Run",
"crackme.submit.title": "Submit a solve",
- "crackme.submit.body": "Hash the FLAG with SHA-256 and open a GitHub issue using the CrackMe v6 solve template. The hash must match flagSha256 in challenge/v6/SEAL.json (plaintext key and FLAG are not in git).",
+ "crackme.submit.body": "Hash the FLAG with SHA-256 and open a GitHub issue using the CrackMe v7 (Meridian) solve template. The hash must match flagSha256 in challenge/v7/SEAL.json (plaintext key and FLAG are not in git).",
"crackme.cta": "Open challenge/v6 on GitHub",
"crackme.honest.title": "Honest scope",
"crackme.honest.body": "BLA raises cost for automated AI reverse-engineering agents and plants decoys. It does not claim immunity to patient interactive human reverse engineering.",
- "faq.a5": "BLA raises analyzer cost and plants decoys; it is not a magic anti-RE seal. Traditional interactive reverse engineering (Ghidra, Frida, LLDB, JADX sessions) is out of scope of the commodity REA red-team numbers. Try the public <a href=\"https://github.com/qybaihe/bla/tree/main/challenge/v6\">CrackMe v6</a> to see how far an agent gets against a BLA-hardened fixture.",
+ "faq.a5": "BLA raises analyzer cost and plants decoys; it is not a magic anti-RE seal. Traditional interactive reverse engineering (Ghidra, Frida, LLDB, JADX sessions) is out of scope of the commodity REA red-team numbers. Try the public <a href=\"https://github.com/qybaihe/bla/tree/main/challenge/v6\">CrackMe v7 (Meridian)</a> to see how far an agent gets against a BLA-hardened fixture.",
"faq.q4": "Does BLA preserve existing GGUF model tensors and binary checksums?",
"faq.a4": "Yes. <code>protectGgufBuffer</code> preserves all original GGUF v2/v3 KV entries and trailing tensor slices while appending metadata entries, and Android DEX protection recomputes both the 20-byte SHA-1 signature and Adler32 checksum."
},
@@ -246,21 +246,21 @@ window.BLA_I18N = {
"faq.a4": "不会。<code>protectGgufBuffer</code> 会完整保留 GGUF v2/v3 原有的全部 KV 键值对与尾部张量数据,Android DEX 处理模块则会自动重新计算 20 字节 SHA-1 签名与 Adler32 校验和。"
"faq.q5": "BLA 的诚实边界是什么?",
- "crackme.title": "CrackMe v6 — bla harden 原生产物挑战",
+ "crackme.title": "CrackMe v7 (Meridian) — bla harden 原生产物挑战",
"crackme.lede": "公开靶机就是 `bla harden` 的真实输出:一个多格式小应用(Node vault + HTML 面板 + WebAssembly 核心)在 bankrupt 强度下加固。",
"crackme.why.title": "为什么做 v6",
- "crackme.why.body": "v5.x 是手写密码海绵,v6 初稿是逐文件 protect 档位。harden-native 版用 hardenProject()(即 bla harden <dir> --intensity bankrupt)加固真实应用目录,高风险 LLM 指令层保持关闭。明文模板公开,挑战在于从加固产物中还原每次构建的常量与逻辑。",
+ "crackme.why.body": "v5.x 是手写密码海绵,v6 初稿是逐文件 protect 档位。Meridian calculator 版用 hardenProject()(即 bla harden <dir> --intensity bankrupt)加固真实应用目录,高风险 LLM 指令层保持关闭。明文模板公开,挑战在于从加固产物中还原每次构建的常量与逻辑。",
"crackme.tiers.title": "关卡",
"crackme.tiers.l1": "Stage A — 16 个密钥字节各自经过加固后的 core.wasm(mix/seal 藏在诱饵导出中)",
"crackme.tiers.l2": "Stage B — 加固后的 panel.html 推导授权令牌,vault 复核",
"crackme.tiers.l3": "Stage C — 密钥解密 FLAG,SHA-256 绑定 SEAL.json;统一 DENIED,无分关卡预言机",
"crackme.run.title": "运行",
"crackme.submit.title": "提交通关证明",
- "crackme.submit.body": "对 FLAG 做 SHA-256,用 CrackMe v6 solve 模板开 GitHub Issue。哈希须匹配 challenge/v6/SEAL.json 中的 flagSha256(仓库不含明文密钥与 FLAG)。",
+ "crackme.submit.body": "对 FLAG 做 SHA-256,用 CrackMe v7 (Meridian) solve 模板开 GitHub Issue。哈希须匹配 challenge/v7/SEAL.json 中的 flagSha256(仓库不含明文密钥与 FLAG)。",
"crackme.cta": "在 GitHub 打开 challenge/v6",
"crackme.honest.title": "诚实边界",
"crackme.honest.body": "BLA 提高自动化 AI 逆向成本并投放诱饵;并不宣称能对抗耐心的交互式人工逆向。",
- "faq.a5": "BLA 提高自动化分析成本并投放诱饵,并非万能反逆向封印。传统交互式逆向(Ghidra / Frida / LLDB / JADX 人工会话)不在现有 REA 红队数字范围内。欢迎挑战公开 <a href=\"https://github.com/qybaihe/bla/tree/main/challenge/v6\">CrackMe v6</a>,观察代理在 BLA 加固样本上的表现。",
+ "faq.a5": "BLA 提高自动化分析成本并投放诱饵,并非万能反逆向封印。传统交互式逆向(Ghidra / Frida / LLDB / JADX 人工会话)不在现有 REA 红队数字范围内。欢迎挑战公开 <a href=\"https://github.com/qybaihe/bla/tree/main/challenge/v6\">CrackMe v7 (Meridian)</a>,观察代理在 BLA 加固样本上的表现。",
},
"zh-TW": {
"nav.badge": "藍軍防護 v1.1",
diff --git a/website/crackme/index.html b/website/crackme/index.html
index ff4bf16..6e52fe9 100644
--- a/website/crackme/index.html
+++ b/website/crackme/index.html
@@ -3,10 +3,10 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>CrackMe v6 — BLA (bla-agents)</title>
+ <title>CrackMe v7 — BLA (bla-agents)</title>
<meta
name="description"
- content="Public BLA CrackMe v6: a multi-format app (Node + HTML + WebAssembly) hardened by the real bla harden pipeline at bankrupt intensity."
+ content="Public BLA CrackMe v7: 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,7 +50,7 @@
<main>
<section class="hero">
<div class="container">
- <h1 data-i18n="crackme.title">CrackMe v6 — harden-native challenge</h1>
+ <h1 data-i18n="crackme.title">CrackMe v7 — harden-native 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.
</p>
@@ -72,11 +72,11 @@
</ul>
<h2 data-i18n="crackme.run.title">Run</h2>
- <pre><code>npm run crackme:v6 -- '&lt;16-char-key&gt;'</code></pre>
+ <pre><code>npm run crackme:v7 -- '&lt;16-char-key&gt;'</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 v6 solve template. The hash must match <code>flagSha256</code> in <code>challenge/v6/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 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).
</p>
<p>