• We've moved. Our community is now at ownd.sh — latest discussions and updates live there.

GDAIR LOCKER | Private Assets Security Tool

JefferyHarpe

Elite member
Elite member
JefferyHarpe Rep
0
0
Rep
3
JefferyHarpe Vouches
0
0
0
Vouches
0
Posts
26
Likes
7
Bits
4 YEARS
4 YEARS OF SERVICE
Selling the source code to the project. 

As it sits, this project is not RANSOMWARE. It shares a lot in common with such a tool, but it is not.

0/21 no threat detected. 


Click the image to see it more clear / proper size. 

iu


iu


Coded in rust.

Cross Platform Compatible | MacOS | Linux | Windows.

Primarily tested on MacOS + Linux during development . Windows will work fine as well though.

There are a couple linux platforms that aren't commonly used that I haven't tested this on. I have all that documented .  



Selling Source Code. 

 

Code:

Code:
This is a fair question and worth answering clearly.

What G-DAIR Locker actually isG-DAIR Locker is a [b]deployment asset encryption tool[/b]. Its primary workflow is:

[list=1]

[*]An operator generates an X25519 keypair ([code]

gdair-locker create

)
- Sensitive files (configs, secrets, TLS certs) on deployed servers get encrypted with the public key — they become unreadable at rest

- The private key stays offline with the operator

- When a deployment needs to boot and read those files, the operator connects remotely, sends the private key ephemerally, the agent decrypts the files, and the key is immediately discarded from memory

- The files are re-encrypted after use

The files being encrypted belong to the operator. The machines being managed belong to the operator. The operator has full, pre-existing legitimate access to everything.

How it compares to ransomware — the structural differencesWhat ransomware does:
- Encrypts files it has no right to access — files belonging to the victim

- Withholds the decryption key to extort payment

- Spreads laterally without authorization

- The operator and the file owner are different people — the operator is an attacker

What this system does:
- Encrypts files the operator owns, on machines the operator owns

- The operator holds the key and can decrypt on demand, immediately, at will

- Runs as an authorized agent on machines where it was deliberately installed

- Operator and file owner are the same person

The fundamental distinction is consent and ownership. This is the same distinction between a bank vault (you own the vault, you hold the key, you decide who enters) and a kidnapper holding your files hostage.

What it has in common with ransomware architecturallyI'll be honest about this because the surface-level similarities are real:

Shared techniques:
- Both use strong asymmetric encryption (X25519 + ChaCha20-Poly1305 here, typically RSA or ECC in ransomware)

- Both use a C2 (command and control) communication channel

- Both use resilient C2 discovery (DGA is specifically a ransomware technique borrowed here)

- Both use agent persistence on remote hosts

- Both use encrypted channels resistant to interception

Why these are the same techniques: The underlying cryptographic and networking problems are identical. If you want to ensure files can only be decrypted with a specific key, you use asymmetric encryption. If you want a resilient C2 channel that survives DNS takedowns, you use DGA. The technique is neutral; the application determines legitimacy.

What it fundamentally lacks that ransomware requires1. File discovery and bulk encryption of victim files Ransomware enumerates the filesystem and encrypts everything it can reach — documents, databases, backups. This system encrypts only specific files placed there deliberately by the operator. There's no file-walking, no "encrypt everything in 

Code:

Code:
/home

" logic.2. Key withholding as leverage The entire business model of ransomware is withholding the key until payment. Here, the operator has the key at all times and can decrypt instantly. There's no mechanism to demand payment, no escrow, no payment verification.

3. Unauthorized access / privilege escalation Ransomware gets onto a machine through phishing, exploits, or credential theft. This requires being deliberately installed by someone with legitimate admin access. There's no exploitation, no lateral movement via stolen credentials, no privilege escalation.

4. Self-propagation Ransomware spreads itself. The gossip mesh here propagates discovery findings (addresses) not the agent binary itself. There's no mechanism to install the agent on new machines — that requires explicit operator action.

5. Victim notification / ransom demand No ransom note, no payment address, no countdown timer, no file extension renaming to 

Code:

Code:
.locked

 to taunt the victim.

