analyzing-golang-malware-with-ghidra

analyzing-golang-malware-with-ghidra is a skill for Claude Code from killvxk/cybersecurity-skills-zh. It costs 56 tokens per session (2,888 once invoked), scanned A, original, Apache-2.0.

A malware-analysis workflow for examining Go programs with Ghidra, a reverse-engineering tool, including stripped or obfuscated compiled files.

In plain words
What is it for?
It helps recover functions, extract strings and dependencies, inspect Go metadata, and reconstruct types in suspicious binaries.
Why use it?
It addresses the difficulty of understanding large Go binaries when function names and other symbols are missing or deliberately obscured.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the cybersecurity-skills-zh plugin — 58 skills shipped together

Good fit It helps recover functions, extract strings and dependencies, inspect Go metadata, and reconstruct types in suspicious binaries.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/killvxk/cybersecurity-skills-zh/analyzing-golang-malware-with-ghidra
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add killvxk/cybersecurity-skills-zh --skill analyzing-golang-malware-with-ghidra
Clone the repo
git clone --depth 1 https://github.com/killvxk/cybersecurity-skills-zh

Made for: Claude Code.

Or install cybersecurity-skills-zh, the plugin that ships this one along with the rest of its 58 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for analyzing-golang-malware-with-ghidra

README.md
[![agentmods](https://agentmods.dev/badge/skills/killvxk/cybersecurity-skills-zh/analyzing-golang-malware-with-ghidra/github.svg)](https://agentmods.dev/skills/killvxk/cybersecurity-skills-zh/analyzing-golang-malware-with-ghidra)
Your own site
<a href="https://agentmods.dev/skills/killvxk/cybersecurity-skills-zh/analyzing-golang-malware-with-ghidra"><img src="https://agentmods.dev/badge/skills/killvxk/cybersecurity-skills-zh/analyzing-golang-malware-with-ghidra/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for analyzing-golang-malware-with-ghidra

Your own site · 80×15
<a href="https://agentmods.dev/skills/killvxk/cybersecurity-skills-zh/analyzing-golang-malware-with-ghidra"><img src="https://agentmods.dev/badge/skills/killvxk/cybersecurity-skills-zh/analyzing-golang-malware-with-ghidra.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,888 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00056 $0.02888
Opus 5 $0.00028 $0.01444
Sonnet 5 $0.00011 $0.00578
Haiku 4.5 $0.00006 $0.00289

Measured 12d ago against content hash 7d0fc8252baf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

analyzing-golang-malware-with-ghidra scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/agent.py, scripts/process.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/analyzing-golang-malware-with-ghidra/SKILL.md · 291 lines

How it starts

The opening of the file, as written. The whole thing — 291 lines — stays where its author put it; the contents beside it link to each section on GitHub.

使用 Ghidra 分析 Golang 恶意软件

概述

Go(Golang)因其跨平台编译能力、生成自包含二进制文件的静态链接以及逆向工程的复杂性,成为恶意软件作者的热门语言。Go 二进制文件包含整个运行时、标准库和所有依赖项的静态链接,产生大型二进制文件(通常 5-15MB),包含数千个函数。Ghidra 在处理 Go 特有的字符串格式(非空终止符)、去符号的函数名和 goroutine 并发模式时存在困难。Volexity 开发的 GoResolver 等专用工具使用控制流图相似性在去符号或混淆的 Go 二进制文件中自动去混淆并恢复函数名。

前置条件

  • Ghidra 11.0+,配合 JDK 17+
  • GoResolver 插件(用于函数名恢复)
  • Go 逆向工程工具包(go-re.tk)
  • Python 3.9+(用于辅助脚本)
  • 了解 Go 运行时内部机制(goroutine、channel、interface)
  • 熟悉 Go 二进制文件结构(pclntab、moduledata、itab)

核心概念

Go 二进制文件结构

Go 二进制文件在 pclntab(PC 行表)结构中嵌入了丰富的元数据,将程序计数器映射到函数名、源文件和行号。即使去符号表的二进制文件也保留此元数据。moduledata 结构包含指向类型信息、itab(接口表)和 pclntab 本身的指针。Go 字符串以指针-长度对的形式存储,而非以空字符结尾的 C 字符串。

去符号表二进制文件中的函数恢复

尽管去除了符号表,Go 二进制文件仍在 pclntab 中保留函数名。然而,garble 等混淆工具会将函数重命名为随机字符串。GoResolver 通过计算混淆函数的控制流图签名,并与已知 Go 标准库和第三方包函数的数据库进行匹配来解决此问题。

包/依赖项提取

Go 的依赖管理将模块路径和版本字符串嵌入二进制文件。提取这些信息可揭示恶意软件的第三方依赖(HTTP 库、加密包、C2 框架),在不进行完整逆向工程的情况下了解其能力。

实操步骤

步骤 1:初始二进制分析

#!/usr/bin/env python3
"""分析 Go 二进制文件元数据用于恶意软件分析。"""
import struct
import sys
import re


def find_go_build_info(data):
    """从二进制文件提取 Go 构建信息。"""
    # Go buildinfo 魔数:\xff Go buildinf:
    magic = b'\xff Go buildinf:'
    offset = data.find(magic)
    if offset == -1:
        return None

    print(f"[+] Go 构建信息位于偏移 0x{offset:x}")

    # 提取附近的 Go 版本字符串
    go_version = re.search(rb'go\d+\.\d+(?:\.\d+)?', data[offset:offset+256])
    if go_version:
        print(f"  Go 版本:{go_version.group().decode()}")

    return offset


def find_pclntab(data):
    """定位 pclntab(PC 行表)结构。"""
    # pclntab 魔数字节随 Go 版本而变化
    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 位于 0x{offset:x}({version})")
            return offset, version

    return None, None


def extract_function_names(data, pclntab_offset):
    """从 pclntab 提取函数名。"""
    if pclntab_offset is None:
        return []

    functions = []
    # 函数名字符串遵循特定模式
    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))


def extract_go_strings(data):
    """提取 Go 风格字符串(指针+长度对)。"""
    # Go 字符串不以空字符结尾;提取可读序列
    strings = []
    ascii_pattern = re.compile(rb'[\x20-\x7e]{10,}')

    for match in ascii_pattern.finditer(data):
        s = match.group().decode('ascii')
        # 过滤出有趣的恶意软件字符串
        interesting = [
            'http', 'https', 'tcp', 'udp', 'dns',
            'cmd', 'shell', 'exec', 'upload', 'download',
            'encrypt', 'decrypt', 'key', 'token', 'password',
            'c2', 'beacon', 'agent', 'implant', 'bot',
            'mutex', 'persist', 'registry', 'scheduled',
        ]
        if any(kw in s.lower() for kw in interesting):
            strings.append(s)

    return strings


def extract_dependencies(data):
    """从二进制文件提取 Go 模块依赖项。"""
    deps = []
    # 模块路径遵循模式:github.com/user/repo
    dep_pattern = re.compile(
        rb'((?:github\.com|gitlab\.com|golang\.org|gopkg\.in|'
        rb'go\.etcd\.io|google\.golang\.org)/[^\x00\s]{5,80})'
    )

    for match in dep_pattern.finditer(data):
        dep = match.group().decode('utf-8', errors='replace')
        deps.append(dep)

    unique_deps = sorted(set(deps))
    return unique_deps


def analyze_go_binary(filepath):
    """对 Go 恶意软件二进制文件进行完整分析。"""
    with open(filepath, 'rb') as f:
        data = f.read()

    print(f"[+] 正在分析 Go 二进制文件:{filepath}")
    print(f"  文件大小:{len(data):,} 字节")
    print("=" * 60)

    # 构建信息
    find_go_build_info(data)

    # pclntab
    pclntab_offset, go_version = find_pclntab(data)

    # 函数
    functions = extract_function_names(data, pclntab_offset)
    print(f"\n[+] 恢复了 {len(functions)} 个函数名")

    # 分类函数
    categories = {
        "network": [], "crypto": [], "os_exec": [],
        "file_io": [], "main": [], "third_party": [],
    }
    for f in functions:
        if 'net/' in f or 'http' in f.lower():
            categories["network"].append(f)
        elif 'crypto' in f:
            categories["crypto"].append(f)
        elif 'os/exec' in f or 'syscall' in f:
            categories["os_exec"].append(f)
        elif 'os.' in f or 'io/' in f:
            categories["file_io"].append(f)
        elif f.startswith('main.'):
            categories["main"].append(f)
        elif 'github.com' in f or 'golang.org' in f:
            categories["third_party"].append(f)

    for cat, funcs in categories.items():
        if funcs:
            print(f"\n  [{cat}]({len(funcs)} 个函数):")
            for fn in funcs[:10]:
                print(f"    {fn}")

    # 依赖项
    deps = extract_dependencies(data)
    print(f"\n[+] 依赖项({len(deps)} 个):")
    for dep in deps[:20]:
        print(f"    {dep}")

    # 可疑字符串
    sus_strings = extract_go_strings(data)
    print(f"\n[+] 可疑字符串({len(sus_strings)} 个):")
    for s in sus_strings[:20]:
        print(f"    {s}")


if __name__ == "__main__":
    if len(sys.argv) < 2:
        print(f"用法:{sys.argv[0]} <go_binary>")
        sys.exit(1)
    analyze_go_binary(sys.argv[1])

Read the full file on GitHub · 291 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 291 lines · 56 tokens per session scan A 7d0fc8252baf

Subscribe to this mod's changes

analyzing-golang-malware-with-ghidra is a skill published in the GitHub repository killvxk/cybersecurity-skills-zh (45 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 56 tokens to every session and 2,888 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

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, deobfuscating a…

mukul975/Anthropic-Cybersecurity-Skills · 95 tokens

analyzing-golang-malware-with-ghidra

Reverse engineer Go-compiled malware using Ghidra with specialized scripts for function recovery, string extraction, and type reconstruction in stripped Go binaries.

plurigrid/asi · 40 tokens

analyzing-golang-malware-with-ghidra

Reverse engineer Go-compiled malware using Ghidra with specialized scripts for function recovery, string extraction, and type reconstruction in stripped Go binaries.

26zl/cybersec-toolkit · 40 tokens

analyzing-golang-malware-with-ghidra

Use when reverse engineer Go-compiled malware using Ghidra with specialized scripts for function recovery, string extraction, and type reconstruction in stripped Go binaries. Use when reverseing engineer go-compiled malware using ghidra with specialized scripts for.

oyi77/1ai-skills · 60 tokens

analyzing-golang-malware-with-ghidra

Reverse engineer Go-compiled malware using Ghidra with specialized scripts for function recovery, string extraction, and type reconstruction in stripped Go binaries.

autohandai/community-skills · 40 tokens

analyzing-golang-malware-with-ghidra

Reverse engineer Go-compiled malware using Ghidra with specialized scripts for function recovery, string extraction, and type reconstruction in stripped Go binaries.

pinkpixel-dev/skills-collection-1 · 40 tokens