Aller au contenu
Skillpedia
Sécurité35k · #7614

analyzing-golang-malware-with-ghidra

Ce qu’il fait

Cet outil vous aide à analyser les programmes écrits en langage Go (Golang) qui pourraient être malveillants. Il extrait des informations importantes, comme les noms de fonctions et les bibliothèques utilisées, même si le programme essaie de cacher ces détails.

Quand l’utiliser

  • ✓Lorsque vous enquêtez sur un programme Go suspect.
  • ✓Lorsque vous devez savoir quelles bibliothèques utilise un programme Go.
  • ✓Pour retrouver les noms de fonctions qui ont été masqués dans un programme Go.

Lien du skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/analyzing-golang-malware-with-ghidra/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/analyzing-golang-malware-with-ghidra/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Analyse ce programme Go suspect, dis-moi quelles bibliothèques il utilise et essaie de retrouver les noms des fonctions.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'outil recherche des informations précises dans le programme Go. Il lit des structures de données comme « pclntab » et « buildinfo » pour trouver les noms de fonctions et les détails sur les bibliothèques utilisées par le programme.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

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

#!/usr/bin/env python3
"""Analyze Go binary metadata for malware analysis."""
import struct
import sys
import re


def find_go_build_info(data):
    """Extract Go build information from binary."""
    # Go buildinfo magic: \xff Go buildinf:
    magic = b'\xff Go buildinf:'
    offset = data.find(magic)
    if offset == -1:
        return None

    print(f"[+] Go build info at offset 0x{offset:x}")

    # Extract Go version string nearby
    go_version = re.search(rb'go\d+\.\d+(?:\.\d+)?', data[offset:offset+256])
    if go_version:
        print(f"  Go Version: {go_version.group().decode()}")

    return offset


def find_pclntab(data):
    """Locate the pclntab (PC Line Table) structure."""
    # pclntab magic bytes vary by Go version
    magics = {
        b'\xfb\xff\xff\xff\x00\x00': "Go 1.2-1.15",
        b'\xfa\xff\xff\xff\x00\x00': "Go 1.16-1.17",
        b'\xf1\xff\xff\xff\x00\x00': "Go 1.18-1.19",
        b'\xf0\xff\xff\xff\x00\x00': "Go 1.20+",
    }

    for magic, version in magics.items():
        offset = data.find(magic)
        if offset != -1:
            print(f"[+] pclntab found at 0x{offset:x} ({version})")
            return offset, version

    return None, None


def extract_function_names(data, pclntab_offset):
    """Extract function names from pclntab."""
    if pclntab_offset is None:
        return []

    functions = []
    # Function name strings follow specific patterns
    func_pattern = re.compile(
        rb'(?:main|runtime|fmt|net|os|crypto|encoding|io|sync|'
        rb'syscall|reflect|strings|bytes|path|time|math|sort|'
        rb'github\.com|golang\.org)[/\.][\w/.]+',
    )

    for match in func_pattern.finditer(data):
        name = match.group().decode('utf-8', errors='replace')
        if len(name) > 4 and len(name) < 200:
            functions.append(name)

    return sorted(set(functions))



…
Questions fréquentes

Qu'est-ce que Ghidra ?

Ghidra est un outil gratuit de rétro-ingénierie qui aide à comprendre le fonctionnement des programmes, même sans leur code d'origine.

Que signifie « rétro-ingénierie » ?

C'est le processus qui consiste à décomposer un programme pour comprendre son fonctionnement interne, un peu comme démonter un appareil pour voir ses composants.

Pourquoi le langage Go est-il utilisé pour les logiciels malveillants ?

Go est populaire parce qu'il crée des programmes capables de fonctionner sur de nombreux systèmes sans avoir besoin d'autres éléments (compilation statique) et qu'il peut être plus difficile à analyser.

Détails

Description originale de l’auteur

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, deobfuscating a garble-packed Go binary, or recovering function names and third-party dependencies from a str

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularité

Étoiles GitHub
35k
Position au classement
#7614
Licence
Apache-2.0
Mis à jour
31/08/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires