offensive-tools/rev/ghidra/SKILL.md
NSA's open-source reverse engineering suite with disassembler, decompiler, P-Code IL, and Ghidra/Python scripting. Use when statically analyzing malware, firmware, or binaries to understand logic, recover algorithms, apply type information, diff binaries, or run headless batch analysis.
npx skillsauth add aeondave/malskill ghidraInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
NSA open-source RE suite — disassembler + decompiler + scripting for static analysis.
# Download from https://github.com/NationalSecurityAgency/ghidra/releases
# Requires JDK 17+ (21 recommended)
# Extract and run:
./ghidraRun # Linux/macOS
ghidraRun.bat # Windows
| Window | Purpose | |--------|---------| | Symbol Tree | Functions, labels, namespaces, imports, exports | | Decompiler | C pseudocode of selected function | | Listing | Assembly/disassembly view | | Data Type Manager | Struct/enum/typedef definitions | | Program Trees | Segments and sections | | Defined Strings | All string references | | Function Call Graph | Call tree visualization | | Bytes | Raw hex view |
| Key | Action |
|-----|--------|
| G | Go to address/label |
| L | Rename symbol/function/variable |
| T | Set data type |
| ; | Add comment |
| Ctrl+Shift+E | Search all text in decompiler |
| Ctrl+Shift+F | Find references to |
| F | Edit function signature |
| D | Define data at cursor |
| P | Create function |
| Ctrl+E | Export to C/header |
# Script Manager → New → Python
# Available globals: currentProgram, currentAddress, monitor, state
from ghidra.program.model.symbol import SourceType
# List all functions
fm = currentProgram.getFunctionManager()
for func in fm.getFunctions(True):
print(f"{func.getEntryPoint()}: {func.getName()}")
# Find suspicious imports
for func in fm.getExternalFunctions():
name = func.getName()
if any(api in name for api in ['VirtualAlloc', 'CreateRemoteThread',
'WriteProcessMemory', 'NtUnmap']):
refs = getReferencesTo(func.getEntryPoint())
for ref in refs:
print(f" Suspicious: {name} called from {ref.getFromAddress()}")
# Find AES S-box in binary
from ghidra.program.model.mem import MemoryAccessException
aes_sbox = bytes([0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5])
mem = currentProgram.getMemory()
addr = mem.findBytes(currentProgram.getMinAddress(), aes_sbox, None, True, monitor)
while addr is not None:
print(f"AES S-box at {addr}")
refs = getReferencesTo(addr)
for ref in refs:
func = getFunctionContaining(ref.getFromAddress())
if func:
print(f" Used by {func.getName()}")
addr = mem.findBytes(addr.add(1), aes_sbox, None, True, monitor)
# Auto-rename functions that call specific APIs
for func in currentProgram.getFunctionManager().getFunctions(True):
body = func.getBody()
calls = getReferencesFrom(func.getEntryPoint())
for block in body:
pass
# Simpler: check decompiled output
decomp = ghidra.app.decompiler.DecompInterface()
decomp.openProgram(currentProgram)
result = decomp.decompileFunction(func, 30, monitor)
if result and result.getDecompiledFunction():
code = result.getDecompiledFunction().getC()
if 'VirtualAlloc' in code and 'WriteProcessMemory' in code:
func.setName("likely_injector_" + str(func.getEntryPoint()),
SourceType.USER_DEFINED)
# Run analysis without GUI
analyzeHeadless /path/to/project ProjectName \
-import /path/to/binary \
-postScript MyScript.py \
-scriptPath /path/to/scripts
# Batch process multiple binaries
analyzeHeadless /path/to/project ProjectName \
-import /path/to/samples/ \
-recursive \
-postScript ExtractStrings.py
http, password, cmd, execmain/entrypoint through key code paths1. Select data in Listing → Right-click → Data → Create Structure
2. Edit fields in Structure Editor → set types, names, array sizes
3. Apply struct to memory: Right-click data → Data → MyStruct
4. Decompiler auto-updates to use struct field names
# When decompiler gets calling convention wrong:
1. Right-click function → Edit Function Signature
2. Set calling convention (stdcall, cdecl, fastcall, thiscall)
3. Add/correct parameter types and names
4. Decompiler re-analyzes with correct types
1. Window → Version Tracking
2. Source: older binary, Destination: newer binary
3. Run correlators: Exact Function, Data Match, Reference
4. Review matched/unmatched functions
5. Apply matches to propagate names and types
# P-Code is Ghidra's intermediate representation
# Useful for architecture-independent analysis
decomp = ghidra.app.decompiler.DecompInterface()
decomp.openProgram(currentProgram)
func = getFunctionAt(currentAddress)
result = decomp.decompileFunction(func, 30, monitor)
hf = result.getHighFunction()
for block in hf.getBasicBlocks():
it = block.getIterator()
while it.hasNext():
op = it.next()
print(f" {op.getSeqnum().getTarget()}: {op.getMnemonic()} {op}")
| File | When to load | |------|--------------| | references/scripting-guide.md | Ghidra Python/Java script patterns and API reference | | references/headless-analysis.md | Batch processing and headless workflow recipes |
data-ai
Scoped routing: Linux operator; hosts, sessions, users, services, packages, logs, containers, SSH, network paths, privilege evidence.
development
Offensive methodology for ICS/OT/SCADA environments in authorized industrial penetration testing and red team operations. Use when assessing PLCs, RTUs, HMIs, engineering workstations, historians, or field devices running Modbus, DNP3, EtherNet/IP, S7comm/S7+, Profinet, IEC 60870-5-104, BACnet, or OPC-UA. Covers passive OT network enumeration, protocol-level device interrogation, PLC coil/register read-write attacks, HMI session exploitation, historian and engineering workstation compromise, and safe escalation rules for critical infrastructure scope. Does not cover: general IT network exploitation (network-technique), physical hardware interfaces UART/JTAG/SPI (hardware-technique), wireless sensor network attacks (wireless-technique), RF/SDR signal analysis (hardware-ctf or wireless-technique), or CTF-framed ICS lab tasks (ics-ctf).
tools
Offensive methodology for authorized game security assessments, game client security research, and game-adjacent penetration testing in real-world engagements. Use when assessing game clients for cheating vulnerabilities, testing anti-cheat effectiveness, auditing game server protocols for score manipulation or economic fraud, reverse engineering game DRM or license validation, analyzing game save file protection, or assessing game mod/plugin security. Covers: process memory scanning and manipulation (Cheat Engine methodology), game binary reversing for license and DRM bypass, game network protocol analysis and packet replay, anti-cheat mechanism analysis, save file format reversing and tampering, speed hack and value injection techniques. Does NOT cover: CTF game challenges (game-ctf), game engine source code auditing (web-exploit-technique or vuln-search-technique for the backend), or general binary exploitation (pwn-ctf or reversing-technique).
development
Auth assessment: hardware/embedded methodology; UART/JTAG/SWD/SPI/I2C, firmware extraction, boot/debug paths, embedded OS evidence.