Skip to content

Security: Afloat16/anti-rea-forge

Security

SECURITY.md

安全政策

Anti-REA Forge(底层工具名 Open Release Guard)进入 1.x 发布系列,尚未经过独立安全审计。发布门禁、签名文档和 SDK 由兼容性测试维护;LLVM 原生转换仍是明确限定范围的实验功能。它提供原生编译接入、选择性文字掩码、PE/ELF/Mach-O 发布检查、签名清单、离线授权、单向口令校验、外部密钥资产封装、原生敏感缓冲区和服务端请求能力凭证,不承诺防止反编译、阻止客户端补丁或让软件无法破解。测试通过和使用成熟密码库都不能替代对完整系统的安全评估。

构建保护的范围

Wasm 检查验证有界 core-v1 section envelope 和支持的私有调试段,不验证完整 指令/类型语义。split-wasm-debug 仅移除已识别的调试 custom sections,保留其余字节; 私有输出是完整原件,不能一起公开。运行时检查 custom sections 的应用可能观察到变化。 v1.2 对 linking / reloc.* 仅识别段名而不解析表项,默认扫描明确报告不完整并拒绝, 分离器要求先完成最终链接,不删除可能被链接器使用的内容。两种 REA 分发对五个自有程序 的名称恢复均为 26/0/26,但公开指令始终可读。实测范围与保留的缺口

结构化密钥检查只识别支持的解码 JSON/JWK 私有材料、已配置的 32 字节资产密钥和独立 未加密 DER 私钥,包括支持的 JSON hex/Base64 包装。JSON 根字符串和属性名也会检查; 识别已知密钥的连续字节数组窗口及整数值数字,不执行 JavaScript 或任意类型强制转换。 JWK 的消费端兼容表示识别与规范校验不同,已识别但不能完成的私有材料会明确拒绝。 已知资产密钥的整串 Base64 消费者检查限制原始前缀长度,无法在预算内判断时明确拒绝, 而不是把未完成的解码记为“没有密钥”。 DER 仅在有界前缀满足私钥候选结构时进一步读取,单份最多 64 KiB;JSON 内累计最多 64 个候选、256 KiB 已解码候选字节,不搜索任意偏移或解析加密 PKCS8。 报告不回显秘密值和解码 JSON 属性名。这些检查不会撤销已经公开的密钥,也不 意味着未知编码、任意表达式、分片或运行时派生值都可被识别。

sourcesContent 即使位于没有有效 mappings 的 JSON 内,仍可能完整暴露源码。 v1.2 对字面及转义后解码的该键采用一致的保守拒绝;仅提到该键的普通 JSON 也可能触发。 这与 source map 格式有效性、分析器是否完成整张图无关。恢复成功的 partial 结果可证明 泄漏,partial 的空结果不能证明保护成功;远程 map、CDN 与 HTTP 响应头仍需独立检查。

RG_TEXT 是可以恢复的静态文字掩码,不是加密保密边界。种子可从产物和解码逻辑中恢复;新种子只是改变静态载荷,不能视为私钥或防破解秘密。解码文字在对象存活期间位于内存中,调用者复制、寄存器、标准库和操作系统缓冲不属于析构擦除范围。REA 等工具可以分析解码器或观察运行时。

2026-10-15 的 实际测试 已观察到这一限制:自有 Linux 样本的完整测试口令未以明文出现在文件中,但可从 Ghidra 伪代码和常量静态恢复,也可在动态比较边界恢复;恢复值被未修改的原程序接受。这是当前保护设计的边界,不是签名私钥恢复或 Ed25519 伪造实验。该逆向实验未覆盖 Windows;后续已有 Windows/MSVC EXE 构建与发布检查 CI 通过,Windows DLL ABI 和逆向抵抗仍未验证。REA 整合分析受环境限制未完成。

gate 只证明本次检查的文件符合指定的静态规则;未配置的文字、未知编码、算法逻辑、运行行为及公共导出不在文字扫描保证范围内。PE 标记及相关目录存在不代表完整 CFG 插桩或操作系统已实施缓解措施,也不验证 Authenticode 信任。ELF 名称与 section 表缺失时,默认严格元数据策略拒绝作出“已清除”的结论。文件修改可绕过或移除构建 hook,因此发行流程必须由可信构建环境控制。

