Repository navigation
feat: harden BLA against static de-blinding (string stub, decoy stems, runtime/digest/sourcemap/comment fingerprints) - #326
Merged
Conversation
… stub The runtime decoder emitted by encrypt-strings.ts carried a build-invariant arithmetic signature: the decode loop baked in fixed mixing constants (i*31, i*7+(j>>2), ks+i*73+j*19), so its whole body was byte-identical across every build apart from its already-seeded identifier names. A static de-blinding tool that recognizes BLA by structure rather than name can key on exactly that shape to locate and excise the string shield. Derive the per-entry keystream mixing constants from the seed and select one of several arithmetically-equivalent decoder shapes per file, so no single structural pattern matches every build. The emitter and the JS AST shield's marker recognizer are generated from one shared source (src/engine/string-decoder-stub.ts) so marker scrubbing stays in lockstep with whatever the emitter produces. Output stays deterministic per seed and runtime-equivalent; the standalone deriveEntryKeystream export keeps the legacy constants by default for backward compatibility. New tests execute the hardened output for both decoder shapes, assert the constants/shape vary across seeds (no invariant signature), and confirm the AST shield still recognizes and scrubs the _blaS/_blaT markers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RCFP34SDKAGEQLBGiD2sC5
…ic de-blinding)
Static de-blinding tools (LASIK-class) locate and tree-shake BLA's injected
decoy declarations by matching their top-level binding names against a fixed
catalog of stems. The AST shield's INJECTED_RAW_PREFIX_RE scrub — which runs
only over BLA's injected AST, never customer code — covered most decoy families
but missed two pure-decoy families that therefore survived into hardened output:
- semantic-honeypot's high-salience bait names (only verifyEnterpriseMasterLicense
was listed; the other seven survived); and
- prompt-completion-poison's `$<hex><Pascal>_<hex><index>` family (no shared stem,
so matched structurally).
Both are now scrubbed to fresh realistic identifiers that match neither the
stripper's stem catalog nor its `_[0-9a-f]{3,4}` tag heuristic, so its
declaration tree-shake no longer fires on them. Verified empirically against a
bankrupt-hardened artifact and the stripper's actual matcher logic.
Cognitive-armor's _interlockSafetyCorpus_ / _deriveContainmentCorpusDigest_ are
deliberately left name-visible: they are anti-strip tripwires whose corpus digest
is entangled into the runtime opaque seed, so removing them breaks the program by
design (tests/redteam-adversarial-bypass, crackme-v6, red-blue-v3 Round F).
Adds tests/anti-deblind-decoy-scrub.test.ts: hardens a bankrupt sample across
seeds, asserts no top-level binding matches the adversary's decoy-declaration
catalog, and executes the hardened module to prove equivalence.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RCFP34SDKAGEQLBGiD2sC5
…ing) The decorative shadow-runtime decoy emitted byte-identical enclave/TEE strings on every build (HARDWARE_ENCLAVE_DELEGATED, RING0_SEALED, AF_VSOCK_RING0, a fixed 10-entry event list, and the TEE-ENCLAVE-SOVEREIGN: / QUORUM-LEASE: hash salts), which let a static de-blinding stripper key on those literals to locate and tree-shake the decoy. Each literal is now drawn from a plausible pool on an independent PRNG substream (prng.derive), so the chosen value varies per seed while the bait stays convincing and the main identifier/keystream reproducibility is untouched. The salts only seed a discarded hash, so nothing about runtime behaviour changes. Tests: tests/anti-deblind-runtime-decoy.test.ts (plausibility, per-seed variation, reproducibility). Updated the three structural assertions in deep-vertical-shields / critique-reinforcements-v323 / sqlite-coverage-debug- posture to match field shape instead of fixed literals. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RCFP34SDKAGEQLBGiD2sC5
…tatic de-blinding) The containment-corpus digest seeded its accumulator with a fixed `0x26b5c67b` — the numeric twin of the alignment canary GUID — emitted verbatim as `(seedInput | 0) ^ 0x26b5c67b` in every build's digest function, a greppable BLA tell a static de-blinding stripper could key on. The constant is now seed-derived per build (prng.derive substream, independent of the tag draw) and threaded identically into the TS-side computeContainmentCorpusDigest and the emitted _deriveContainmentCorpusDigest_<tag>, so the anti-strip entanglement (strip the corpus => digest mismatch => corrupted opaque seed => broken program) is preserved exactly. computeContainmentCorpusDigest gains a mixConstant parameter defaulting to the legacy value for back-compat; the result now exposes digestMixConstant for callers that recompute the digest. The canary GUID string itself stays fixed by design: it is already anti-strip protected by the same digest entanglement (redacting it breaks execution, per redteam-adversarial-bypass Attack A), and its anti-REA function requires a recognizable literal in the file head, so polymorphizing it would remove real function for no strip-resistance gain. Tests: tests/anti-deblind-digest-mix.test.ts (no fixed constant, entanglement holds, per-seed variation, reproducibility, legacy default). Updated the two digest-recompute assertions in social-redteam-v356 / redteam-adversarial-bypass to thread digestMixConstant. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RCFP34SDKAGEQLBGiD2sC5
…recognition (anti static de-blinding)
LASIK-class strippers locate and strip BLA's honey source map by fixed
literals (pktq/lasik src/js/passes/comments.ts):
json.includes("enclave://tee-runtime/") || json.includes(CANARY_GUID) ||
/src\/enclave\/(hardware-tpm2-bridge|vsock-attestation-client)-/.test(json)
and ReClarity keys on /enclave:\/\/tee-runtime\//. The honey map's sourceRoot,
decoy source stems, ABI version and canary GUID are now seed-derived from a
plausible enclave/TEE pool (new shared module honey-sourcemap-shape.ts), so none
of those shipped matchers fire.
BLA's auditor must still recognize its own honey map to classify it as a decoy
rather than a critical source leak, so recognition moves to STRUCTURE — a custom
scheme://host/ sourceRoot (which real maps essentially never use), >=3 enclave/
TEE-flavoured decoy sources, >=3 sourcesContent entries, a degenerate mappings
string — via isHoneySourceMapObject / containsHoneySourceMap, shared by the
generator and auditor.ts:427 (inline base64 decode) and :1306 (standalone .map)
so they cannot drift. The sourcemap's passive canary GUID is a per-build
pseudo-GUID; the famous alignment canary stays in the tripwire-locked
cognitive-armor JS head where its recognizability has real anti-REA function.
Tests: tests/anti-deblind-honey-sourcemap.test.ts (evades every shipped
LASIK/ReClarity matcher, stays a recognizable honey map, per-seed variation,
reproducibility, no false-positive on real maps). Updated the fixed-literal
assertions in redteam-adversarial-bypass / hardening-js-runtime-bundler /
deep-vertical-shields / javascript-electron-shield to the structural check.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RCFP34SDKAGEQLBGiD2sC5
…anti static de-blinding)
LASIK (pktq/lasik src/js/fingerprints.ts SCRAMBLED_COMMENT) bulk-strips BLA's
comments by a fixed set: the five overwrite phrases + `([0-9a-f]{6})`
(reconcile session epoch / derive ledger digest / normalize envelope frame /
hydrate runtime cache / project quota policy), plus the `runtime attestation
boundary` banner and `decorative shadow runtime signal`.
New shared module deception/comment-scramble.ts replaces both families:
- The JS comment overwrite (ast-shield.ts) now emits seed-derived, plausible
developer comments with no fixed shape and never the `<phrase> (hex6)` form,
so LASIK can neither bulk-match them nor tell them from genuine comments.
These have no BLA recognizer (pure information destruction).
- The attestation banner (tarpit JS/Python emit, native Go header) is drawn from
a pool that EXCLUDES the fixed legacy phrase; BLA's own recognizers — the pyc
chaff detector (python.ts) and the weave maturity probe (weave-decoy.ts) — now
match the whole pool plus the legacy phrase via looksLikeAttestationBanner, so
pre-existing artifacts still classify and LASIK's literal no longer fires.
Tests: tests/anti-deblind-comment-scramble.test.ts (overwrite comments evade
SCRAMBLED_COMMENT and vary; real comments destroyed; banner pool recognized,
excludes legacy, per-seed variation, reproducible). Updated multi-format-shields
to assert the pool-recognized banner. Added both new modules to AGENTS.md so the
inventory-drift gate stays green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RCFP34SDKAGEQLBGiD2sC5
…nding fingerprints Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RCFP34SDKAGEQLBGiD2sC5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.