Go / Rust binary reversing
When it applies
You have a stripped binary in scope (tradecraft-scope-roe, scope.txt) and triage
(reverse-eng-binary-triage) shows Go or Rust residue — a Go malware sample, a Rust release
build, a Go-compiled red-team tool. Generic decompilation drowns you in runtime code; these
languages carry enough metadata to rebuild the symbol map first.
Why it works
Both toolchains ship binaries that are mostly runtime, but both embed rich metadata: Go keeps the
pclntab (function names, file:line, type info) even when the symbol table is stripped, and Rust
leaks panic strings with full source paths. Recovering that metadata turns an anonymous blob back
into named functions, and the runtime residue itself fingerprints the language and version.
Method
- Fingerprint the language.
- Go:
strings for go.buildid, runtime., src/.../*.go paths, Go buildinf.
- Rust:
strings for rust_begin_unwind, panicked at, /rustc/<hash>/library/... paths,
crate names in src/*.rs paths.
- Go: recover symbols from pclntab. Run GoReSym (
GoReSym -t target) or redress to parse
pclntab/moduledata → function names, types, package list; import the output into IDA/Ghidra
(Go helper plugins apply it as names/types). Then anchor at runtime.main → main.main and
work outward into the main.* package — skip the runtime.*/crypto/*/net/http library
code except to note which libraries are linked (crypto and net paths hint at C2 and key handling).
- Rust: drive from panic strings. Each
panicked at '...', src/foo.rs:LINE:COL string is a
file:line anchor — xref it to land inside real logic. Collect Option/Result unwrap sites
the same way.
- Read idioms, not just code.
- Go strings are (pointer, length) pairs — not NUL-terminated; slices are (ptr, len, cap);
interfaces are (itab, data). A "two arguments" call passing a string is really one string.
- Rust generics explode one function into many monomorphized copies — don't analyze each;
follow string xrefs to the copy that matters. Async (tokio) compiles to state machines;
reconstruct flow via cross-references, not linear reading.
- Dynamic confirms. gdb and Frida both work, but mind Go's scheduler: goroutines hop OS
threads, so break on a string usage (log line, config key, crypto input) rather than chasing
a thread. Config/log strings are the best breakpoint anchors in both languages.
Gotchas
- Packed first, language second — UPX et al. hide the pclntab; unpack before GoReSym
(
reverse-eng-deobfuscation).
- Malware corrupts moduledata (zeroed magic, moved pclntab) specifically to break GoReSym —
locate pclntab by its magic bytes in the section and repair, or fall back to string-driven analysis.
- Don't get lost in the runtime — most functions in the binary are library code. If a function
has no path to attacker input or secrets, move on.
- Stripped Rust gives almost nothing back — panic strings and crate paths are the map;
rename functions as you identify them or the picture doesn't survive.
Verify success
Key functions are renamed (or you hold an equivalent offset→purpose map), the language/runtime
evidence is recorded (build ID, compiler version, linked packages), and you can state where
attacker-controlled input and the interesting crypto/network logic live.
References
GoReSym & redress documentation; Go pclntab/moduledata format writeups; Rust panic ABI notes.
Portions adapted from reverse-skill by zhaoxuya520, MIT License.
1---2name: reverse-eng-go-rust3description: >4 Reverse stripped Go and Rust binaries — recover symbols from pclntab/moduledata and panic5 metadata, then navigate language-specific idioms. Load when a stripped ELF/PE/Mach-O shows Go6 or Rust runtime residue. Signals: "go.buildid", "runtime.main" / "main.main", "panic:" or7 "rust_begin_unwind" strings, /rustc/ or src/*.rs paths, huge static binary with no symbols,8 Go malware, a Rust release build.9domain: reverse-engineering10type: technique11stability: learning12modes: [pentest, bugbounty]13severity: medium14mitre: [T1027]15tools: [goresym, redress, ida, ghidra, radare2, gdb, frida]16schema_version: 117metadata:18 source: https://skillmd.com/skills/noorqureshi/reverse-eng-go-rust19---2021# Go / Rust binary reversing2223## When it applies24You have a stripped binary in scope (`tradecraft-scope-roe`, `scope.txt`) and triage25(`reverse-eng-binary-triage`) shows Go or Rust residue — a Go malware sample, a Rust release26build, a Go-compiled red-team tool. Generic decompilation drowns you in runtime code; these27languages carry enough metadata to rebuild the symbol map first.2829## Why it works30Both toolchains ship binaries that are mostly runtime, but both embed rich metadata: Go keeps the31pclntab (function names, file:line, type info) even when the symbol table is stripped, and Rust32leaks panic strings with full source paths. Recovering that metadata turns an anonymous blob back33into named functions, and the runtime residue itself fingerprints the language and version.3435## Method361. **Fingerprint the language.**37 - Go: `strings` for `go.buildid`, `runtime.`, `src/.../*.go` paths, `Go buildinf`.38 - Rust: `strings` for `rust_begin_unwind`, `panicked at`, `/rustc/<hash>/library/...` paths,39 crate names in `src/*.rs` paths.402. **Go: recover symbols from pclntab.** Run GoReSym (`GoReSym -t target`) or redress to parse41 pclntab/moduledata → function names, types, package list; import the output into IDA/Ghidra42 (Go helper plugins apply it as names/types). Then anchor at `runtime.main` → `main.main` and43 work outward into the `main.*` package — skip the `runtime.*`/`crypto/*`/`net/http` library44 code except to note which libraries are linked (crypto and net paths hint at C2 and key handling).453. **Rust: drive from panic strings.** Each `panicked at '...', src/foo.rs:LINE:COL` string is a46 file:line anchor — xref it to land inside real logic. Collect `Option`/`Result` unwrap sites47 the same way.484. **Read idioms, not just code.**49 - Go strings are (pointer, length) pairs — not NUL-terminated; slices are (ptr, len, cap);50 interfaces are (itab, data). A "two arguments" call passing a string is really one string.51 - Rust generics explode one function into many monomorphized copies — don't analyze each;52 follow string xrefs to the copy that matters. Async (tokio) compiles to state machines;53 reconstruct flow via cross-references, not linear reading.545. **Dynamic confirms.** gdb and Frida both work, but mind Go's scheduler: goroutines hop OS55 threads, so break on a *string usage* (log line, config key, crypto input) rather than chasing56 a thread. Config/log strings are the best breakpoint anchors in both languages.5758## Gotchas59- **Packed first, language second** — UPX et al. hide the pclntab; unpack before GoReSym60 (`reverse-eng-deobfuscation`).61- **Malware corrupts moduledata** (zeroed magic, moved pclntab) specifically to break GoReSym —62 locate pclntab by its magic bytes in the section and repair, or fall back to string-driven analysis.63- **Don't get lost in the runtime** — most functions in the binary are library code. If a function64 has no path to attacker input or secrets, move on.65- **Stripped Rust gives almost nothing back** — panic strings and crate paths *are* the map;66 rename functions as you identify them or the picture doesn't survive.6768## Verify success69Key functions are renamed (or you hold an equivalent offset→purpose map), the language/runtime70evidence is recorded (build ID, compiler version, linked packages), and you can state where71attacker-controlled input and the interesting crypto/network logic live.7273## References74GoReSym & redress documentation; Go pclntab/moduledata format writeups; Rust panic ABI notes.7576---77_Portions adapted from [reverse-skill](https://github.com/zhaoxuya520/reverse-skill) by zhaoxuya520, MIT License._