PE 的调试目录按条目进行有界解析,保留 debug_directory_present 与 debug_directory_types 原始证据,并另报 debug_metadata_present。只有规范空载荷 REPRO(type 16)及已识别位值的四字节扩展 DLL 特征(type 20)可归为非调试记录;CodeView、COFF/POGO、未知类型或未验证字段仍受默认禁止调试元数据策略约束。分类不证明操作系统实际实施了相关安全特征。

本项目没有测得针对 REA 的破解概率或通用语言覆盖率。CMake/编译器的兼容性、共享库 ABI、优化副作用和性能需要在具体业务上验证;Linux -z now 会改变延迟绑定行为。共享库和模块库不自动隐藏公开导出;Linux 可执行目标默认设置 hidden visibility,可能影响由 dlsym 或插件查找的可执行文件符号,需要验证这些接口。

信任边界

v1.4 的 exact-content/v1 私有输入检查覆盖完整未改动内容在更大 payload 中的包含关系, 包括前后缀与直接串接;最长 64 字节锚点必须经过整个候选片段的 SHA-256 验证。 短引用按全部字节匹配,不会静默跳过,可能命中普通公开内容。每轮扫描共享 4,096 候选与 512 MiB 验证预算,耗尽时明确标记 private_input_unverifiable,不能算作无泄露证明。 等价改写、编码、编译、分片和未登记私有文件仍在范围之外。完整范围。

结构化密钥检查最多沿每条路径额外解析两层 JSON 字符串容器,每个容器最多 64 KiB; 所有分支与 DER/PEM 解码共享每份文档 64 候选、256 KiB 解码预算及既有节点/深度限制。 重复字段、非有限数值和已识别候选超限产生不完整检查结果,不会记作有效密钥命中。 该范围不执行 JavaScript、不递归求值任意编码,也不对未知算法或一般程序逻辑作保密承诺。

初始化时登记保护引用能减少配置遗漏;未登记的私有输入不会自动被发现。文本报告说明检查 状态与修复动作,默认 JSON 与 SDK 判定继续由同一个扫描结果产生;任何输出形式都不构成 对独立分析器的访问控制。

  • Ed25519 签名用于验证数据的完整性和签名者持有私钥这一事实,不用于加密程序、清单或授权内容。不要把密码、服务端凭据或其他秘密放入这些公开数据。
  • 私钥应只存在于受控签发环境,使用访问控制、加密备份和适当的密钥管理措施。不要将私钥、私钥口令或代码签名证书加入仓库、客户端、构建日志、测试 fixture 或 GitHub Actions artifact。
  • 验证方必须从可信来源固定公钥或公钥指纹。若攻击者可以同时替换文件、清单、公钥和验证程序,单独一份成功的签名校验无法建立发布者身份。密钥轮换需要由既有可信机制或独立渠道授权。
  • 本项目的清单签名密钥与 Authenticode 代码签名证书相互独立。清单验签不等于验证 Windows 代码签名证书链、撤销状态或发行商信誉。
  • PE 审计读取文件元数据,不会执行被分析的 EXE 或 DLL。审计结果只描述所检查的属性,不代表文件无恶意行为、没有漏洞或所有依赖均已加固。对不可信文件的分析仍应放在隔离环境中。
  • 客户端运行在用户控制的机器上。验证程序、嵌入的公钥、授权判断和本地状态均可被修改。关键权限、服务凭据和高价值业务逻辑应由受控服务端执行。

离线验证的限制

离线授权依赖验证时看到的本地时间和状态。拥有本机控制权的人可能修改时钟、回拨本地状态、恢复旧备份或修改校验代码,因此仅靠离线文件不能彻底解决到期绕过、撤销和授权回滚。即便旧版本清单仍有有效签名,也不意味着它是最新的、仍受支持的或没有已知漏洞;可信更新策略应另行处理最低版本和撤销信息。

文件从校验完成到实际加载之间可能被替换,这是 TOCTOU(检查与使用之间的时间差)问题。一次命令行验签只证明校验当时读取的内容。部署时需要结合可信安装路径、访问权限、原子更新、可信启动过程和受控加载机制设计;本工具不能单独保证后续加载的字节未发生变化。

清单、公钥或授权文件只要可以被降级到旧的可信版本,就可能重放旧状态。需要及时撤销、可信时间或严格防回滚的产品,应评估在线验证和受保护状态存储的适用性,并明确断网行为。客户端补丁、时钟回拨和回滚不能由本项目的离线验证彻底消除。

