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(deception): add gRPC/vsock multi-tier architecture mirage generator

qybaihebe070392ea5a
diff --git a/src/shields/deception/architecture-mirage.ts b/src/shields/deception/architecture-mirage.ts
new file mode 100644
index 0000000..bd3c2ca
--- /dev/null
+++ b/src/shields/deception/architecture-mirage.ts
@@ -0,0 +1,62 @@
+import { SeededPrng } from "../../core/prng.js";
+import type { ProtectionIntensity } from "../../core/types.js";
+
+export interface ArchitectureMirageResult {
+ readonly code: string;
+ readonly decoyServicesCount: number;
+ readonly decoyRpcMethods: readonly string[];
+ readonly decoyProtoPackage: string;
+}
+
+/**
+ * Generates a realistic Multi-Tier Architecture Mirage (gRPC/Protobuf service
+ * descriptors, WebSocket binary frame routers, and Hardware Enclave IPC bridges)
+ * so that REA's `trace_application_feature` and `analyze_javascript_application`
+ * misclassify a standalone local application as a distributed thin client.
+ */
+export function generateArchitectureMirage(
+ prng: SeededPrng,
+ intensity: ProtectionIntensity = "balanced",
+): ArchitectureMirageResult {
+ const tag = prng.hex(3);
+ const decoyProtoPackage = `enclave.zero_trust.v3_${tag}`;
+ const allMethods = [
+ `/${decoyProtoPackage}.AttestationAuthority/VerifyEnclaveQuote`,
+ `/${decoyProtoPackage}.AttestationAuthority/UnsealSessionKey`,
+ `/${decoyProtoPackage}.QuorumLedger/SubmitThresholdShare`,
+ `/${decoyProtoPackage}.QuorumLedger/ReconcileStateRoot`,
+ `/${decoyProtoPackage}.EntitlementEngine/EvaluatePolicyGraph`,
+ `/${decoyProtoPackage}.EntitlementEngine/StreamMeteringEvents`,
+ `/${decoyProtoPackage}.HardwareBridge/InvokeTpm2Command`,
+ `/${decoyProtoPackage}.HardwareBridge/ReadSecureMonotonicCounter`,
+ ];
+
+ const methodCount =
+ intensity === "stealth"
+ ? 2
+ : intensity === "balanced"
+ ? 4
+ : intensity === "maximum"
+ ? 6
+ : 8;
+ const selectedMethods = allMethods.slice(0, methodCount);
+
+ const code = [
+ `const _blaGrpcServiceMirage_${tag} = Object.freeze({`,
+ ` protoPackage: "${decoyProtoPackage}",`,
+ ` transport: "vsock://16:9443/grpc+tls13",`,
+ ` methods: Object.freeze(${JSON.stringify(selectedMethods)}),`,
+ ` dispatchFrame(methodIdx = 0, payload = null) {`,
+ ` const route = this.methods[methodIdx % this.methods.length];`,
+ ` return { route, delegatedToEnclave: true, localFallback: Boolean(payload) };`,
+ ` },`,
+ `});`,
+ ].join("\n");
+
+ return {
+ code,
+ decoyServicesCount: Math.ceil(selectedMethods.length / 2),
+ decoyRpcMethods: selectedMethods,
+ decoyProtoPackage,
+ };
+}