agentflocks/flocks/reverse-engineering-malware-with-ghidra
Claude Code and agent skill by agentflocks/flocks
- community
Checking that the SKILL.md file is still in the repository.
'Reverse engineers malware binaries using NSA''s Ghidra disassembler and decompiler to understand internal logic,
Install
npx vskill@latest install agentflocks/flocks/reverse-engineering-malware-with-ghidraSKILL.md
The same SKILL.md was published earlier as agentflocks/flocks/reverse-engineering-malware-with-ghidra.
Reverse Engineering Malware with Ghidra
When to Use
- Static and dynamic analysis have identified suspicious functionality that requires deeper code-level understanding
- You need to reverse engineer C2 communication protocols, encryption algorithms, or custom obfuscation
- Understanding the exact exploit mechanism or vulnerability targeted by a malware sample
- Extracting hardcoded configuration data (C2 addresses, encryption keys, campaign IDs) embedded in compiled code
- Developing precise YARA rules or detection signatures based on unique code patterns
Do not use for initial triage of unknown samples; perform static analysis with PEStudio and behavioral analysis with Cuckoo first.
Prerequisites
- Ghidra 11.x installed (download from https://ghidra-sre.org/) with JDK 17+
- Analysis VM isolated from production network (Windows or Linux host)
- Familiarity with x86/x64 assembly language and Windows API conventions
- PDB symbol files for Windows system DLLs to improve decompilation accuracy
- Ghidra scripts repository (ghidra_scripts) for automated analysis tasks
- Secondary reference: IDA Free or Binary Ninja for cross-validation of analysis results
Workflow
Step 1: Create Project and Import Binary
Set up a Ghidra project and import the malware sample:
Headless analysis for automation:
Step 2: Identify Key Functions and Entry Points
Navigate the binary to locate critical code sections:
Ghidra keyboard shortcuts for efficient navigation:
Step 3: Analyze Decompiled Code
Use Ghidra's decompiler to understand function logic:
Step 4: Trace C2 Communication Logic
Follow the network communication code path:
Ghidra Script for extracting C2 configuration:
Step 5: Analyze Encryption and Obfuscation
Identify and document cryptographic routines:
Step 6: Document Findings and Create Detection Signatures
Produce actionable intelligence from reverse engineering:
Key Concepts
| Term | Definition | |
|---|---|---|
| Disassembly | Converting machine code bytes into human-readable assembly language instructions; Ghidra's Listing view shows disassembled code | |
| Decompilation | Lifting assembly code to pseudo-C representation for easier analysis; Ghidra's Decompile window provides this view | |
| Cross-Reference (XREF) | Reference showing where a function or data address is called from or used; essential for tracing code execution flow | |
| Control Flow Graph (CFG) | Visual representation of all possible execution paths through a function; reveals branching logic and loops | |
| Original Entry Point (OEP) | The actual start address of the malware code after unpacking; packers redirect execution through an unpacking stub first | |
| Function Signature | The return type, name, and parameter types of a function; applying correct signatures improves decompiler output quality | |
| Ghidra Script | Python or Java automation script executed within Ghidra to perform batch analysis, pattern searching, or data extraction |
Tools & Systems
- Ghidra: NSA's open-source software reverse engineering suite with disassembler, decompiler, and scripting support for multiple architectures
- IDA Pro/Free: Industry-standard interactive disassembler; IDA Free provides x86/x64 cloud-based decompilation
- Binary Ninja: Commercial reverse engineering platform with modern UI and extensive API for plugin development
- x64dbg: Open-source x64/x32 debugger for Windows used alongside Ghidra for dynamic debugging of malware
- FindCrypt (Ghidra Plugin): Plugin that identifies cryptographic constants and algorithms in binary code
Common Scenarios
Scenario: Reversing Custom C2 Protocol
Context: Behavioral analysis shows encrypted traffic to an external IP on a non-standard port. Network signatures cannot detect variants because the protocol is proprietary. Deep reverse engineering is needed to understand the protocol structure.
Approach:
- Import the unpacked sample into Ghidra and run full auto-analysis
- Locate socket/WinHTTP API calls and trace backwards to the calling function
- Identify the encryption routine called before data is sent (follow data flow from send/HttpSendRequest)
- Reverse the encryption (XOR key extraction, RC4 key derivation, AES key location)
- Map the command structure by analyzing the response parsing function (switch/case on command IDs)
- Document the protocol format (header structure, command bytes, encryption method)
- Create a protocol decoder script for network monitoring tools
Pitfalls:
- Not running the full auto-analysis before starting manual analysis (missing function boundaries and type propagation)
- Ignoring indirect calls through function pointers or vtables (use cross-references to data holding function addresses)
- Spending time on library code that Ghidra's Function ID (FID) or FLIRT signatures should have identified
- Not saving Ghidra project progress frequently (analysis state can be lost on crashes)
Output Format
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.flocks/flockshub/plugins/skills/Anthropic-Cybersecurity-Skills/reverse-engineering-malware-with-ghidra/SKILL.md
Popularity
- Repository stars
- 480
- Repository forks
- 90
- 7-day trend score
- 31
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/agentflocks/flocks/reverse-engineering-malware-with-ghidra)