# From TinyGo to gc Compiler: Extending Zorya's Concolic Framework to Real-World Go Binaries

Crypto.world

> Most production Go software is compiled with the standard gc toolchain, whose runtime spawns multiple OS threads, uses cooperative and asynchronous preemption, and calls Linux VDSO functions that are…

**arXiv**: 2605.03492

**Published**: 2026-05-05

**Authors**: Karolina Gorna, Nicolas Iooss, Yannick Seurin, Rida Khatoun, Keith Makan

## AI summary

## Overview

**Research area:** Binary-level program analysis and software security — specifically concolic execution applied to Go binaries (CCS: software verification and validation; software security engineering).

**Technical level:** Advanced. It assumes familiarity with symbolic/concolic execution, SMT solving (Z3), intermediate representations (Ghidra P-Code), and Go runtime internals.

**Scope (one sentence):** The paper extends the Zorya concolic execution framework from single-threaded TinyGo binaries to multi-threaded binaries produced by Go's standard `gc` compiler, and evaluates it on 11 real-world Go vulnerabilities against seven other analysis tools.

## What This Paper Is About

Most production Go software is compiled with the standard `gc` toolchain, whose runtime spawns multiple OS threads, uses cooperative and asynchronous preemption, and calls Linux VDSO functions that are not present in the ELF file. These properties broke earlier versions of Zorya, which only handled the minimal, single-threaded runtime of TinyGo. The paper's goal is to make concolic execution work on realistic, multi-threaded `gc` binaries, and to test whether that produces vulnerability detections that existing Go tools and binary symbolic executors miss.

## Key Contributions

1. **Concolic analysis of `gc`-compiled binaries.** Zorya is extended to multi-threaded Go binaries via three mechanisms: restoring per-thread OS state (registers, thread-local storage bases, backtraces) from `gdb` dumps, neutralizing runtime preemption before entering the target function, and handling binaries that must be analyzed with `main-only` or `round-robin` thread scheduling.
2. **Overlay path analysis with copy-on-write semantics.** A lightweight overlay lets Zorya execute the *untaken* side of a conditional branch for a bounded number of P-Code instructions (default 15) without cloning the full execution state, which can exceed 1 GiB for `gc` binaries with large heaps. Only registers and memory bytes actually modified are copied.
3. **A real-world Go vulnerability dataset.** A corpus of 11 vulnerabilities from production projects, derived from actual bug-fix commits, spanning 4 nil-pointer dereferences, 4 integer overflows, and 3 index-out-of-bounds cases, with reproduction workflows and triggering inputs.
4. **A comparative evaluation.** Zorya is benchmarked against seven tools: three static analyzers (`staticcheck`, `gosec`, `nilaway`), two fuzzers (`go test -fuzz`, `GoLibAFL`), and two binary-level symbolic executors (`BINSEC` v0.10.1, `SymQEMU`).

## Main Findings

- **7 of 11 vulnerabilities detected:** Zorya finds four nil-pointer dereferences, one integer overflow, and two index-out-of-bounds panics in `gc`-compiled, multi-threaded binaries. All 11 runs used the `main-only` scheduling policy.
- **Split between detection mechanisms:** Of the 7 primary detections, 4 come from the Analyzer Routine on the concretely *taken* path and 3 from AST panic-reachability on the *not-taken* branch.
- **A unique silent-overflow detection:** The integer overflow in Go-Ethereum v1.6.0's `memoryGasCost` is found purely through symbolic expressions on an `INT_MULT` P-Code instruction; Z3 confirms it in 0.39 s. No other evaluated tool finds it without a manually written oracle, because Go wraps unsigned arithmetic silently by specification.
- **Overlay side findings:** Overlay execution surfaces 10 side findings across 6 binaries — 2 caught within the 15-instruction depth limit (`kubelet-2025` at depth 3, `geth-graphql-2025` at depth 2) and 8 only after an AST fallback once the depth limit was reached. Five binaries produced no side finding; `p224-elliptic` and `fasthttp` halt on heavy runtime helpers.
- **Static analyzers detect none of the 11 bugs:** `staticcheck` and `gosec` catch nothing; `gosec`'s G115 rule covers type-conversion overflows (e.g. `uint64` to `int`) but not same-type arithmetic overflow. `nilaway` finds two Go-Ethereum nil-pointer dereferences but cannot analyze Kubernetes packages due to dependency resolution failures.
- **Binary symbolic executors detect none:** `BINSEC` and `SymQEMU` both lack support for Go's runtime primitives.
- **Fuzzers catch one bug Zorya misses:** `go test -fuzz` and `GoLibAFL` detect `kube-sm-2025`, whose vulnerable path traverses `runtime.memmove`, exhausting Zorya's resources before the fault site. Fuzzers win on speed (0.18 s for `go test -fuzz`, roughly 7 s for `GoLibAFL`, roughly 2 s for `nilaway`), while Zorya averages 16.5 minutes — but Zorya is fully automatic, needs no per-function harness, and emits an exact instruction-level execution trace.
- **Correctness posture:** Zorya is sound for the concrete path but best-effort on overlays (it may miss bugs beyond the depth limit or produce false positives from under-constrained symbolic variables), and incomplete by design since it follows a single concrete trace.

## Methodology in Plain English

Zorya takes a compiled binary, converts it into Ghidra's P-Code intermediate representation (about 70 opcodes), and then walks through it instruction by instruction with two parallel values: a real concrete value from a `gdb` memory dump, and a symbolic expression held by the Z3 solver. The concrete value decides which way the program actually goes; the symbolic expression records the conditions that would have to hold for that route to be taken.

