LibreAuth

Hardening — Anti-Cheat · Anti-RE · Anti-Inject

Production-grade client protection for LibreAuth — maximize bypass resistance in your build.

WARN
No system is 100% unhackable — the goal is to make attacks costly and slow enough to deter attackers.

Three-Layer Overview

LayerProtects AgainstYour Client
ServerReplay, session hijack, forged hashHandled by LibreAuth — verify signed responses
WireMITM sending forged JSON success responsesEd25519 verify + AES enckey
BinaryRE, binary patching, DLL injection, debuggerObfuscator + hardening.hpp + hash on init

Wire — MITM / Fake API Protection

  1. Verify X-Signature-Ed25519 + timestamp before parsing JSON — see Response Signing
  2. Send 35-char enckey on init → AES-encrypted body
  3. Do not embed Application Secret in the client — use Ed25519 public key only
  4. HTTPS only · pin certificate in native client when possible

Hash Check — Binary Patch Protection

  1. Build release → LibreAuth Protect L3 seal / obfuscate → then compute MD5
  2. Client sends hash= on every init call
  3. Even a 1-byte jmp/nop patch → MD5 changes → server rejects
  4. Optional panel toggle Auto-ban on Hash Reject (hash_auto_ban) — bans HWID + linked users on reject

Fix errors: Hash troubleshooting · Access controls: hash_auto_ban

Reverse Engineering — Making RE Harder

Server protects the wire · but attackers can open the exe in x64dbg if the client is not hardened:

TechniquePurpose
Native L3 (LibreAuth)SecureLoader sealed payload + LA1 gate + CreateProcess
String encryptionAPI URL, ownerid, app name, Ed25519 pubkey — decrypt briefly at runtime then wipe
Control-flow obfuscationSplit auth logic across multiple functions · avoid a single login block
Integrity self-checkHash .text section before init — exit if patched
Split auth moduleSeparate auth DLL · load from resource · self-sign the DLL
Anti-dumpDo not keep license key / session as plain strings in memory for long
Anti-AI assistPanel block_ai + RunChecks(..., blockAi) — exact exe + path marks + window titles (Cursor / Windsurf / Hermes Agent / Continue / Cline / Ollama / LM Studio / …) via Hardening only (not Anti-RE BadWindow) · ดู Access Controls · sdk/protect/ANTI_AI.md
Function flood (Opaque)เมื่อติด debugger / RE tool — สปอว์นฟังก์ชันปลอมต่อเนื่องในรายการ Functions ของเครื่องมือวิเคราะห์ · คู่กับ stub ทึบตอนเปิด static · เรียกแค่ Protect.Boot/Gate/Pulse · ดู Protect AIO
WARN
Never hardcode keys or webhooks in the client — attackers can dump strings unless obfuscated

Ship checklist — กัน RE สุดที่ระบบทำได้

ชั้นใน SDK (AntiRe.Gate · ApiSeal · Integrity · SessionGate · SecureLoader) ครบแล้ว — สิ่งที่ยังขาดตอนแจกคือ policy ฝั่งเซิร์ฟ + แพ็กเกอร์ ไม่ใช่ไฟล์ใหม่ใน repo

  1. AntiRe.Boot() + Gate() ก่อน Init · ห้าม ship ด้วย LA_ANTIRE=0
  2. SessionGate.Boot(build) → Init → License → MarkLicensed() → ฟังก์ชันจริงใช้ AssertEntitlement / RequireFeatureOrDie ไม่ใช่แค่ if ใน UI
  3. Panel: Hash Check + อัปโหลด MD5/SHA256 ของไฟล์ที่ seal แล้ว · Min client build บัมป์ทุกปล่อย · Redis เปิด (idle TTL + check_stale)
  4. Enterprise: Protocol v2 + type=feature + เปิด Require Feature Ack สำหรับฟีเจอร์แพง
  5. แพ็กเกอร์ก่อนแจก — C++ SecureLoader L3 · C# ConfuserEx / Native AOT · Python Nuitka · Go garble — ไม่มีชั้นนี้สตริงใน SDK ยังอ่านได้