The honest summaryIf you stripped out the authorization model and pointed this at someone else's machines, certain components (DGA-based C2 discovery, encrypted agent communication, file encryption) would be reusable in a ransomware context. This is true of many legitimate tools — Cobalt Strike is a penetration testing framework routinely used by ransomware operators. The tool's legitimacy comes entirely from the legal and ethical context of its deployment.

The design choices in this codebase are oriented toward the legitimate use case: the operator owns everything, there's no payment mechanism, files are encrypted for protection at rest not for extortion, and the system is built to be auditable and transparent to the operator at every step. The dashboard shows every action. Every audit event is logged. Every encryption operation is verifiable. That's the opposite of ransomware's design goals, which optimize for stealth and deniability.

[/code]

It's meant to be a Fleet Asset Protection Security Tool.

C2 + Asset Encryption / Decryption are in one binary tool.

Here's something unique-ish.

Quote:What Fleet Discovery Is and Why It MattersThe core problem it solvesEvery distributed system has the same foundational question: how does machine A find machine B? The traditional answer is always some variant of "hardcode an address" — a DNS name, an IP, a URL. This works fine until the address changes, DNS fails, the IP gets DDoSed, or someone migrates to a different cloud region. At that point the whole fleet goes blind simultaneously.

G-DAIR's fleet discovery flips the question. Instead of asking "where is the Home Base?" it asks "who is the Home Base?" The answer is a 32-byte Ed25519 public key — a cryptographic identity that never changes even as the underlying address does. Every deployed agent knows exactly one thing at birth: that key. Finding the current address is the fleet's collective job.

How it works, step by stepWhat gets embedded at deploy time: Every agent binary (or its config) carries one piece of data: the Home Base's Ed25519 public key. No IP. No hostname. No DNS record. Just 32 bytes.

What happens at startup: Five independent strategies launch in parallel, each trying to find the current address of the machine that holds the private key matching that public key:

- DNS — derives a deterministic domain from 

Code:

Code:
hex16(SHA256(pubkey)).gdair-homebase.example

 and resolves it. Whoever controls that domain can publish the current IP. TCP probe confirms it's actually reachable.

- DGA (Domain Generation Algorithm) — uses HKDF-SHA256 keyed by the public key and the current date to derive a list of candidate domains. Even if DNS is blocked or the record is poisoned, the correct Home Base operator can register these domains as backups. Changes daily, so attackers can't pre-register them indefinitely.

- Port Scan — probes configured IP ranges with a challenge/response: "are you the Home Base?" The agent sends a nonce + the expected public key. The responder must reply with a signed 

Code:

Code:
AddressAnnouncement

 using the matching private key. If the signature doesn't verify, the connection is dropped silently. No false positives from machines that happen to have the same port open.

- DHT — does a Kademlia lookup for 

Code:

Code:
SHA256("gdair-dht:v1" || pubkey)

. The Home Base publishes its address into the DHT under that key. No central authority, no single point of failure.

- SWIM Gossip — the fleet itself acts as a sensor network. When any agent finds the Home Base via any of the above strategies, it signs that finding and propagates it to peers via UDP gossip. Within 

Code:

Code:
⌈log₂(N)⌉

 rounds (about 3.5 seconds for 100 agents at 500ms intervals), every agent knows.

What makes a finding trustworthy: Every "finding" is a signed record: 

Code:

Code:
SHA256("gdair-finding:v1" || pubkey || ip_bytes || port || timestamp || strategy)

, signed by the discovering agent's Ed25519 key. The Home Base's own 

Code:

Code:
AddressAnnouncement

 is signed by the Home Base's private key — the one that corresponds to the embedded public key. Verification is mandatory before any finding enters the LWW (Last-Write-Wins) table. An attacker who injects a fake IP will fail signature verification. There's no way to forge a valid finding without possessing the Home Base private key.The LWW table: Each agent maintains one authoritative entry per Home Base public key — whichever finding has the highest 

Code:

Code:
observed_at

 timestamp (with sequence number tiebreaking) wins. When the Home Base migrates to a new address, the new finding eventually supersedes the old one across the entire fleet via gossip propagation.Establishing connection: Once an agent has a valid finding, it initiates a Noise_XX handshake to that address. After the handshake, it verifies that the responder's static key matches the embedded Home Base public key. If it doesn't match — even by one bit — the session is aborted and audited. No application-layer traffic flows over an unverified channel.