To make this work on standard Go binaries, the authors first snapshot every OS thread the Go runtime has started and classify each by its backtrace: the thread running `main.main` is the main thread, the `runtime.sysmon` thread is the system monitor, and the rest are waiting. They then disable preemption so the garbage collector and scheduler do not interrupt the analysis while it works through the target function.

For branches the concrete run did not take, they use an *overlay*: a thin copy-on-write layer over the current machine state. Reads check the overlay first and fall through to the base state; writes go only to the overlay, and the whole thing is thrown away afterwards. Inside the overlay they run up to 15 P-Code instruction blocks and check for null-pointer loads and stores and for multiplication overflow — widening both 64-bit symbolic operands to 128 bits and asking Z3 whether the upper half of the product can be non-zero. If no bug turns up within the depth limit, they scan the AST from the branch target for `panic`, `fatal`, or `abort` call sites and check satisfiability (e.g. `nilpanic`, `panicIndex`).

Soundness bookkeeping matters here: during overlay execution, SAT results (confirmed nullable pointers) are kept, because such a bug is real regardless of path, while UNSAT results are discarded, since the negated branch may make previously safe pointers nullable.

The benchmark was built by taking actual bug-fix commits, reading the root cause from the commit message and patch, and compiling the vulnerable version with the Go toolchain that was current when the fix was reported. For standalone applications the full production binary was used; for libraries, an example program from the official repository that exercises the faulty path. All analyses ran on 64-bit Linux with an Intel Core i9-12900K (24 threads, 3.2 GHz) and 125 GiB of RAM, using Zorya v0.0.5 and Ghidra v12.

## Why This Matters

**Impact on research:** The paper shows that a language-agnostic IR (P-Code) plus thread-state recovery can cross the gap that has kept binary symbolic executors away from the Go ecosystem. It also isolates a category — silent arithmetic wrapping — that neither static analyzers nor fuzzers catch without a manually supplied oracle or a modified compiler, and that produces no crash signal to guide a fuzzer. Because Zorya works on P-Code, the same machinery applies to C and C++ binaries, which rely solely on overlay execution since they lack Go's panic infrastructure.

**Real-world applications:**

- Auditing cloud-native infrastructure binaries such as Kubernetes components (the corpus includes `kubectl-2025` at 106 MB and `kubelet-2025` at 121 MB) and CoreDNS.
- Verifying blockchain and smart-contract tooling, where the Go-Ethereum gas-cost overflow and Tendermint issues originate.
- Checking third-party or vendor-supplied Go executables where source is unavailable, since Zorya needs no harness and only a `gdb` dump.
- Pre-deployment hardening of Go libraries whose bugs surface in downstream binaries, using the released corpus of triggering inputs as regression material.

**Industry relevance:** The evaluation binaries come from the cloud and blockchain ecosystems and all have over 5,000 GitHub stars, so the results speak directly to the code that ships in production infrastructure. The paper also documents a gap that tool vendors can act on: BINSEC needs symbolic support for additional syscalls and CPU instructions, SymQEMU needs support for Go's cooperative preemption and multi-threaded initialization, and KLEE or SymCC would need a functional Go-to-LLVM-IR compiler front-end.

## Future Directions

- **Symbolic summaries and checkpointing.** Reaching a deep bug requires executing every preceding instruction, so summarizing heavy runtime helpers and adding lightweight checkpoints are the two natural mitigations. Symbolizing local variables would also broaden the detectable surface.
- **Calibrating the overlay depth.** The 15-instruction exploration depth is fixed and needs principled calibration; the fact that 8 of 10 side findings required an AST fallback after hitting the limit suggests it should be increased. The authors note the approach suits paths gated by nested conditionals.
- **More vulnerability classes and concurrency.** Division by zero and use-after-free can be added by extending the set of inspected P-Code operations (both are implemented but not yet evaluated), and the `round-robin` scheduler remains unevaluated against concurrency-bug classes.
- **Broader evaluation, including C corpora and learning-based detectors.** A more extensive evaluation on C corpora is planned, and the authors flag that comparing against machine-learning bug-detection models would be relevant but fundamentally different in approach.

## Target Audience

Vulnerability researchers and binary-analysis tool builders working on symbolic or concolic execution; Go security engineers and maintainers of cloud-native or blockchain infrastructure who need to audit compiled artifacts; compiler and runtime specialists interested in how Go's goroutine scheduling, preemption, and VDSO calls obstruct program analysis; and graduate students or practitioners already comfortable with SMT solvers and intermediate representations who want a concrete case study in adapting an analysis engine to a language runtime.

## Authors’ abstract

Zorya is a concolic execution framework that lifts compiled binaries to Ghidra's P-Code intermediate representation and uses the Z3 SMT solver to detect vulnerabilities by reasoning over both concrete and symbolic values. Previous versions supported only single-threaded TinyGo binaries. In this paper, we extend Zorya to multi-threaded binaries produced by Go's standard gc compiler. This is achieved by restoring OS thread states from gdb dumps, neutralizing runtime…

[The full abstract on arXiv](https://arxiv.org/abs/2605.03492)

[Read the original paper](https://arxiv.org/abs/2605.03492)

---

Canonical: https://crypto.world/paper/from-tinygo-to-gc-compiler-extending-zorya-s-concolic-framework-to-real-2605.03492