HasFeature ของแพ็กคีย์คืน false จนกว่าจะ MarkLicensed (license seal) · Lite ที่ไม่มี files/chat โดน 403 จากเซิร์ฟแม้แพตช์ client

Anti-Inject — DLL / Hook / Debugger Protection

Attackers often inject DLLs or attach debuggers to bypass auth — hardening.hpp / Hardening.cs runs multi-layer runtime checks:

  1. Call la_guard::RunChecksWithUrl(apiUrl, blockVm, blockAi) before init() and every 30–60 seconds
  2. Inspect fail reason: la_guard::FailName(la_guard::LastFail())
  3. If policy.tool_auto_ban: call Ban("tool:" + fail) then exit
  4. Development on a VM: LA_ALLOW_VM=1 · AI tools (Cursor/Hermes) during dev: keep block_ai OFF or LA_ALLOW_AI=1
  5. Remote support (UltraViewer / TeamViewer / AnyDesk): auto-allow when process is present — skips false CheckRemoteDebuggerPresent + soft hook modules. Force with LA_ALLOW_REMOTE=1; strict with LA_ALLOW_REMOTE=0. SDK also retries canceled/timeout license HTTP under remote sessions.
  6. Call check() heartbeat alongside the guard loop

Anti Fake API — Local Auth Bypass

Local emulators redirect traffic to 127.0.0.1:5000 — server never sees those requests. Defense is client-side:

Multi-language Hardening

API surface matches C++: RunChecks(blockVm, blockAi=false), RunChecksWithUrl, LastFail / FailName, optional ExeMd5Hex / Hwid. Every SDK exposes RunChecks; non-Windows hosts return true (same as C++ #else).

Kernel-driver parity remains C++ only. Call RunChecks before Init/Login on Windows clients.

C++ — Hardening Snippet

Minimal client bootstrap using the public headers hardening.hpp + libreauth.hpp (DNS freshness comes from trust.hpp, pulled in by hardening.hpp):

#include "hardening.hpp"
#include "libreauth.hpp"

int main() {
    const char* api = "https://your-host/api/v2/";
    if (!la_guard::RunChecksWithUrl(api, true, false)) {
        return 1;
    }

    la::v2::Client app("MyApp", "OWNER_ID_10", api, "SIGN_PUB_HEX");
    auto init = app.Init(la_guard::ExeMd5Hex());
    la_auth::ApplyInitPolicy(init);
    app.License("KEY", la_guard::Hwid());

    while (running) {
        bool blockAi = la_auth::BlockAi();
        if (!la_guard::RunChecksWithUrl(api, true, blockAi)) {
            if (la_auth::ToolAutoBan()) {
                app.Ban(std::string("tool:") + la_guard::FailName(la_guard::LastFail()));
            }
            break;
        }
        Sleep(45000);
    }
    return 0;
}

Files: sdk/cpp/hardening.hpp · sdk/cpp/shield.hpp · sdk/cpp/trust.hpp · sdk/cpp/bind.hpp · C++ setup · C++ Pack (Enterprise)

C++ — Optional Kernel Guard (advanced)

An OPTIONAL WDM sample driver (sdk/cpp/kernel/) adds a kernel vantage point that usermode cannot spoof: kernel-debugger detection and soft ObRegisterCallbacks protection of the loader's own PID. The usermode bridge sdk/cpp/kernel_bridge.hpp fails soft — if the driver is absent the loader continues with the usermode hardening.hpp guard only (no tamper).

WARN
Kernel drivers require EV signing for retail Windows. Test-signing is lab-only and must not ship. This is defensive license protection, not persistence.

Build/steps: sdk/cpp/kernel/README.md · bridge: sdk/cpp/kernel_bridge.hpp

C# / Unity / WPF

FiveM / Lua

Pre-Release Checklist

#Item
1Client verifies Ed25519 on every response
2Send exe MD5 on init when hash check is enabled
3enckey + AES on wire
4Obfuscate binary + encrypt credential strings
5Anti-debug + anti-inject loop (hardening.hpp / equivalent)
6check() heartbeat + HWID on every request
INFO
Anti-tamper: Anti-Tamper · Signing: Response Signing · Ops: Operations · Pack: C++ Pack