मुख्य सामग्री पर जाएँ
Skillpedia
सिक्योरिटी35k · #7614

analyzing-golang-malware-with-ghidra

यह क्या करती है

यह टूल Go (Golang) भाषा में लिखे उन प्रोग्रामों की जाँच करने में मदद करता है जो शायद हानिकारक हों। यह फ़ंक्शन के नाम और इस्तेमाल हुई लाइब्रेरी जैसी ज़रूरी जानकारी निकालता है, भले ही प्रोग्राम इन बातों को छिपाने की कोशिश करे।

कब इस्तेमाल करें

  • ✓किसी संदिग्ध Go प्रोग्राम की जाँच करते समय।
  • ✓यह समझने के लिए कि कोई Go प्रोग्राम कौन सी लाइब्रेरी इस्तेमाल कर रहा है।
  • ✓छिपाए गए फ़ंक्शन के नाम वापस निकालने के लिए।

Skill का लिंक

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

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/analyzing-golang-malware-with-ghidra/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“इस संदिग्ध Go प्रोग्राम का विश्लेषण करो और बताओ कि यह कौन सी लाइब्रेरी इस्तेमाल करता है, और फ़ंक्शन के नाम वापस निकालने की कोशिश करो।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह टूल Go प्रोग्राम के अंदर खास जानकारी ढूँढता है। यह 'pclntab' और 'buildinfo' जैसे डेटा ढाँचों को पढ़ता है, ताकि फ़ंक्शन के नाम और प्रोग्राम द्वारा इस्तेमाल की गई लाइब्रेरी के बारे में जानकारी मिल सके।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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))



…
अक्सर पूछे जाने वाले सवाल

Ghidra क्या है?

Ghidra एक मुफ़्त रिवर्स इंजीनियरिंग टूल है, जो प्रोग्राम कैसे काम करता है यह समझने में मदद करता है, भले ही आपके पास उसका असली कोड न हो।

'रिवर्स इंजीनियरिंग' का क्या मतलब है?

यह किसी प्रोग्राम को अलग-अलग हिस्सों में खोलकर समझने की प्रक्रिया है कि वह अंदर से कैसे काम करता है, जैसे किसी मशीन को खोलकर उसके पुर्ज़े देखना।

मैलवेयर के लिए Go का इस्तेमाल क्यों होता है?

Go इसलिए लोकप्रिय है क्योंकि इससे बने प्रोग्राम बिना बाहरी हिस्सों पर निर्भर हुए कई तरह के सिस्टम पर चल जाते हैं (इसे statically compiled कहते हैं), और इनका विश्लेषण करना मुश्किल हो सकता है।

जानकारी

लेखक का मूल विवरण

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

लोकप्रियता

GitHub स्टार
35k
रैंकिंग में स्थान
#7614
लाइसेंस
Apache-2.0
अपडेट की गई
31/8/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills