Unlocking the secrets of stripped Go binaries at runtime
Alex M (Researcher · Foundry Zero)
RE//verse 2026 · Day 1 · Coral Ballroom A
Overview
This article delves into the intricacies of reverse engineering Go binaries, particularly focusing on techniques for analyzing stripped executables at runtime. Presented by Alex M, a security researcher at Foundry Zero, this talk at RE//verse highlights the challenges posed by Go’s unique architecture and runtime characteristics, which often confound traditional reverse engineering tools and methodologies. The core of the presentation introduces a novel approach that synergizes static analysis insights with dynamic debugging capabilities, culminating in the release of an open-source LLDB extension called Clef.

Key moments
- 0:00 Introduction: Challenges of Go reverse engineering
- 6:40 Understanding Go's unique ABI and calling conventions
- 10:00 Go binaries contain a goldmine of runtime metadata
- 20:30 Painful manual dynamic analysis: Identifying deserialized objects
- 29:58 Introducing Clef: A smarter dynamic analysis tool for Go
- 36:50 Clef live demo: Automated Go type and function recovery
- 41:00 Analyzing Garble-obfuscated Go binaries with Clef
- 49:00 Q&A: Clef compatibility with GDB/LLDB server
Unlocking the secrets of stripped Go binaries at runtime
Speakers: Alex M, Researcher, Foundry Zero
Conference: RE//verse
YouTube: https://www.youtube.com/watch?v=9frLKI6uZEQ
Overview
This article delves into the intricacies of reverse engineering Go binaries, particularly focusing on techniques for analyzing stripped executables at runtime. Presented by Alex M, a security researcher at Foundry Zero, this talk at RE//verse highlights the challenges posed by Go’s unique architecture and runtime characteristics, which often confound traditional reverse engineering tools and methodologies. The core of the presentation introduces a novel approach that synergizes static analysis insights with dynamic debugging capabilities, culminating in the release of an open-source LLDB extension called Clef.
The talk addresses a critical need within the cybersecurity community: as Go gains traction in both legitimate software development and malware campaigns, the ability to efficiently analyze these binaries becomes paramount. While Go offers memory safety and performance benefits, its specialized compiler and managed runtime create a distinct reverse engineering landscape. Alex M demonstrates that by understanding Go’s internal metadata structures, it's possible to unlock a wealth of information—even from binaries stripped of conventional debugging symbols—and integrate this knowledge directly into a dynamic debugger for a significantly improved analysis workflow.
This talk is particularly relevant for reverse engineers, malware analysts, and vulnerability researchers who frequently encounter Go binaries. It argues for a blended static and dynamic analysis approach, showcasing how combining the rich metadata inherent in Go executables with the runtime visibility of a debugger can transform a typically painful process into a much more productive and insightful experience. The shared tooling, Clef, aims to democratize access to these advanced Go reverse engineering techniques.
Background
▶ Watch: Introduction: Challenges of Go reverse engineering (0:00)
The landscape of modern software development increasingly features languages like Go, Rust, and others that offer memory safety and high performance. While beneficial for developers, these languages often present unique challenges for reverse engineers accustomed to C/C++ binaries. Go, despite being 16 years old, is still considered "new" by many reverse engineers due to its distinct characteristics. When a Go binary lands on an analyst's desk, traditional tools like Ghidra often struggle, producing highly unreadable decompiled code with generic function names and incorrect calling conventions.
Several factors contribute to the difficulty of reverse engineering Go binaries:
- Managed Runtime: Go includes a runtime environment for garbage collection and other memory management tasks, which introduces overhead and custom internal structures not found in C/C++.
- Static Typing: While Go has a static typing system, its representation at runtime requires specific parsing.
- Non-Null-Terminated Strings: Unlike C strings, Go strings are typically stored as a pointer to data and a separate length value. This often leads decompilers to misinterpret string data, showing massive, continuous blocks of characters.
- Statically Linked by Default: Go binaries are often statically linked, meaning all necessary library code is bundled into the executable. This results in very large binaries with thousands of internal functions, without the aid of external symbols for imported functions that are common in dynamically linked C/C++ applications.
- Unique ABI: Go implements its own Application Binary Interface (ABI), which differs significantly from standard C ABIs (e.g., System V or Microsoft ABI). This ABI is not guaranteed to remain stable between Go versions. For 64-bit platforms, it switched from stack-based to register-based calling conventions in 2021. Function calls can return multiple values, and structs passed by value can have their member fields split across multiple registers. The specific register ordering (e.g., RAX, RBX, RCX, RDI, RSI, R8, R9 for x86-64 integer arguments) is also unique to Go. More complex types or large arrays may still be passed on the stack.
Despite these hurdles, Go binaries contain a "goldmine" of metadata, even when stripped of standard debugging information. This metadata is embedded for the Go runtime environment to function correctly, enabling features like error message display and reflection. Key pieces of recoverable information include:
- Function Names: The names of nearly every function used by Go are present.
- Data Type Definitions: Crucially, Go binaries retain definitions for structs, maps, and other complex data types. This includes meaningful names for every field within a struct and reliable type information, which is invaluable for understanding program data structures.
- Not Position-Independent by Default: By default, Go binaries are not compiled as Position-Independent Executables (PIE), which simplifies aligning static analysis results with dynamic debugger addresses.
Leveraging this embedded metadata, several open-source static analysis tools have emerged:
- GoReversing (Mandiant, now Google): A Go-native tool designed to recover compiler versions, function names, and data types, outputting in human-readable or JSON format. It aims to stay current with Go version changes by using internal Go APIs.
- Redress: Another tool that recovers similar metadata, also offering a plugin for Radare2 to aid dynamic analysis.
- Decompiler Scripts: Tools like Ghidra and Binary Ninja have community-contributed scripts (e.g., NCC Group's Go Strings, Trellix Art team's scripts) that attempt to recover symbols and type information. However, these often have limitations, such as failing to correctly identify Go's ABI or specific type structures, as demonstrated in the talk with a Ghidra example failing to find type structures.
While static tools can recover much, dynamic analysis offers the ability to interrogate runtime state, providing concrete answers to questions about program behavior. However, performing manual dynamic analysis on Go binaries with general-purpose debuggers is notoriously painful:
- Delve: Go's de facto debugger, Delve, is described as "fiddly and fussy." Its support for stripped binaries is a recent "hack," and it's not designed for general reverse engineering. A major limitation is its strict version compatibility, requiring a Delve version within n-2 of the target Go binary, making it impractical for older or diverse targets.
- GDB: While functional, GDB can be unstable, especially during remote debugging sessions.
- LLDB: Chosen by the speaker as the most stable debugger for experiments, LLDB is the debugger for the LLVM project and is increasingly the default in many SDKs (Android Studio, Xcode). It is multi-platform (Linux, macOS, Windows, BSDs) and uses the GDB server protocol, but its command-line interface differs frustratingly from GDB, requiring a new muscle memory. A critical step for Go debugging with LLDB is to tell it to ignore signals, as they are used internally by the Go runtime for cross-thread communication.
The speaker's experience highlighted that even with static tools providing some information, answering specific runtime questions (like the exact port a UDP server listens on, or the precise structure of a JSON object being deserialized) still required tedious manual debugger interaction, often involving deep dives into Go's complex internal data structures. This gap—the ability to automatically bridge static metadata with dynamic runtime state—is what the presented tool, Clef, aims to fill.
Key Findings
▶ Watch: Go binaries contain a goldmine of runtime metadata (10:00)
The central finding of this research is that despite the complexities and obfuscation attempts, Go binaries inherently contain a significant amount of rich metadata crucial for reverse engineering, even when stripped of traditional debugging symbols. This metadata, embedded for the Go runtime's own operation, can be systematically extracted and leveraged.
The talk demonstrated that manual dynamic analysis of Go binaries, while possible, is exceptionally time-consuming and error-prone. Interrogating runtime state to understand data types, function arguments, and return values requires intimate knowledge of Go's unique ABI and internal data structures, such as string headers, slice types, eface interfaces, type metadata, module data, and the Program Counter Line Table (PCLNTAB). The process of manually correlating register values with Go's complex type system, navigating nested offsets, and interpreting variable-length integers is a significant barrier to efficient analysis.
The key contribution is the realization that the information recoverable by static analysis tools (function names, type definitions) can be seamlessly integrated into a dynamic debugger. This led to the development of Clef, an LLDB extension that automates the interpretation of Go's runtime state. Clef's core capabilities include:
- Automated Function Annotation: It automatically annotates function names at breakpoints, providing immediate context.
- Go ABI Handling: It understands and correctly interprets Go's unique calling conventions, accurately identifying function arguments and return values.
- Dynamic Type Parsing: Most significantly, Clef automatically identifies, parses, and displays the contents of complex Go objects in memory, leveraging the embedded type metadata. This includes recursively unpacking nested structs and arrays.
- Go Call Stack Unwinding: It correctly unwinds Go's non-standard call stack, providing meaningful stack traces.
- Robustness: Clef is designed to work across various Go versions, major CPU architectures, and operating systems, with minimal external dependencies.
Finally, the research explored the impact of obfuscation, specifically using Garble, a popular open-source Go obfuscator. It found that while obfuscation makes analysis significantly harder by stripping symbols and clobbering magic bytes, it does not entirely eliminate the inherent type metadata. Clef demonstrated a partial ability to recover and display the structural information of objects even in heavily obfuscated binaries, highlighting the enduring value of dynamic type analysis in such challenging scenarios.
Technical Deep Dive
▶ Watch: Introducing Clef: A smarter dynamic analysis tool for Go (29:58)
Understanding the technical foundation of Go's runtime and how its metadata is structured is crucial for effective reverse engineering. Clef's effectiveness stems from its deep understanding and automated parsing of these internal Go structures.
Go ABI and Runtime Structures:
At the heart of Go's runtime are several key data structures that deviate significantly from C/C++ conventions:
- Strings: A Go string is not null-terminated but rather a
stringHeaderstruct, comprising aDatapointer (to the raw byte sequence) and aLeninteger (the length of the string). When passed as arguments, these two fields often occupy separate registers (e.g., RAX and RBX on x86-64). - Slices: Go's dynamic arrays are represented by a
slicetype, which is a struct containing a pointer to the underlying array data, aLen(current length), and aCap(total capacity of the underlying array). - Interfaces (
eface): When an object of "any" type (interface{}) is passed around, Go uses anefacestructure. This struct contains two pointers: one to Go type metadata (_typestruct) describing the object's type, and another to the actual data itself. Thisefaceis fundamental to Go's reflection capabilities and dynamic type handling.
Go Type Metadata (_type struct):
The _type struct is a comprehensive descriptor for every distinct type in a Go binary. Clef leverages this by recursively parsing its fields:
kind: This is a crucial field, an enum value packed into the lower five bits of a byte. It indicates the basic category of the type (e.g.,_KindPtr,_KindStruct,_KindArray,_KindString).- Type-Specific Fields: Depending on the
kind, the_typestruct will have additional fields. For instance: - A pointer type (
_KindPtr) will have anelemfield, which is a pointer to the_typestruct of the element it points to, allowing recursive type resolution. - A struct type (
_KindStruct) will contain afieldsslice, which is an array of pointers tostructFieldentries. EachstructFielddescribes a member of the struct, including itsname, itstype(another pointer to a_typestruct), and itsoffsetwithin the parent struct. This enables Clef to reconstruct the entire structure and its field names. str(Name Offset): This field is not a direct string but anameOffvalue, an offset into a global string table. Resolving this requires understandingmodule data.
Module Data (moduledata struct):
The moduledata structure is a central repository of metadata about a Go executable's layout. It resides in the initialized data section of the binary. Key fields include:
types: A pointer to an array oftype name entries, which collectively form a large blob containing all type definitions.typelinks: To navigate the variable-length_typedefinitions within thetypesblob,typelinksprovides an array ofint32offsets. By iterating throughtypelinksand adding the offset to the base address oftypes, Clef can reliably locate and parse each distinct type definition.pclntab(Program Counter Line Table) Header: The first value ofmoduledatais a pointer to thePCLNTABheader.
Program Counter Line Table (PCLNTAB):
The PCLNTAB is primarily used by the Go runtime for generating stack traces during panics by mapping program counter addresses to source code line numbers. For reverse engineering, it's a critical source of function information:
- Function Table: The
PCLNTABcontains an offset to a function table. This table maps function entry points (offsets within the.textsection) to correspondingfuncheaders. funcHeader: Eachfuncheader contains further metadata about a specific function, including anothernameOfffield. ThisnameOffis an offset into a separate blob of function names also pointed to from thePCLNTABheader. By iterating through the function table and resolving thesenameOffvalues, Clef can recover the names of all functions in the binary.- Stack Unwinding: The
PCLNTABalso contains information necessary for correctly unwinding Go's unique call stack, which differs from standard operating system conventions.
Clef's Implementation:
The LLDB extension, Clef (open-source on GitHub), is built upon these principles:
- Initial Scan: Upon loading a Go binary, Clef performs an initial scan to locate the
moduledataandPCLNTABstructures. This often involves searching for known magic bytes or section names (e.g.,__go_typelinkfor macOS, or pattern matching for Windows PE files). - Type Pre-processing: Using
moduledata.typesandmoduledata.typelinks, Clef recursively parses all distinct_typedefinitions. It followselempointers for composite types and deciphersstructFieldentries for structs, building a comprehensive internal model of all Go data types, including their field names and offsets. - Function Name Recovery: Via the
PCLNTABand its function tables, Clef extracts and maps all function entry points to their corresponding names. - Runtime Annotation: During a debugging session, when a breakpoint is hit, Clef automatically:
- Annotates the current instruction with the recovered function name.
- Inspects registers and stack for common Go structures (e.g.,
stringHeader,slice,eface). - If an
efaceis detected, it automatically follows the type metadata pointer, parses the_typestruct, and uses its pre-processed type definition to display the contents of the underlying object in a human-readable format. - Unwinds the Go call stack, presenting a correct and meaningful stack trace.
- Version Robustness: A significant challenge is Go's frequent internal changes. Clef addresses this by incorporating multiple parsers for
PCLNTAB(e.g., three different header/function table parsers) andmoduledata(e.g., five, now six, distinct parsers) to accommodate different Go versions (e.g., Go 1.18 to 1.24, and now 1.25/1.26). - Limitations & Future Work: Explicit type metadata is not always included on function calls; Clef tries to remember data pointer-to-type relationships or offers manual commands as a fallback. Stack unwinding currently primarily supports x86-64, though other features work across ARM, PowerPC, etc. Future plans include better obfuscation handling and beacon awareness for Go standard library function signatures.
The development of Clef, largely an intern project at Foundry Zero, represents a significant step forward in making Go reverse engineering more accessible and efficient by automating the tedious process of interpreting Go's complex runtime structures.
Demo / Proof of Concept
▶ Watch: Clef live demo: Automated Go type and function recovery (36:50)
The talk's demonstration effectively illustrated the stark contrast between manual Go binary analysis and the streamlined workflow provided by Clef. The speaker posed two practical questions about a sample Go UDP server:
- What UDP port is the server listening on?
- What is the structure of the JSON object being deserialized by
json.Unmarshal?
The Pain of Manual Dynamic Analysis (Part 1 Review):
To answer the first question manually, one would set a breakpoint on net.resolveUDPAddress. Knowing its signature (two strings), the analyst would then manually inspect registers (e.g., RAX/RBX for the first string, RCX/RDI for the second on x86-64). Since Go strings are Data pointer + Len, this involves reading RAX for the pointer, RBX for the length, then using an LLDB memory read command (memory read --force --format byte --outfile /dev/stdout --size <RBX value> <RAX value>) to get the string "UDP". Repeating for the second string (RCX/RDI) would reveal "12852". This is tedious but relatively straightforward.
The second question, concerning the JSON object, is where manual analysis becomes excruciatingly complex. Breaking on json.Unmarshal, the first argument would be a Go slice (byte slice containing the JSON data), represented by a Data pointer, Len, and Cap across three registers. Manually extracting this would reveal the JSON string. The second argument, however, is an any type (an eface). This eface would be split across registers (e.g., RDI for the type metadata pointer, RSI for the data pointer).
To understand the object's structure, the analyst would then need to:
- Read the
_typemetadata pointer from RDI. - Parse the
_typestruct: read itskindfield (a 5-bit enum in a byte), mask out higher bits, and cross-reference with Go source code to identify it (e.g.,_KindPtrfor a pointer type, which typically points to a struct). - Read the
strfield (anameOff) from the_typestruct. - Locate the
module datastructure (often by findingPCLNTABfirst, asmodule datapoints to its header). - Use
module data.typesand thenameOffvalue to calculate the actual memory address of the type name. - Account for a flags byte and then read a variable-length integer for the string length.
- Finally, read the UTF-8 string, which might reveal
main.logentry. - With the type name, one could then manually correlate with
Redressoutput to get the full struct definition.
This multi-step, offset-heavy, and version-dependent process took the speaker "well over an hour" for just one object, even knowing what to look for.
Clef's Automated Solution (Part 2 Demo):
Clef dramatically simplifies this. When the same Go UDP server binary is run with Clef-enhanced LLDB:
- For
net.resolveUDPAddress: Upon hitting the breakpoint, the LLDB screen immediately shows: - A well-populated stack trace with Go function names.
- Automatic detection of Go strings in RAX and RCX. Clef directly displays their content: "UDP" and "12852". The port number is instantly visible.
- For
json.Unmarshal: - Clef detects the byte slice argument and displays its content as a string (the JSON data).
- Crucially, for the
efaceargument in RDI, Clef automatically identifies it as a type pointer and immediately displays the full, parsed type information:main.logentry, including its fields (timestamp,service,level,message,statusCode) and their respective types (string,string,string,string,int). Initially, the values are zeroed as the unmarshaling hasn't occurred. - After single-stepping past the
json.Unmarshalcall, Clef updates the display, showing themain.logentryobject fully populated with the deserialized values (e.g.,timestamp: 2024-01-01T12:34:56Z,service: web,level: info,message: Request processed,statusCode: 200). This transformation from opaque register values to a fully structured and typed object happens automatically.
Obfuscation Demo with Garble:
The demo extended to a Garble-obfuscated version of the same binary. Garble performs several obfuscations:
- Replaces symbols with base64 hashes or removes them entirely.
- Removes Go version information.
- Clobbers PCLNTAB magic bytes.
- Can obfuscate string literals and control flow.
When Clef was applied to a "very obfuscated" Garble binary:
- Function names were largely replaced with junk or blanked out, but some runtime functions remained identifiable.
- Despite the clobbered names, Clef could still successfully hit breakpoints on relevant logic.
- Critically, when hitting the
json.Unmarshalequivalent (whose name was obfuscated), Clef still managed to parse theefaceand display the type structure ofmain.logentry, even though the field names within the struct were also obfuscated. This demonstrated that while obfuscation makes understanding what the fields are named difficult, Clef can still reveal that an object of a certain structure exists and what types its fields are, providing invaluable insights into data flow.
The demo conclusively proved that Clef transforms Go reverse engineering from a grueling manual process into a highly automated and insightful experience, even offering partial utility against obfuscated targets.
Defensive Implications
▶ Watch: Q&A: Clef compatibility with GDB/LLDB server (49:00)
The increasing adoption of Go in both legitimate applications and malicious software (such as various malware families) presents a significant challenge for cybersecurity defenders. Traditional reverse engineering tools and techniques, optimized for C/C++ binaries, often falter when confronted with Go's unique architecture. The research and tooling presented by Alex M have several crucial defensive implications:
- Enhanced Malware Analysis: For malware analysts, the ability to quickly and accurately understand the internal workings of Go-based malware is paramount. Clef allows analysts to rapidly identify critical data structures, API calls, and control flow within stripped Go executables. This accelerates the process of understanding malware capabilities, developing detection signatures, and devising countermeasures. The automated parsing of complex Go types means analysts spend less time deciphering raw memory and more time understanding malicious logic.
- Vulnerability Research: Vulnerability researchers can leverage Clef to better understand the internal state of Go applications. Identifying the exact data types being processed, especially for inputs like JSON, can reveal potential parsing vulnerabilities, deserialization flaws, or logic bugs that might be obscure in a raw disassembly. The ability to unwind Go's stack correctly also aids in tracing execution paths leading to vulnerabilities.
- Overcoming Obfuscation: While Go obfuscators like Garble aim to hinder analysis, this research demonstrates that they don't completely eliminate all useful metadata. Clef's ability to still parse and display type structures (even if field names are garbled) provides defenders with a crucial foothold. Knowing the structure and types of fields within a deserialized object, for instance, can still inform an analyst about the expected data format, even if the semantic meaning of each field is hidden. This forces obfuscators to evolve beyond mere string/symbol stripping.
- Blending Static and Dynamic Analysis: The talk strongly advocates for integrating static and dynamic analysis. Defenders should invest in tools and methodologies that leverage the rich static metadata inherent in Go binaries (recoverable by tools like GoReversing or Redress) and combine it with the runtime visibility offered by debuggers enhanced with Go-specific knowledge (like Clef). This hybrid approach provides the most comprehensive view of a Go program.
- Tooling Development and Adoption: The release of Clef as an open-source tool encourages broader adoption and further development within the security community. Defenders can integrate Clef into their existing LLDB-based workflows, reducing the learning curve for Go analysis. The project's awareness of Go version changes (requiring multiple parsers) highlights the ongoing need for maintainable, adaptive tools in this space.
In essence, Clef empowers defenders by providing specialized, automated insights into Go binaries that were previously accessible only through painstaking manual effort or not at all. This translates to faster incident response, more robust vulnerability discovery, and a more effective defense posture against Go-based threats.
Key Takeaways
- Go binaries are a double-edged sword for reverse engineers: While challenging due to their unique ABI, managed runtime, and static linking, they contain a wealth of embedded metadata (function names, comprehensive type definitions) even when stripped, which is a "goldmine" for analysis.
- Manual dynamic analysis of Go binaries is extremely painful: Interrogating runtime state requires deep, manual understanding of Go's complex internal structures (string headers, slice types,
efaceinterfaces, type metadata, module data, PCLNTAB) and tedious register/memory inspection. - Clef significantly enhances Go dynamic debugging: This open-source LLDB extension automates the extraction and display of Go metadata at runtime, transforming a tedious process into a productive one. It handles Go's calling convention, annotates function names, and correctly unwinds stack traces.
- Automated type parsing is a game-changer: Clef automatically identifies, parses, and recursively displays complex Go objects in memory, leveraging the embedded
_typemetadata to reveal full struct definitions, field names, and their types. - Obfuscation is a hurdle, but not insurmountable: Tools like Garble can strip symbols and clobber metadata, but Clef demonstrates that even in heavily obfuscated binaries, the underlying type structures can still be recovered and displayed at runtime, providing valuable insights into data flow.
- A blended static and dynamic approach is optimal: Combining the power of static metadata recovery with dynamic runtime inspection, as demonstrated by Clef, is the most effective strategy for reverse engineering modern Go binaries.
About the Speaker(s)
Alex M is a Security Researcher at Foundry Zero, a UK-based company specializing in low-level security research and development. He is also a self-described "newbie speaker," expressing gratitude for the opportunity to present his research at RE//verse. His work focuses on understanding and analyzing the security implications of modern programming languages and their runtime environments.
Reviews
Dr. Zero (Offensive Security Researcher) — SOLID
Alex M built an LLDB extension that actually makes debugging stripped Go binaries tolerable. Instead of spending hours manually walking PCLNTAB and eface structs in memory, Clef parses the runtime type metadata and unwinds the stack for you. It's a highly practical, necessary tool for anyone looking at modern Go malware.
Heather Calloway (CISO) — STRONG ACCEPT
My incident response team is seeing a massive spike in Go-based malware, and traditional reverse engineering tooling hasn't kept pace. This research delivers a highly practical debugger extension that automates Go binary analysis. It isn't a board-level topic, but it will significantly reduce the time my analysts spend unpacking payloads during an active breach.