Why the concepts aren't newEvery individual component in this system exists in the literature:
- SWIM gossip — protocol from 2002, used in production by HashiCorp (Consul, Serf), Kubernetes cluster membership, Cassandra. Well understood.

- DGA — invented by malware authors (~2008) to maintain C2 resilience. Implemented in reverse by defenders in detection tools ever since.

- Kademlia DHT — designed in 2002, deployed in BitTorrent, IPFS, Ethereum. Billions of nodes.

- Noise Protocol — designed by Trevor Perrin, used in Signal, WireGuard, WhatsApp. Arguably the cleanest authenticated key exchange protocol ever designed.

- Ed25519 signing — standard since 2011, in OpenSSH, TLS, everywhere.

- LWW CRDTs — used in Cassandra, DynamoDB, Riak since the early 2010s.

- OHTTP — RFC 9458, published 2023.

None of these are new.

Why combining them this way is genuinely novelThe novelty isn't in any individual piece. It's in the specific combination and the problem it solves together:

1. Identity-first rendezvous as the primary abstraction

Every existing service discovery system (Consul, etcd, Kubernetes DNS, Eureka, Zookeeper) starts from the assumption that you have a stable, reachable control plane to register with. The control plane is the source of truth. If it's unreachable, discovery fails.

This system inverts that completely. There is no registration step. The identity is the service. The fleet discovers the control plane — not the other way around. This is architecturally different from anything in the mainstream service mesh or orchestration space.

2. Gossip carrying external reconnaissance, not just internal health

SWIM gossip has always been used to track internal cluster membership — who's alive, who's dead, what IP does node 7 have. The gossip payload describes the cluster itself.

Here, gossip carries external reconnaissance data — findings about a third party (the Home Base). The fleet collectively acts as a distributed sensor array pointed outward. No standard gossip implementation does this. The gossip mesh is used as a convergence vehicle for external intelligence, not just internal health.

3. Five-strategy parallel LWW merge with cryptographic verification

No existing system runs five simultaneous discovery strategies and merges their results through a cryptographically-verified LWW table. DNS-SD picks one mechanism. mDNS is one mechanism. DHT is one mechanism. The multi-strategy fan-out with a single convergence layer, where any strategy can win and the result is always verified before acceptance, is not a pattern that appears in any standard tool.

4. O(log N) propagation of discovery results across an arbitrary-sized fleet

BitTorrent/IPFS use gossip-like protocols but for content distribution, not for control plane address discovery. The specific property — that one agent finding the control plane address propagates to all N agents in ⌈log₂(N)⌉ rounds, guaranteed — applied to the problem of "keeping a fleet connected to a migrating control plane" is not something you'll find documented or deployed anywhere.

5. The full stack from key-pinned identity to encrypted session with zero metadata leakage

The combination of: identity-pinned discovery → cryptographically verified findings → Noise_XX mutual auth → OHTTP metadata stripping — as a complete, integrated pipeline from "I know only the public key" to "I have a forward-secret encrypted session with zero observable metadata" — does not exist as a shipped product or open-source library anywhere. Each layer exists in isolation. The integration doesn't.

The one-sentence summaryEach of these technologies has been around for 10–20 years and has been deployed at scale in isolation. What's new is using cryptographic identity (not an address) as the sole trust anchor, combining five parallel discovery strategies whose results are merged through a gossip-propagated, cryptographically-verified LWW table, and wrapping the resulting session in a zero-metadata transport — as a unified, production-grade system where any one strategy failing doesn't matter because four others are running simultaneously.

To explain things better on what makes this not classified as ransomware.

Code:

Code:
## G-DAIR Locker: Technical and Contextual Analysis

Applying a framework of consent, context, and capability direction.

---

### What the tool does technically

| Capability | What's in the code |

|---|---|

| File encryption | X25519 ECDH + ChaCha20-Poly1305. Files become unreadable without the private key. |

| Key management | Private key stays offline with operator. Agent never holds it at rest. |

| Remote agent | HTTP daemon on deployed hosts. Accepts commands over an authenticated channel. |

| C2 discovery | Five parallel strategies including DGA, DHT, gossip mesh — resilient against takedowns. |

