Repository navigation
Releases
First Release
Release Notes — v1.0.0
Release date: 2026-10-07
Tag: v1.0.0
First stable release of Garble with the experimental stack-based virtualization (VM) pipeline and a full anti-reverse-engineering hardening layer for virtualized functions.
Highlights
- Virtualization VM — selected functions compile to custom stack bytecode and run through an embedded dispatcher instead of native machine code
- Control-flow flattening — indirect dispatch tables, decoy targets, optional opaque decoy edges
- Anti-RE hardening — polymorphic opcodes, position-dependent encoding, integrity checks, handler duplication, and more
- Safe by default — unsupported functions stay native; feature off means zero impact on the binary
- Reproducible builds — deterministic output for a fixed seed
Virtualization
Virtualization is opt-in and experimental at the language surface, but the runtime model is production-tested for the supported subset.
Enable
GARBLE_EXPERIMENTAL_VIRTUALIZE=1 garble build -o app.exe ./...Mark functions
//garble:virtualize
func sensitive(a, b int) int {
return a + b
}What ships in the binary
- Encoded bytecode (not native ISA)
- Specialized interpreter / dispatch loop
- Signature-preserving wrappers
- Native bridges for calls back to ordinary Go
- Optional flattened dispatch tables
Supported subset (summary)
| Supported | Not supported (left native) |
|---|---|
| Package-level functions | Methods, closures, init / main |
| Integers, bool, float32/64 | Pointers, slices, maps, strings, structs |
| Arithmetic, bitwise, compares | Generics, variadic, interfaces |
| Direct virtual / native calls | Builtins, heap-escaping locals |
Eligibility is checked before mutation. A directive on an unsupported function is a safe no-op.
Floating-point
- Full
float32/float64arithmetic and comparison (ops at float64 precision where applicable) - Floating-point remainder via
OpRemF(math.Modsemantics) - Typed nil for numeric/bool types treated as zero
Anti-RE hardening (VM)
New in this line of work and included in v1.0.0:
| Feature | Description |
|---|---|
| Polymorphic opcodes | Per-seed permutation of logical → wire opcodes |
| Position-dependent encoding | Per-instruction keys from (baseKey, pc) |
| Separate immediate mixing | Operand pad ≠ opcode pad |
| Environment-mixed keys | Host-derived material folded into key schedule |
| Multi-layer dispatch tables | Independent table keys (affine encoding) |
| Integrity checksum | Refuse to run if bytecode was patched |
| Hash-chained block metadata | Per-PC chain hashes at compile time |
| Handler order shuffle | Emitted switch case order is seed-permuted |
| Handler duplication | Alternate wire forms / duplicate cases |
| Junk switch cases | Unreachable arms with opaque guards |
| Opaque predicates | Always-true / always-false paths in the dispatcher |
| Scrambled dispatcher CFG | State-machine step around fetch/decode |
| Instruction splitting | e.g. const c → (c^k) XOR k |
| Decoy native bridges | Never-called stubs in the native table |
| Nested virtualization | OpNested secondary blobs under a nested key |
| Stronger flatten defaults | Larger table padding; decoy edges available |
Not in scope for v1.0.0: anti-debugging (debugger detection or intentional behavior change under debug).
Control-flow flattening
When virtualization is enabled, flattening rewrites bytecode CFGs into state + DISPATCH form:
# default: flattening on
GARBLE_EXPERIMENTAL_VIRTUALIZE=1 garble build ./...
# disable flattening
GARBLE_EXPERIMENTAL_VMFLATTEN=0 garble build ./...
# flattening + decoy edges
GARBLE_EXPERIMENTAL_VMFLATTEN=decoys garble build ./...Flattening is semantics-preserving and rolls back the whole program on failure.
Recommended release build
GARBLE_EXPERIMENTAL_VIRTUALIZE=1 \
garble -literals -tiny -seed=random \
build -trimpath -ldflags="-s -w" -o app.exe ./...| Flag | Purpose |
|---|---|
-literals |
Obfuscate string literals |
-tiny |
Smaller binary |
-seed=random |
Fresh polymorphism each build |
-trimpath |
Strip local paths |
-ldflags="-s -w" |
Strip symbols and DWARF |
Use a fixed -seed=... when you need bit-for-bit reproducible artifacts.
Compatibility
- Go toolchain: as declared in
go.mod(this tree targets modern Go; use the version required by the module) - Platforms: same as upstream garble /
go build(Windows, Linux, macOS, …) - Compose with control-flow:
GARBLE_EXPERIMENTAL_CONTROLFLOWand virtualization can run together; they obfuscate different layers (source CFG vs bytecode CFG)
Performance notes
Virtualization is not free. Integer/loop-heavy workloads can see a clear slowdown versus native code (often on the order of several times, workload-dependent). Prefer virtualizing sensitive helpers rather than the entire program. See docs/VIRTUALIZATION_BENCHMARKS.md for indicative size and runtime numbers.
Safety
- Feature flag off → no VM code, no behavioral change
- Unsupported function → left native, build continues
- Verify failures → hard build error, not half-transformed functions
- Interpreter and emitted dispatcher are covered by equivalence tests
Upgrade notes
If you were using an earlier experimental snapshot of the VM:
- Re-test any
//garble:virtualizetargets under v1.0.0 (encoding and hardening tables changed) - Expect different bytecode for the same seed only if you mix old/new trees; within v1.0.0, fixed seed ⇒ stable output
- Binaries built with older experimental VM builds are not expected to match v1.0.0 encoding