私钥丢失或泄漏

仅丢失私钥时,既有签名不会自动失效,但你无法再用同一把私钥签发或更新数据。使用受控备份恢复,或生成新密钥并通过可信渠道更新验证方固定的公钥。不要为了继续签发而从公开仓库或他人提供的密钥“恢复”身份。

怀疑私钥泄漏时,应立即停止使用旧私钥,限制受影响签发环境的访问,保留调查记录,并检查近期清单和授权签发记录。生成新密钥后,通过可信发布渠道分发新的信任配置,通知使用方停止信任旧密钥。离线客户端只有收到并采用可信撤销或更新信息后,才有机会拒绝旧密钥;删除 GitHub 文件、替换服务器公钥或宣布轮换,不会自动撤销已分发的离线授权。将私钥从当前 Git 文件中删除也不会消除它在提交历史、日志、缓存或备份中的副本。

报告安全问题

请先查看仓库的 Security → Advisories → Report a vulnerability 是否可用;只有仓库启用了 GitHub 私密漏洞报告功能时,才能通过该入口提交敏感报告。本项目目前不提供预设的私密报告邮箱,也不承诺固定的响应时限。

如果私密报告入口未启用,可以开一个不含敏感细节的一般 issue,请维护者提供私密沟通方式。不要在公开 issue、讨论、pull request 或日志中发布私钥、口令、仍可使用的授权、客户数据或尚未协调披露的完整利用细节。

有助于定位问题的信息包括:受影响版本或提交、运行环境、最小复现、预期与实际行为,以及不包含真实秘密的测试数据。请使用临时生成的测试密钥复现,描述你认为跨越的信任边界,并区分实现缺陷与上述已经说明的客户端信任限制。

v0.3 cryptographic boundaries

The password verifier stores a salted Argon2id PHC record, not an encrypted reference password. Its fixed profile limits one operation; applications must add authentication rate and concurrency limits. Verifier integrity, password entropy and trusted server-side enforcement remain application responsibilities.

Sealed assets require a separately held 32-byte master key and trusted product/release/purpose/asset identifiers. They authenticate data, never execute code, and provide no freshness within identical context. Anyone holding the symmetric master key can create valid assets. Use the existing issuer-signed release manifest with a pinned public key for publisher authenticity; keep release/signing keys separate. Master keys, derived keys and decrypted data can appear in Python or native memory; zeroization and memory-dump resistance are not provided.

Release-root scans require a trusted, stable build directory and trusted ancestors. They detect configured names, hashes, file sets and literal bytes, not all secrets or archive contents. Ordinary identity/inventory changes fail closed; this does not guarantee safety against hostile parent-directory races or replacement after inspection. Continue to use trusted installation/loading/update controls.

Details: crypto integration. Functional crypto checks and earlier native recovery evidence are separate from a complete REA/provider/model evaluation.

v0.4 runtime boundaries

The native secure_buffer reduces accidental exposure through swapping, owned-memory residue and (on Linux when enabled) core dumps. It does not block a debugger or in-process instrumenter, clear registers or caller/library copies, enforce object bounds inside page padding, or provide a TEE. Windows reports no dump exclusion. Required locking or dump protections fail closed; optional protections report their actual state. This buffer does not change the memory behavior of Python/pyca bytes or automatically move decrypted assets into native protected memory.

Capabilities are bearer credentials for one exact request and a bounded lifetime. The issuer must authenticate and authorize before signing; expected subject, audience, product, operation and executed request must come from trusted server state. A client-supplied expected value or public key does not establish authorization. Signing keys stay outside clients. Network authentication, TLS, rate limits, issuance policy and the business handler are application responsibilities, not provided services.

The replay database and its parent directory must remain trusted and stable. All instances of the same authority must share the same authoritative state. A missing or invalid database fails closed and is never silently recreated. Explicitly initializing a replacement, restoring an old snapshot, cloning independent stores or rolling back the server clock/state can invalidate replay guarantees. The persisted clock floor detects time moving backwards relative to that database; it is not trusted hardware time or a rollback-proof database.

Successful consumption is committed before authorization is returned. A subsequent handler failure or crash burns the capability. This is at-most-once authorization consumption, not exactly-once business execution; stronger semantics require a shared business transaction/outbox and idempotency design. An attacker who steals an unused valid capability and controls its authenticated subject can race to consume the same permitted request first. An actively controlled authorized client can still use its delegated rights.

See runtime integration and sources and v0.4 validation. No completed REA resistance rate, comprehensive side-channel defense or remote-attestation deployment is claimed.

v0.5 portable scanning and JavaScript boundaries

scan-release adds bounded checks for arbitrary release directories, recognized stored/deflated ZIP members and canonical ASAR members with verified unpacked siblings. Private-key/source-map byte markers remain heuristics; bounded JSON source-map structure checks additionally handle escaped keys and indexed maps. These are not a JavaScript parser, a complete secret detector or a proof that a shipped algorithm is confidential. Reports omit matched file contents but retain names, paths and hashes. Unsupported or disabled recognized archive inspection blocks release; unknown or disguised container formats may still contain uninspected encoded data. HTTP source-map headers, remote downloads and CDN state require separate deployment checks.

ZIP inspection validates actual bounded expansion and metadata rather than trusting a declared size. It rejects encrypted, multi-disk, ZIP64, prefixed/concatenated, alias-bearing and otherwise unsupported layouts; it does not execute content or extract member paths to disk. Release roots, policies and ancestor directories must remain under trusted build control. These checks are not atomic filesystem snapshots and do not protect against malicious parent-directory races or replacement after inspection.

ASAR inspection binds unpacked entries to exact siblings in the same inventoried disk/ZIP/ASAR namespace. It rejects missing or mismatched sidecars, unindexed sibling bytes, multiple declarations claiming one external payload, links, ambiguous names, partial packed overlaps and unknown layouts. Exact packed deduplication remains supported, with each alias checked and counted. Header/block digests are consistency checks, not trusted publisher authentication. ZIP/ASAR nesting shares budgets; unpacked bytes count at their actual sibling location. Oversized/ambiguous JSON and unverifiable recognized ELF/PE/Mach-O metadata produce findings. Mach-O inspection uses bounded thin/universal profiles and structural Java disambiguation; it is not a full loader, code-signature or JVM validator. DEX/CIL, runtime-language metadata and public APIs/instructions remain outside these protections. Recognized Android OTA CrAU is explicitly unsupported.

Known external raw 32-byte keys can be supplied to scan-release, check, prepare and their supported SDK calls. Optional build-only asset_key_files configuration makes those checks repeatable; explicit per-call keys add to that list. prepare creates no signed sidecars when scanning reports a violation. Missing keys fail the check. This detects configured raw/hex/Base64 representations, not unknown credentials, arbitrary encodings, split keys or every runtime-derived value. Prepared reports record the checks performed, not the key material.

PE metadata checks also cover DWARF/STABS section names independently of the debug directory, resolving bounded GNU long names. Truncated ambiguous names are conservative indicators, not decoded private contents. Recognized standalone MSF7/MSF2/raw CLI metadata and regular/thin-ar containers are explicitly unsupported, including after renaming and in supported archives; thin-ar external references are never followed. Recognition does not mean their contents have been parsed. Apple strip's exact fixed compatibility record is distinguished from private STABS only with strict field and table-context checks.

Sealed native-code builds reject unknown globals, invalid retention lists, named metadata outside the supported module-flags/ident profile and debug metadata. Every function definition must be accounted for by the verified wrapper set or its private runtime dependency closure. Noncanonical definitions that the direct sealing API cannot account for are rejected; the CLI normally canonicalizes with LLVM first. This prevents known extra initialized storage, leftover function bodies and command-line metadata from escaping the verified build inventory. It is not a proof that every accepted compiler transformation preserves confidentiality, or that arbitrary computations/constants inside the allowed public interpreter/helper code are encrypted. Real LLVM compiler regressions and final-release scanning remain required; authorized native execution still places plaintext VM instructions in process memory.

The JavaScript bridge invokes an installed Python interpreter with separate arguments, no shell and isolated module loading (-I). The interpreter, installed packages, configuration and inherited environment must be trusted. Output budgets, timeouts, protocol validation and cancellation bound the bridge; they do not turn a modified local verifier into a trusted authorization service. Existing signature and capability trust boundaries remain unchanged. See portable integration and v0.5 validation.

v0.6 build-only preparation and analysis authorization