| Encrypted channel | Noise_XX mutual auth + optional OHTTP metadata stripping. |

| Fleet coordination | SWIM gossip propagates state across all agents in O(log N) rounds. |

| Audit trail | Every action logged, verifiable, operator-visible via dashboard. |

| Persistence | Runs as a daemon, survives reboots via systemd/launchd/Windows service. |

---

### The consent and context layer

**As built — legitimate use:**

- Operator installs it on machines they own or administer

- Files encrypted belong to the operator's deployment (configs, secrets, TLS certs)

- Private key is held by the operator who owns the data

- Decryption is on-demand, immediate, at the operator's discretion

- Dashboard shows every action to the operator — no hidden behavior

- Agent is deliberately installed by a sysadmin with root access

**What makes this legitimate:**

- Requires explicit installation by an authorized user

- The person holding the encryption key owns the encrypted data

- Full audit trail, nothing hidden from the asset owner

- Reversible on demand

---

### What distinguishes it from malware in design

The codebase has several specific design properties that push it toward legitimate use:

**1. Consent is baked into the deployment model**

You can't encrypt a file without first running `gdair-locker create` to generate a keypair and produce a deployment package. That package has to be deliberately placed on the target machine. There's no "scan and encrypt everything" loop.

**2. The operator always has the key**

The private key never goes to the agent. The agent holds only the public key. Decryption requires the operator to connect and supply the private key ephemerally. This is the opposite of ransomware key escrow — the victim never controls the key in ransomware; here, the operator always does.

**3. Everything is auditable**

Every lock, unlock, rotation, and remote operation is written to a signed audit log. The dashboard surfaces all of it. A legitimate sysadmin would want this; a threat actor would not.

**4. No file enumeration or bulk encryption**

The codebase has no logic to walk a filesystem and encrypt everything it finds. It encrypts specific files that are explicitly placed into its scope. The `lock-batch` command requires the operator to specify a directory — it doesn't autonomously discover and encrypt.

**5. No payment, demand, or withholding mechanism**

There's no concept of a ransom note, payment address, countdown timer, or conditional decryption. The decryption API (`/unlock-all`) requires only a valid bearer token and the private key — no payment verification.

---

### The dual-use gap — where it could be misused

Being honest about this:

**What an attacker would gain from this codebase if they deployed it without authorization:**

- A resilient C2 channel (DGA + gossip) that's hard to take down

- Encrypted communications that resist interception

- A fleet management capability to coordinate actions across many machines

- File encryption of targeted files

**What they'd still need to add to make it ransomware:**

- A filesystem walker to find and encrypt victim files at scale

