analyzing-golang-malware-with-ghidra

Reverse engineer Go-compiled malware in Ghidra by parsing Go buildinfo and pclntab structures, recovering stripped/obfuscated function names (e.g. via GoResolver), and extracting embedded module/dependency strings and types from Go binaries. Use when analyzing a Go-language malware sample, deobfusca

By mukul975 · 429 installs

npx skills add mukul975/anthropic-cybersecurity-skills --skill analyzing-golang-malware-with-ghidra

Source repository · Upstream listing

Analyzing Golang Malware with Ghidra Overview Go (Golang) has become a popular language for malware authors due to its cross compilation capabilities, static linking that produces self contained binaries, and the complexity it introduces for reverse engineering. Go binaries contain the entire runtime, standard library, and all dependencies statically linked, resulting in large binaries (often 5 15MB) with thousands of functions. Ghidra struggles with Go specific string formats (non null terminated), stripped function names, and goroutine concurrency patterns. Specialized tools like GoResolver (Volexity, 2025) use control flow graph similarity to automatically deobfuscate and recover function names in stripped or obfuscated Go binaries. When to Use When investigating security incidents that require analyzing golang malware with ghidra When building detection rules or threat hunting queries for this domain When SOC analysts need structured procedures for this analysis type When validating security monitoring coverage for related attack techniques Prerequisites Ghidra 11.0+ with JDK 17+ GoResolver plugin (for function name recovery) Go Reverse Engineering Tool Kit (go re.tk) Python 3.9+ for helper scripts Understanding of Go runtime internals (goroutines, channels, interfaces) Familiarity with Go binary structure (pclntab, moduledata, itab) Key Concepts Go Binary Structure Go binaries embed rich metadata in the pclntab (PC Line Table) structure, which maps program counters to function names, source files, and line numbers. Even stripped binaries retain this metadata. The moduledata structure contains pointers to type information, itabs (interface tables), and the pclntab itself. Go strings are stored as a pointer length pair rather than null terminated C strings. Function Recovery in Stripped Binaries Despite stripping symbol tables, Go binaries retain function names within the pclntab. However, obfuscation tools like garble rename functions to random strings. GoResolver addresses this by computing control flow graph signatures of obfuscated functions and matching them against a database of known Go standard library and third party package functions. Crate/Dependency Extraction Go's dependency management embeds module paths and version strings in the binary. Extracting these reveals the malware's third party dependencies (HTTP libraries, encryption packages, C2 frameworks), which provides insight into capabilities without full reverse engineering. Workflow Step 1: Initial Binary Analysis Step 2: Ghidra Analysis Script Validation Criteria Go version and build information extracted from binary pclntab located and parsed for function name recovery Third party dependencies identified revealing malware capabilities Main package functions enumerated for targeted analysis Network, crypto, and OS exec functions categorized Ghidra analysis correctly labels Go runtime structures References [CUJO AI Reverse Engineering Go Binaries with Ghidra](https://cujo.com/blog/reverse engineering go binaries with ghidra/) [Volexity GoResolver](https://www.volexity.com/blog/2025/04/01/goresolver using control flow graph similarity to deobfuscate golang binaries automatically/) [Go Reverse Engineering Tool Kit](https://go re.tk/about/) [SentinelOne AlphaGolang](https://www.sentinelone.com/labs/alphagolang a step by step go malware reversing methodology for ida pro/) [Go Binary Reversing Notes](https://gist.github.com/0xdevalias/4e430914124c3fd2c51cb7ac2801acba)