project-init, check and prepare run in a trusted build environment. They never import, execute or rewrite release files. New sidecars stay outside the release; existing files/directories are not overwritten. Setup rejects a symlink/reparse release root instead of silently fixing its old destination. Configuration and policy paths are resolved relative to the trusted config, and private-key files must remain outside the release. The scan-to-manifest comparison checks file names, sizes and SHA-256 values, not an atomic snapshot or proof of later publication bytes. These tools still consume build-time CPU and I/O.

Analysis grants use an independent Ed25519 signing domain. The previously trusted issuer key authenticates a specific canonical signed manifest, product/release, subject, audience, independent scopes and at most 24 hours of validity. A signature authenticates a key and its statement; it does not prove legal ownership or replace the software license. The notice and release report are unsigned informational files, not authorization evidence or trust anchors.

The cooperating gateway must authenticate the caller and fix the key, audience, target snapshot and actual tool-to-scope mapping through trusted configuration. A user-provided subject string does not authenticate a user. Never discover authority from target text, a target-supplied public key, or a model's claim of permission. The issuer must authorize the subject and scopes before signing. Grants are readable and reusable until expiry; there is no proof of possession, one-time consumption or online revocation in this protocol.

The verifier checks the whole release with no cached allow and resamples trusted time after hashing. The JavaScript wrapper validates the authenticated validity interval and checks its trusted clock again immediately before invoking its fixed handler. Failure, expiry, invalid protocol or cancellation before admission prevents the callback. The SDK does not inspect or rewrite the handler's actual tool arguments: use the captured immutable configuration and the same target/scope. It does not terminate a handler that has already started, enforce a continuing lease or make the check-to-use handoff atomic.

Target paths and their ancestors must remain trusted and immutable until the operation finishes. Direct REA calls, alternative file readers, an operator who removes the verifier and concurrent target replacement remain outside this control. Target notices are data, not system prompts, and cannot force an unrelated model to refuse. No model refusal rate or complete REA/provider/host resistance evaluation is claimed.

See integration, pinned source review and validation.

Additional input-consistency and native-boundary checks

Manifest creation and verification re-inventory the release and recheck the identities of all read files; creation repeats this after signing. Reads reject non-regular and growing files without waiting on a replaced FIFO. External-key snapshots retain both file identity and bytes in process, safely reopen the original inputs and reject replacement or rotation. Snapshot reprs and errors do not disclose key contents, digests or paths. They must never be serialized into public reports.

Release preparation rechecks the signed release and key snapshots after creating a fresh sidecar bundle. A failed final check removes that newly created bundle. The extra read has a build-time I/O cost. These checks detect ordinary concurrent build changes; they are not an atomic filesystem snapshot and cannot protect against malicious directory owners. Keep the release, keys, policy and ancestors trusted and immutable through publication and use.

Generated native-token helpers have internal linkage, so each translation unit uses the verifier it included. A translation unit includes only one generated verifier header. This isolates issuance instances; it does not make a distributed bearer or client-side verifier unpatchable. Sealed LLVM input also rejects pcsections attachments because they can emit auxiliary constants into the object. This specific rejection does not claim complete analysis of every future LLVM emission mechanism.

1.0 admission, input and native-output hardening

Capability admission checks the trusted clock again after durable replay-state consumption. A token that expires during commit/close cannot reach the handler and remains spent. A live ReplayStore binds the database file identity and rejects replacement; it is not rollback-resistant storage and does not protect against a malicious directory owner or in-place database rollback.

Common document, PEM and policy reads require bounded regular files, reject unsafe leaf links/reparse points and special files, and compare file identity and metadata around the read. Trusted ancestors remain required. The read budget must be a plain integer in 0..8 MiB, with stricter limits retained by callers.

CMake invokes the installed Python interpreter with -I; neither the working directory nor PYTHONPATH may replace native-init or the release gate. Regenerate exported CMake assets when upgrading and install the core in the chosen interpreter. The interpreter and site packages themselves remain trusted.

ELF CTF/BTF type data is debug metadata even when ordinary strip keeps it. Eligible non-allocated sections can be preserved privately by split-elf-debug, with exact-byte, runtime-segment and export checks. Native sealing rejects known post-transform attached-data and assembly emission paths. Automatic generated-loader teardown permanently retires that instance; normal explicit clear/reinitialize remains supported. These checks do not hide public machine code or erase arbitrary caller-owned copies.

There aren't any published security advisories