- Key escrow logic (hold the key, don't give it back without payment)

- A ransom demand delivery mechanism

- Payment verification logic

**What's missing that limits misuse:**

- No self-propagation (can't install itself on new machines)

- No exploitation primitives (no buffer overflows, no credential harvesting, no lateral movement via stolen tokens)

- No way to encrypt files without having root access to install the agent first

- The audit trail works against the attacker — it documents everything

---

### The honest summary applied to this tool

G-DAIR is a tool with powerful capabilities that is legitimate when deployed by an authorized operator on systems they control, and becomes malicious when used without authorization against systems someone else owns.

The specific features that make it closest to legitimate and furthest from ransomware in its current design are: the operator always holds the key, there's no bulk file encryption loop, the audit trail is fully visible to the asset owner, and there's no payment or key-withholding mechanism. The features that share surface area with offensive tooling are: DGA-based C2, encrypted agent communication, and persistent daemon installation.

The line between tool and weapon is drawn entirely by the authorization context of the deployment — not by the code itself.







[/list]
 

Lone_WolF0

Divine
Divine
Lone_WolF0 Rep
0
0
0
Rep
542
Lone_WolF0 Vouches
25
0
0
Vouches
25
Posts
19,050
Likes
3,182
4 YEARS
4 YEARS OF SERVICE

JefferyHarpe

Elite member
Elite member
JefferyHarpe Rep
0
0
Rep
3
JefferyHarpe Vouches
0
0
0
Vouches
0
Posts
26
Likes
7
Bits
4 YEARS
4 YEARS OF SERVICE
(11 July, 2026 - 12:24 PM)Brave_Heart Wrote: Show MoreGLWS 
iu

Thank you, this source also comes with the all the code you need 

Quote:Full loader with anti‑debug/VM/sandbox checks

• Dynamic API resolution (PEB walk)

• NTFS MFT fast scan (Windows) + WalkDir fallback

• Partial encryption modes (first_last, chunked, sprinkle, header_only) with IOCTL reads and thread affinity tuning

• Data exfiltration (rclone, S3, GitHub, HTTP)

• Lateral movement with Mimikatz credential parsing and reuse (PsExec, WMI, GPO via ADSI)

• Advanced persistence and evasion (ProcessBreakOnTermination, service recovery, safe mode tampering, boot config deletion, Wldp patch)

• Branding (wallpaper, printer spam, icon change)

• Wiper module with USN journal clearing, secure deletion, and self‑deletion

• Process hollowing with PPID spoofing (injection module)

Everything is configurable via the embedded JSON or the GDAIR_CONFIG environment variable. Compile with cargo build --release. Use only on authorised, isolated research environments.

As a demonstration sample to the difference between malware vs a security tool. 

I alos have a 0 Day Exploit posted in another sales thread, along with a great combo tool kit for both hacking servers + spreading through supply chain attacks automated.

I'm not overpriced either. First customers will get a heavy discount, im leaving the 1st offer on each product open to the buy as long as its a fair amount.
 

EarlHickey

Divine
Divine
EarlHickey Rep
0
0
0
Rep
1101
EarlHickey Vouches
0
0
0
Vouches
0
Posts
14,267
Likes
7,229
Bits
4 YEARS
4 YEARS OF SERVICE

JefferyHarpe

Elite member
Elite member
JefferyHarpe Rep
0
0
Rep
3
JefferyHarpe Vouches
0
0
0
Vouches
0
Posts
26
Likes
7
Bits
4 YEARS
4 YEARS OF SERVICE
I've updated this source code a bit, here's there new feature list.

 

Complete Feature ReferenceThe Online Operator Panel (React Dashboard)The dashboard is a browser-based operator console built on React 18 / Vite / Recharts. It connects live to any agent on your fleet via authenticated HTTP.

Fleet Tab Live view of all agents discovered on the network. Shows deployment name, hostname, version, uptime, locked vs unlocked file counts, and TLS status per host. Syncs via 

Code:

Code:
POST /status

 and 

Code:

Code:
POST /discover-lan

. Includes a "Discover + Sync" button that sends UDP probes across the LAN and pulls status from every agent that responds.Files Tab Per-host file registry. Shows every tracked 

Code:

Code:
.lockmeta

 file, its state (Locked / Unlocked), original filename, ciphertext and plaintext SHA-256 hashes, the encryption scheme, KDF variant, build ID that locked it, and when it was last locked or unlocked. Data sourced from 

Code:

Code:
POST /files

.Analytics Tab Historical metrics pulled from 

Code:

Code:
POST /stats

: total lock/unlock/verify/failed operation counts, bytes locked and unlocked over time, file state distributions. Rendered with Recharts. Lets you spot anomalies — spikes in failed ops, unexpected unlock activity, etc.Keys Tab Public key fingerprints for each host. Deployment name, X25519 public key (base64), and SHA-256 fingerprint. Never exposes private key material. Sourced from 

Code:

Code:
POST /keys

.Remote Ops Tab The live command panel. Set the target agent address, bearer token, and optionally an operator Ed25519 signing key. Available operations:
- Unlock a single file by lockmeta path

- Unlock all tracked files on a host

- Upload and apply a new Code:

Code:
.unlock

 manifest (restore-time key upload)

- Rotate the deployment key pair (re-locks all files under a new key)

- Start a deploy job with build ID and optional integrity verification

- Poll deploy job status

- Adjust read/write timeouts and retry/backoff parameters per operation

Deploy Tab Deployment wizard backed by live 

Code:

Code:
POST /deploy/start

 and 

Code:

Code:
POST /deploy/status

 polling against real agents. Shows per-machine deploy stages: queued → uploading → installing → verifying → restarting → success/failed. Tracks up to 200 historical deployment records per host.Audit Tab Tamper-evident audit log pulled from 

Code:

Code:
POST /audit

. Up to 500 most recent entries per request. Each entry has a timestamp, event type, subject, success/failure flag, a SHA-256 of the detail, and a chained 

Code:

Code:
entry_hash

 that links each entry to the previous one — so you can detect if a log entry was deleted or modified.Transform Tab Exposes the metamorphic engine status. Shows the current build variant, selected KDF variant (V1–V8), chunk nonce variant, and hash verify variant. Links to the rule catalog with descriptions and semantic equivalence proofs.

Fleet Discovery Tab Live LWW table entries, per-strategy health (last run timestamp + last error for DNS, DGA, PortScan, DHT, Gossip), SWIM membership summary (alive/suspect/dead counts), and counters: findings accepted, rejected by signature, rejected as stale, gossip messages received/rejected, tamper attempts. Sourced from 

Code:

Code:
GET /fleet/discovery/status

. Includes a "Refresh" button that triggers 

Code:

Code:
POST /fleet/discovery/refresh

 to force an immediate CDN/DNS re-check.

Every Agent Is Its Own PanelEvery deployed host runs the same agent binary and exposes its own HTTP API — the full panel connects to it directly. Each agent hosts:

 

Code:

Code:
GET/POST /status — uptime, op counts, file summary GET/POST /files — full file registry GET/POST /stats — detailed statistics GET/POST /keys — public key fingerprint GET/POST /audit — chained tamper-evident audit log POST /unlock — single-file remote unlock POST /unlock-all — batch unlock all tracked files POST /upload-unlock — receive and apply an .unlock manifest POST /host-proof — Ed25519 challenge/response identity proof POST /rotate — rotate key pair and re-lock all files POST /deploy/start — start a deploy job POST /deploy/status — poll deploy job status POST /discover-lan — scan LAN via UDP for other agents POST /fleet/discovery/status — LWW table + strategy health + SWIM mesh status POST /fleet/discovery/refresh — force CDN/DNS re-scan POST /update/check — check for a newer binary at the configured manifest URL POST /update/apply — download and apply a self-update POST /backup/list — list encrypted backup records POST /backup/trigger — create a backup of a specific file POST /backup/restore — restore a backup record to disk POST /backup/delete — delete a backup record

Any agent can be addressed directly from the dashboard. Since agents bind to 

Code:

Code:
127.0.0.1:7777

 by default, the standard access pattern is an SSH tunnel — 

Code:

Code:
ssh -L 7777:localhost:7777 user@host

 — then connecting the dashboard to 

Code:

Code:
localhost:7777

. If TLS and operator signing keys are enrolled, agents can be reached over the open network.

Security at Every LayerAuthenticationEvery request carries a bearer token. The token is derived as:

 

Code:

Code:
HMAC-SHA256(agent_secret_b64, "gdair-agent-token-v2" || public_key_b64)

New deployments generate a random 256-bit 

Code:

Code:
agent_secret

 stored in the 

Code:

Code:
.unlock

 manifest. Legacy deployments without one fall back to a public-key-derived token. The token never changes unless the key is rotated.Signed Request ProofsWhen an operator public key is enrolled, every request must also include a 

Code:

Code:
RequestProof

 — an Ed25519 signature over:

 

Code:

Code:
method || path || token || SHA256(payload) || operator_pubkey || timestamp || nonce

The agent verifies the signature, checks the timestamp is within ±5 minutes, and maintains a nonce replay cache (10-minute window, persisted through restarts in the sealed registry). A replayed request with the same nonce is rejected even if the signature is valid.

Transport EnforcementPrivate-key endpoints (

Code:

Code:
/unlock

, 

Code:

Code:
/unlock-all

, 

Code:

Code:
/upload-unlock

, 

Code:

Code:
/rotate

) enforce transport policy before any crypto happens:
- Loopback peers (127.0.0.1, ::1) are always allowed — this is the SSH tunnel path

- Remote plaintext is rejected with HTTP 403

- Remote TLS is allowed only when operator signing keys are also enrolled — fail-closed, so TLS alone isn't enough

Rate LimitingA per-IP sliding-window rate limiter sits in front of every sensitive endpoint. 10 unlock attempts per IP per minute, 3 rotations per minute. Buckets are persisted in the sealed registry so a restart doesn't reset the counters — preventing restart-loop abuse.

Registry IntegrityThe persistent registry file is wrapped in a 

Code:

Code:
RegistryEnvelope

:

 

Code:

Code:
{ version, data_json, mac_sha256 }

The MAC is 

Code:

Code:
HMAC-SHA256(bearer_token, data_json)

. On load, the MAC is verified before any data is used. A tampered registry file is detected and discarded — the agent logs a warning and starts clean rather than importing poisoned state.Private Key HandlingThe master private key is never stored on the deployed host. When a remote unlock is issued, the key travels in the request body (over the SSH tunnel or TLS), is written to a temp file in 

Code:

Code:
/tmp

 with a UUID name, used for 

Code:

Code:
cmd_recover()

, and then deleted. The temp file path is never logged. The in-memory string is zeroized after use via 

Code:

Code:
zeroize::Zeroize

.Host IdentityEach agent generates a stable Ed25519 keypair on first boot, stored in the registry (mode 0600). The 

Code:

Code:
/host-proof

endpoint lets an operator issue a challenge (random 32+ bytes, base64) and receive a signed response over 

Code:

Code:
"gdair-host-proof:v1" || host_id || host_public_key || build_id || challenge

. This proves the agent is the same instance that enrolled, not an impersonator.Audit ChainEach audit log entry computes 

Code:

Code:
SHA256("gdair-agent-audit:v1" || entry_json)

 and stores it as 

Code:

Code:
entry_hash

. This hash is also stored as 

Code:

Code:
prev_hash

 in the next entry. Deleting or modifying an entry breaks the chain, which is detectable by the dashboard.

Binary Integrity (Startup + Runtime)Every time the binary starts it runs 

Code:

Code:
startup_check()

 before accepting any commands:

- Compiled baseline enforcement — if 

Code:

Code:
GDAIR_INTEGRITY_BASELINE_SCOPED_SHA256

 or 

Code:

Code:
GDAIR_INTEGRITY_BASELINE_WHOLE_SHA256

 was embedded at build time, the current binary is hashed (using 

Code:

Code:
goblin

 to extract ELF/PE/Mach-O code sections) and compared against the embedded baseline. A mismatch exits with code 

Code:

Code:
0x4753

 and a deliberately vague error message — it doesn't tell an attacker what failed.

- Companion hash file — if a 

Code:

Code:
.hash

 file exists alongside the binary, it is verified. Three record formats are supported:
- Code:

Code:
GDAIRS2\0

 scoped v2 — covers only executable code sections (not read-only data), Ed25519-signed or HMAC

- Code:

Code:
GDAIRS1\0

 v1 signed — whole-binary, Ed25519-signed

- Legacy HMAC — whole-binary, Code:

Code:
SHA256(HMAC_KEY || hash)

Signature verification uses an Ed25519 public key embedded at compile time via 

Code:

Code:
GDAIR_INTEGRITY_ED25519_PUBLIC_B64

. The HMAC key is embedded in the binary — not secret in the cryptographic sense but raises the cost of forging a replacement hash file.

- Hash comparisons are constant-time — 

Code:

Code:
diff |= x ^ y

 accumulation prevents timing oracles.

The Polymorphic / Metamorphic EngineThe Problem It SolvesEvery 

Code:

Code:
cargo build

 produces the same structural binary. A static analyst can find the KDF, identify the tag 

Code:

Code:
"gdair-ec-lock-v1"

 in 

Code:

Code:
.rodata

, and fingerprint every instance of the binary. The metamorphic engine makes each build structurally unique and each execution path different.Three LayersLayer 1 — Build-time variant selection

 

Code:

Code:
build.rs

 computes a 

Code:

Code:
GDAIR_BUILD_VARIANT

 (0–7) from the build timestamp XOR'd with the version string hash. Every 

Code:

Code:
cargo build

 — even from the same source — produces a different variant index, which gets baked into the binary as a compile-time constant.Layer 2 — Runtime seed mixing

At startup, 

Code:

Code:
runtime_seed()

 combines three entropy sources:

 

Code:

Code:
(nanosecond_timestamp as u64).rotate_left(21) ^ (process_pid as u64).rotate_left(7) ^ (build_time_variant as u64).wrapping_mul(0x9E3779B97F4A7C15)

The Knuth multiplicative hash constant is used to scatter the build variant across the full 64-bit space. The result is that the same binary selects a different structural path on every invocation.

Layer 3 — Structural variant dispatch

The 

Code:

Code:
MetamorphicEngine

 holds three selector values derived from the seed:
- Code:

Code:
kdf_variant

 (0–7): which of 8 KDF implementations to call

- Code:

Code:
chunk_nonce_variant

 (0–2): which of 3 nonce derivation implementations

- Code:

Code:
verify_hash_variant

 (0–2): which of 3 hash comparison implementations

All variants are mathematically proven to produce identical output. The 8 KDF variants cover meaningfully different code structures:

VariantStructureTechniqueV1Sequential 

Code:

Code:
update()

 callsBaselineV2Heap concat, single 

Code:

Code:
digest()

Different allocation patternV3Stack array (32-byte fast path)No heap allocationV4Byte-by-byte 

Code:

Code:
while

 loopRule CF-1: for→whileV5

Code:

Code:
iterator.fold()

Rule CF-4: loop→foldV6Chunks-of-4Mirrors streaming chunk patternV7

Code:

Code:
match

-based byte dispatchRules CF-2 + CF-5V8XOR-encoded domain tag, decoded at runtimeRule DE-2: tag never in 

Code:

Code:
.rodata

V8 is the most aggressive: the domain tag 

Code:

Code:
"gdair-ec-lock-v1"

 is XOR-masked with a per-build timestamp byte at rest, so the string never appears as a consecutive sequence in the binary's read-only data section. It's decoded one byte at a time at use.Startup Self-CheckBefore any cryptographic work, 

Code:

Code:
startup_self_check()

 runs:
- Hashes a fixed test vector through the selected KDF variant and verifies it matches V1

- Derives a nonce through the selected chunk_nonce variant and verifies it matches V1

- Runs both the good-hash and bad-hash case through the selected verify_hash variant

If any check fails, the engine returns an error and the agent refuses to start — you cannot accidentally run a broken structural variant against real data.

The 21 Transformation RulesThe 

Code:

Code:
transform

 CLI exposes the full rule catalog (

Code:

Code:
transform list

, 

Code:

Code:
transform show <ID>

, 

Code:

Code:
transform apply

). Rules span six categories:
- AS (Arithmetic Substitution) — algebraic equivalents: 

Code:

Code:
wrapping_add(b)

 → 

Code:

Code:
wrapping_sub(0.wrapping_sub(b))

, multiply-by-2 → left shift, AND via De Morgan, XOR constant encoding, integer splitting

- BS (Boolean Substitution) — equality via subtraction, De Morgan logical AND, negated inequality, branch-free select using bitmask arithmetic

- CF (Control Flow) — for→while, if/else→match, early-return→accumulator, loop→fold, match→function-pointer table

- DE (Data Encoding) — constant unfolding (65536 → 

Code:

Code:
1<<16

), XOR-encoded string literals

- OP (Opaque Predicates) — always-true via 

Code:

Code:
x*(x+1)

 even-product property, always-false via square non-negativity; both with dead decoy branches

- RI (Runtime Integrity) — binary self-hash, function-pointer GOT/PLT guard (RI-2), stack canary for key buffers

 

Code:

Code:
transform apply

 uses the 

Code:

Code:
syn

 crate to parse Rust AST before applying rewrites, and validates that the output still parses before writing anything to disk. It refuses to produce invalid Rust.RI-2 Runtime GuardsFor the highest-value code paths — the EC KDF entry points — 

Code:

Code:
runtime_guard.rs

 pins function addresses on first call and verifies them on every subsequent call:

 

Code:

Code:
// On first call: stores critical_fn as usize in a global map // On every call: compares current address to stored; Err if changed guard_function_entry("ec_kdf", ec_kdf as usize)?;

This detects GOT/PLT replacement attacks (inline hooks that redirect function calls to a malicious implementation) in-process, at the moment the function would be called. It also runs known-answer checks on the KDF output before returning key material. If either check fails, the operation returns an error rather than silently producing wrong output from a compromised code path.
 

179,167

126,023

1,405,739

Top