[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AB397CDW4P27GFHWF5DGZP":3,"skill-same:01M7AB397CDW4P27GFHWF5DGZP":84},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":14,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":6,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M7AB397CDW4P27GFHWF5DGZP","reverse-engineering-malware-with-ghidra",null,"Reverse engineers malware binaries using NSA's Ghidra disassembler and decompiler to study internal logic, cryptographic routines, C2 protocols, and evasion techniques at the assembly and pseudo-C level. Use when static or dynamic analysis flags suspicious functionality needing deeper code review, such as reversing C2 protocols, encryption algorithms, custom obfuscation, or a sample's exploit mechanism.","NeelakshSaxena\u002FVayu","NeelakshSaxena","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F87892838?v=4","01M7A3B9YFS6F6N9DD1787DT86","Neelaksh Saxena","01M7A3B9ZKBT09MNMPX2XN69BY",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freverse-engineering-malware-with-ghidra\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freverse-engineering-malware-with-ghidra\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: reverse-engineering-malware-with-ghidra\ndescription: 'Reverse engineers malware binaries using NSA''s Ghidra disassembler and\n  decompiler to study internal logic, cryptographic routines, C2 protocols, and evasion\n  techniques at the assembly and pseudo-C level. Use when static or dynamic analysis\n  flags suspicious functionality needing deeper code review, such as reversing C2\n  protocols, encryption algorithms, custom obfuscation, or a sample''s exploit mechanism.\n\n  '\ndomain: cybersecurity\nsubdomain: malware-analysis\ntags:\n- malware\n- reverse-engineering\n- Ghidra\n- disassembly\n- decompilation\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- DE.AE-02\n- RS.AN-03\n- ID.RA-01\n- DE.CM-01\nmitre_attack:\n- T1027\n- T1055\n- T1140\n- T1497\n- T1070\n---\n\n# Reverse Engineering Malware with Ghidra\n\n## When to Use\n\n- Static and dynamic analysis have identified suspicious functionality that requires deeper code-level understanding\n- You need to reverse engineer C2 communication protocols, encryption algorithms, or custom obfuscation\n- Understanding the exact exploit mechanism or vulnerability targeted by a malware sample\n- Extracting hardcoded configuration data (C2 addresses, encryption keys, campaign IDs) embedded in compiled code\n- Developing precise YARA rules or detection signatures based on unique code patterns\n\n**Do not use** for initial triage of unknown samples; perform static analysis with PEStudio and behavioral analysis with Cuckoo first.\n\n## Prerequisites\n\n- Ghidra 11.x installed (download from https:\u002F\u002Fghidra-sre.org\u002F) with JDK 17+\n- Analysis VM isolated from production network (Windows or Linux host)\n- Familiarity with x86\u002Fx64 assembly language and Windows API conventions\n- PDB symbol files for Windows system DLLs to improve decompilation accuracy\n- Ghidra scripts repository (ghidra_scripts) for automated analysis tasks\n- Secondary reference: IDA Free or Binary Ninja for cross-validation of analysis results\n\n## Workflow\n\n### Step 1: Create Project and Import Binary\n\nSet up a Ghidra project and import the malware sample:\n\n```\n1. Launch Ghidra: ghidraRun (Linux) or ghidraRun.bat (Windows)\n2. File -> New Project -> Non-Shared Project -> Select directory\n3. File -> Import File -> Select malware binary\n4. Ghidra auto-detects format (PE, ELF, Mach-O) and architecture\n5. Accept default import options (or specify base address if known)\n6. Double-click imported file to open in CodeBrowser\n7. When prompted, run Auto Analysis with default analyzers enabled\n```\n\n**Headless analysis for automation:**\n```bash\n# Run Ghidra headless analysis with decompiler\n\u002Fopt\u002Fghidra\u002Fsupport\u002FanalyzeHeadless \u002Ftmp\u002Fghidra_project MalwareProject \\\n  -import suspect.exe \\\n  -postScript ExportDecompilation.py \\\n  -scriptPath \u002Fopt\u002Fghidra\u002Fscripts\u002F \\\n  -deleteProject\n```\n\n### Step 2: Identify Key Functions and Entry Points\n\nNavigate the binary to locate critical code sections:\n\n```\nNavigation Strategy:\n━━━━━━━━━━━━━━━━━━━\n1. Start at entry point (OEP) - follow execution from _start\u002FWinMain\n2. Check Symbol Tree for imported functions (Window -> Symbol Tree)\n3. Search for cross-references to suspicious APIs:\n   - VirtualAlloc\u002FVirtualAllocEx (memory allocation for injection)\n   - CreateRemoteThread (remote thread injection)\n   - CryptEncrypt\u002FCryptDecrypt (encryption operations)\n   - InternetOpen\u002FHttpSendRequest (C2 communication)\n   - RegSetValueEx (persistence via registry)\n4. Use Search -> For Strings to find embedded URLs, IPs, and paths\n5. Check the Functions window sorted by size (large functions often contain core logic)\n```\n\n**Ghidra keyboard shortcuts for efficient navigation:**\n```\nG         - Go to address\nCtrl+E    - Search for strings\nX         - Show cross-references to current location\nCtrl+Shift+F - Search memory for byte patterns\nL         - Rename label\u002Ffunction\n;         - Add comment\nT         - Retype variable\nCtrl+L    - Retype return value\n```\n\n### Step 3: Analyze Decompiled Code\n\nUse Ghidra's decompiler to understand function logic:\n\n```c\n\u002F\u002F Example: Ghidra decompiler output for a decryption routine\n\u002F\u002F Analyst renames variables and adds types for clarity\n\nvoid decrypt_config(BYTE *encrypted_data, int data_len, BYTE *key, int key_len) {\n    \u002F\u002F XOR decryption with rolling key\n    for (int i = 0; i \u003C data_len; i++) {\n        encrypted_data[i] = encrypted_data[i] ^ key[i % key_len];\n    }\n    return;\n}\n\n\u002F\u002F Analyst actions in Ghidra:\n\u002F\u002F 1. Right-click parameters -> Retype to correct types (BYTE*, int)\n\u002F\u002F 2. Right-click variables -> Rename to meaningful names\n\u002F\u002F 3. Add comments explaining the algorithm\n\u002F\u002F 4. Set function signature to propagate types to callers\n```\n\n### Step 4: Trace C2 Communication Logic\n\nFollow the network communication code path:\n\n```\nAnalysis Steps for C2 Protocol Reverse Engineering:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n1. Find InternetOpenA\u002FWinHttpOpen call -> trace to wrapper function\n2. Follow data flow from encrypted config -> URL construction\n3. Identify HTTP method (GET\u002FPOST), headers, and body format\n4. Locate response parsing logic (JSON parsing, custom binary protocol)\n5. Map the C2 command dispatcher (switch\u002Fcase or jump table)\n6. Document the command set (download, execute, exfiltrate, update, uninstall)\n```\n\n**Ghidra Script for extracting C2 configuration:**\n```python\n# Ghidra Python script: extract_c2_config.py\n# Run via Script Manager in Ghidra\n\nfrom ghidra.program.model.data import StringDataType\nfrom ghidra.program.model.symbol import SourceType\n\n# Search for XOR decryption patterns\nlisting = currentProgram.getListing()\nmemory = currentProgram.getMemory()\n\n# Find references to InternetOpenA\nsymbol_table = currentProgram.getSymbolTable()\nfor symbol in symbol_table.getExternalSymbols():\n    if \"InternetOpen\" in symbol.getName():\n        refs = getReferencesTo(symbol.getAddress())\n        for ref in refs:\n            print(\"C2 init at: {}\".format(ref.getFromAddress()))\n```\n\n### Step 5: Analyze Encryption and Obfuscation\n\nIdentify and document cryptographic routines:\n\n```\nCommon Malware Encryption Patterns:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nXOR Cipher:     Loop with XOR operation, often single-byte or rolling key\nRC4:            Two loops (KSA + PRGA), 256-byte S-box initialization\nAES:            Look for S-box constants (0x63, 0x7C, 0x77...) or calls to CryptEncrypt\nBase64:         Lookup table with A-Za-z0-9+\u002F= characters\nCustom:         Combination of arithmetic operations (ADD, SUB, ROL, ROR with XOR)\n\nIdentification Tips:\n- Search for constants: AES S-box, CRC32 table, MD5 init values\n- Look for loop structures operating on byte arrays\n- Check for Windows Crypto API usage (CryptAcquireContext -> CryptCreateHash -> CryptEncrypt)\n- FindCrypt Ghidra plugin automatically identifies crypto constants\n```\n\n### Step 6: Document Findings and Create Detection Signatures\n\nProduce actionable intelligence from reverse engineering:\n\n```bash\n# Generate YARA rule from unique code patterns found in Ghidra\ncat \u003C\u003C 'EOF' > malware_family_x.yar\nrule MalwareFamilyX_Decryptor {\n    meta:\n        description = \"Detects MalwareX decryption routine\"\n        author = \"analyst\"\n        date = \"2025-09-15\"\n    strings:\n        \u002F\u002F XOR decryption loop with hardcoded key\n        $decrypt = { 8A 04 0E 32 04 0F 88 04 0E 41 3B CA 7C F3 }\n        \u002F\u002F C2 URL pattern after decryption\n        $c2_pattern = \"\u002Fgate.php?id=\" ascii\n    condition:\n        uint16(0) == 0x5A4D and $decrypt and $c2_pattern\n}\nEOF\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **Disassembly** | Converting machine code bytes into human-readable assembly language instructions; Ghidra's Listing view shows disassembled code |\n| **Decompilation** | Lifting assembly code to pseudo-C representation for easier analysis; Ghidra's Decompile window provides this view |\n| **Cross-Reference (XREF)** | Reference showing where a function or data address is called from or used; essential for tracing code execution flow |\n| **Control Flow Graph (CFG)** | Visual representation of all possible execution paths through a function; reveals branching logic and loops |\n| **Original Entry Point (OEP)** | The actual start address of the malware code after unpacking; packers redirect execution through an unpacking stub first |\n| **Function Signature** | The return type, name, and parameter types of a function; applying correct signatures improves decompiler output quality |\n| **Ghidra Script** | Python or Java automation script executed within Ghidra to perform batch analysis, pattern searching, or data extraction |\n\n## Tools & Systems\n\n- **Ghidra**: NSA's open-source software reverse engineering suite with disassembler, decompiler, and scripting support for multiple architectures\n- **IDA Pro\u002FFree**: Industry-standard interactive disassembler; IDA Free provides x86\u002Fx64 cloud-based decompilation\n- **Binary Ninja**: Commercial reverse engineering platform with modern UI and extensive API for plugin development\n- **x64dbg**: Open-source x64\u002Fx32 debugger for Windows used alongside Ghidra for dynamic debugging of malware\n- **FindCrypt (Ghidra Plugin)**: Plugin that identifies cryptographic constants and algorithms in binary code\n\n## Common Scenarios\n\n### Scenario: Reversing Custom C2 Protocol\n\n**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.\n\n**Approach**:\n1. Import the unpacked sample into Ghidra and run full auto-analysis\n2. Locate socket\u002FWinHTTP API calls and trace backwards to the calling function\n3. Identify the encryption routine called before data is sent (follow data flow from send\u002FHttpSendRequest)\n4. Reverse the encryption (XOR key extraction, RC4 key derivation, AES key location)\n5. Map the command structure by analyzing the response parsing function (switch\u002Fcase on command IDs)\n6. Document the protocol format (header structure, command bytes, encryption method)\n7. Create a protocol decoder script for network monitoring tools\n\n**Pitfalls**:\n- Not running the full auto-analysis before starting manual analysis (missing function boundaries and type propagation)\n- Ignoring indirect calls through function pointers or vtables (use cross-references to data holding function addresses)\n- Spending time on library code that Ghidra's Function ID (FID) or FLIRT signatures should have identified\n- Not saving Ghidra project progress frequently (analysis state can be lost on crashes)\n\n## Output Format\n\n```\nREVERSE ENGINEERING ANALYSIS REPORT\n=====================================\nSample:           unpacked_payload.exe\nSHA-256:          abc123def456...\nArchitecture:     x86 (32-bit PE)\nGhidra Project:   MalwareX_Analysis\n\nFUNCTION MAP\n0x00401000  main()              - Entry point, initializes config\n0x00401200  decrypt_config()    - XOR decryption with 16-byte key\n0x00401400  init_c2()           - WinHTTP initialization, URL construction\n0x00401800  c2_beacon()         - HTTP POST beacon with system info\n0x00401C00  cmd_dispatcher()    - Switch on 12 command codes\n0x00402000  inject_process()    - Process hollowing into svchost.exe\n0x00402400  persist_registry()  - HKCU Run key persistence\n0x00402800  exfil_data()        - File collection and encrypted upload\n\nC2 PROTOCOL\nMethod:           HTTPS POST to \u002Fgate.php\nEncryption:       RC4 with derived key (MD5 of bot_id + campaign_key)\nBot ID Format:    MD5(hostname + username + volume_serial)\nBeacon Interval:  60 seconds with 10% jitter\nCommand Set:\n  0x01 - Download and execute file\n  0x02 - Execute shell command\n  0x03 - Upload file to C2\n  0x04 - Update configuration\n  0x05 - Uninstall and remove traces\n\nENCRYPTION DETAILS\nAlgorithm:        RC4\nKey Derivation:   MD5(bot_id + \"campaign_2025_q3\")\nHardcoded Seed:   \"campaign_2025_q3\" at offset 0x00405A00\n\nEXTRACTED IOCs\nC2 URLs:          hxxps:\u002F\u002Fupdate.malicious[.]com\u002Fgate.php\n                  hxxps:\u002F\u002Fbackup.evil[.]net\u002Fgate.php (failover)\nCampaign ID:      campaign_2025_q3\nRC4 Key Material: [see encryption details above]\n```\n","# Reverse Engineering Malware with Ghidra\n\n## When to Use\n\n- Static and dynamic analysis have identified suspicious functionality that requires deeper code-level understanding\n- You need to reverse engineer C2 communication protocols, encryption algorithms, or custom obfuscation\n- Understanding the exact exploit mechanism or vulnerability targeted by a malware sample\n- Extracting hardcoded configuration data (C2 addresses, encryption keys, campaign IDs) embedded in compiled code\n- Developing precise YARA rules or detection signatures based on unique code patterns\n\n**Do not use** for initial triage of unknown samples; perform static analysis with PEStudio and behavioral analysis with Cuckoo first.\n\n## Prerequisites\n\n- Ghidra 11.x installed (download from https:\u002F\u002Fghidra-sre.org\u002F) with JDK 17+\n- Analysis VM isolated from production network (Windows or Linux host)\n- Familiarity with x86\u002Fx64 assembly language and Windows API conventions\n- PDB symbol files for Windows system DLLs to improve decompilation accuracy\n- Ghidra scripts repository (ghidra_scripts) for automated analysis tasks\n- Secondary reference: IDA Free or Binary Ninja for cross-validation of analysis results\n\n## Workflow\n\n### Step 1: Create Project and Import Binary\n\nSet up a Ghidra project and import the malware sample:\n\n```\n1. Launch Ghidra: ghidraRun (Linux) or ghidraRun.bat (Windows)\n2. File -> New Project -> Non-Shared Project -> Select directory\n3. File -> Import File -> Select malware binary\n4. Ghidra auto-detects format (PE, ELF, Mach-O) and architecture\n5. Accept default import options (or specify base address if known)\n6. Double-click imported file to open in CodeBrowser\n7. When prompted, run Auto Analysis with default analyzers enabled\n```\n\n**Headless analysis for automation:**\n```bash\n# Run Ghidra headless analysis with decompiler\n\u002Fopt\u002Fghidra\u002Fsupport\u002FanalyzeHeadless \u002Ftmp\u002Fghidra_project MalwareProject \\\n  -import suspect.exe \\\n  -postScript ExportDecompilation.py \\\n  -scriptPath \u002Fopt\u002Fghidra\u002Fscripts\u002F \\\n  -deleteProject\n```\n\n### Step 2: Identify Key Functions and Entry Points\n\nNavigate the binary to locate critical code sections:\n\n```\nNavigation Strategy:\n━━━━━━━━━━━━━━━━━━━\n1. Start at entry point (OEP) - follow execution from _start\u002FWinMain\n2. Check Symbol Tree for imported functions (Window -> Symbol Tree)\n3. Search for cross-references to suspicious APIs:\n   - VirtualAlloc\u002FVirtualAllocEx (memory allocation for injection)\n   - CreateRemoteThread (remote thread injection)\n   - CryptEncrypt\u002FCryptDecrypt (encryption operations)\n   - InternetOpen\u002FHttpSendRequest (C2 communication)\n   - RegSetValueEx (persistence via registry)\n4. Use Search -> For Strings to find embedded URLs, IPs, and paths\n5. Check the Functions window sorted by size (large functions often contain core logic)\n```\n\n**Ghidra keyboard shortcuts for efficient navigation:**\n```\nG         - Go to address\nCtrl+E    - Search for strings\nX         - Show cross-references to current location\nCtrl+Shift+F - Search memory for byte patterns\nL         - Rename label\u002Ffunction\n;         - Add comment\nT         - Retype variable\nCtrl+L    - Retype return value\n```\n\n### Step 3: Analyze Decompiled Code\n\nUse Ghidra's decompiler to understand function logic:\n\n```c\n\u002F\u002F Example: Ghidra decompiler output for a decryption routine\n\u002F\u002F Analyst renames variables and adds types for clarity\n\nvoid decrypt_config(BYTE *encrypted_data, int data_len, BYTE *key, int key_len) {\n    \u002F\u002F XOR decryption with rolling key\n    for (int i = 0; i \u003C data_len; i++) {\n        encrypted_data[i] = encrypted_data[i] ^ key[i % key_len];\n    }\n    return;\n}\n\n\u002F\u002F Analyst actions in Ghidra:\n\u002F\u002F 1. Right-click parameters -> Retype to correct types (BYTE*, int)\n\u002F\u002F 2. Right-click variables -> Rename to meaningful names\n\u002F\u002F 3. Add comments explaining the algorithm\n\u002F\u002F 4. Set function signature to propagate types to callers\n```\n\n### Step 4: Trace C2 Communication Logic\n\nFollow the network communication code path:\n\n```\nAnalysis Steps for C2 Protocol Reverse Engineering:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n1. Find InternetOpenA\u002FWinHttpOpen call -> trace to wrapper function\n2. Follow data flow from encrypted config -> URL construction\n3. Identify HTTP method (GET\u002FPOST), headers, and body format\n4. Locate response parsing logic (JSON parsing, custom binary protocol)\n5. Map the C2 command dispatcher (switch\u002Fcase or jump table)\n6. Document the command set (download, execute, exfiltrate, update, uninstall)\n```\n\n**Ghidra Script for extracting C2 configuration:**\n```python\n# Ghidra Python script: extract_c2_config.py\n# Run via Script Manager in Ghidra\n\nfrom ghidra.program.model.data import StringDataType\nfrom ghidra.program.model.symbol import SourceType\n\n# Search for XOR decryption patterns\nlisting = currentProgram.getListing()\nmemory = currentProgram.getMemory()\n\n# Find references to InternetOpenA\nsymbol_table = currentProgram.getSymbolTable()\nfor symbol in symbol_table.getExternalSymbols():\n    if \"InternetOpen\" in symbol.getName():\n        refs = getReferencesTo(symbol.getAddress())\n        for ref in refs:\n            print(\"C2 init at: {}\".format(ref.getFromAddress()))\n```\n\n### Step 5: Analyze Encryption and Obfuscation\n\nIdentify and document cryptographic routines:\n\n```\nCommon Malware Encryption Patterns:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nXOR Cipher:     Loop with XOR operation, often single-byte or rolling key\nRC4:            Two loops (KSA + PRGA), 256-byte S-box initialization\nAES:            Look for S-box constants (0x63, 0x7C, 0x77...) or calls to CryptEncrypt\nBase64:         Lookup table with A-Za-z0-9+\u002F= characters\nCustom:         Combination of arithmetic operations (ADD, SUB, ROL, ROR with XOR)\n\nIdentification Tips:\n- Search for constants: AES S-box, CRC32 table, MD5 init values\n- Look for loop structures operating on byte arrays\n- Check for Windows Crypto API usage (CryptAcquireContext -> CryptCreateHash -> CryptEncrypt)\n- FindCrypt Ghidra plugin automatically identifies crypto constants\n```\n\n### Step 6: Document Findings and Create Detection Signatures\n\nProduce actionable intelligence from reverse engineering:\n\n```bash\n# Generate YARA rule from unique code patterns found in Ghidra\ncat \u003C\u003C 'EOF' > malware_family_x.yar\nrule MalwareFamilyX_Decryptor {\n    meta:\n        description = \"Detects MalwareX decryption routine\"\n        author = \"analyst\"\n        date = \"2025-09-15\"\n    strings:\n        \u002F\u002F XOR decryption loop with hardcoded key\n        $decrypt = { 8A 04 0E 32 04 0F 88 04 0E 41 3B CA 7C F3 }\n        \u002F\u002F C2 URL pattern after decryption\n        $c2_pattern = \"\u002Fgate.php?id=\" ascii\n    condition:\n        uint16(0) == 0x5A4D and $decrypt and $c2_pattern\n}\nEOF\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **Disassembly** | Converting machine code bytes into human-readable assembly language instructions; Ghidra's Listing view shows disassembled code |\n| **Decompilation** | Lifting assembly code to pseudo-C representation for easier analysis; Ghidra's Decompile window provides this view |\n| **Cross-Reference (XREF)** | Reference showing where a function or data address is called from or used; essential for tracing code execution flow |\n| **Control Flow Graph (CFG)** | Visual representation of all possible execution paths through a function; reveals branching logic and loops |\n| **Original Entry Point (OEP)** | The actual start address of the malware code after unpacking; packers redirect execution through an unpacking stub first |\n| **Function Signature** | The return type, name, and parameter types of a function; applying correct signatures improves decompiler output quality |\n| **Ghidra Script** | Python or Java automation script executed within Ghidra to perform batch analysis, pattern searching, or data extraction |\n\n## Tools & Systems\n\n- **Ghidra**: NSA's open-source software reverse engineering suite with disassembler, decompiler, and scripting support for multiple architectures\n- **IDA Pro\u002FFree**: Industry-standard interactive disassembler; IDA Free provides x86\u002Fx64 cloud-based decompilation\n- **Binary Ninja**: Commercial reverse engineering platform with modern UI and extensive API for plugin development\n- **x64dbg**: Open-source x64\u002Fx32 debugger for Windows used alongside Ghidra for dynamic debugging of malware\n- **FindCrypt (Ghidra Plugin)**: Plugin that identifies cryptographic constants and algorithms in binary code\n\n## Common Scenarios\n\n### Scenario: Reversing Custom C2 Protocol\n\n**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.\n\n**Approach**:\n1. Import the unpacked sample into Ghidra and run full auto-analysis\n2. Locate socket\u002FWinHTTP API calls and trace backwards to the calling function\n3. Identify the encryption routine called before data is sent (follow data flow from send\u002FHttpSendRequest)\n4. Reverse the encryption (XOR key extraction, RC4 key derivation, AES key location)\n5. Map the command structure by analyzing the response parsing function (switch\u002Fcase on command IDs)\n6. Document the protocol format (header structure, command bytes, encryption method)\n7. Create a protocol decoder script for network monitoring tools\n\n**Pitfalls**:\n- Not running the full auto-analysis before starting manual analysis (missing function boundaries and type propagation)\n- Ignoring indirect calls through function pointers or vtables (use cross-references to data holding function addresses)\n- Spending time on library code that Ghidra's Function ID (FID) or FLIRT signatures should have identified\n- Not saving Ghidra project progress frequently (analysis state can be lost on crashes)\n\n## Output Format\n\n```\nREVERSE ENGINEERING ANALYSIS REPORT\n=====================================\nSample:           unpacked_payload.exe\nSHA-256:          abc123def456...\nArchitecture:     x86 (32-bit PE)\nGhidra Project:   MalwareX_Analysis\n\nFUNCTION MAP\n0x00401000  main()              - Entry point, initializes config\n0x00401200  decrypt_config()    - XOR decryption with 16-byte key\n0x00401400  init_c2()           - WinHTTP initialization, URL construction\n0x00401800  c2_beacon()         - HTTP POST beacon with system info\n0x00401C00  cmd_dispatcher()    - Switch on 12 command codes\n0x00402000  inject_process()    - Process hollowing into svchost.exe\n0x00402400  persist_registry()  - HKCU Run key persistence\n0x00402800  exfil_data()        - File collection and encrypted upload\n\nC2 PROTOCOL\nMethod:           HTTPS POST to \u002Fgate.php\nEncryption:       RC4 with derived key (MD5 of bot_id + campaign_key)\nBot ID Format:    MD5(hostname + username + volume_serial)\nBeacon Interval:  60 seconds with 10% jitter\nCommand Set:\n  0x01 - Download and execute file\n  0x02 - Execute shell command\n  0x03 - Upload file to C2\n  0x04 - Update configuration\n  0x05 - Uninstall and remove traces\n\nENCRYPTION DETAILS\nAlgorithm:        RC4\nKey Derivation:   MD5(bot_id + \"campaign_2025_q3\")\nHardcoded Seed:   \"campaign_2025_q3\" at offset 0x00405A00\n\nEXTRACTED IOCs\nC2 URLs:          hxxps:\u002F\u002Fupdate.malicious[.]com\u002Fgate.php\n                  hxxps:\u002F\u002Fbackup.evil[.]net\u002Fgate.php (failover)\nCampaign ID:      campaign_2025_q3\nRC4 Key Material: [see encryption details above]\n```\n",{"name":5,"tags":25,"author":31,"domain":32,"license":15,"version":33,"nist_csf":34,"subdomain":39,"description":40,"mitre_attack":41},[26,27,28,29,30],"malware","reverse-engineering","Ghidra","disassembly","decompilation","mahipal","cybersecurity","1.0.0",[35,36,37,38],"DE.AE-02","RS.AN-03","ID.RA-01","DE.CM-01","malware-analysis","Reverse engineers malware binaries using NSA's Ghidra disassembler and decompiler to study internal logic, cryptographic routines, C2 protocols, and evasion techniques at the assembly and pseudo-C level. Use when static or dynamic analysis flags suspicious functionality needing deeper code review, such as reversing C2 protocols, encryption algorithms, custom obfuscation, or a sample's exploit mechanism.\n",[42,43,44,45,46],"T1027","T1055","T1140","T1497","T1070","main","7540bbccf0c1ded6156a467b02c95b61ad62413f",".agents\u002Fskills\u002Freverse-engineering-malware-with-ghidra","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena","Currently exploring the intersection of tech","2026-09-11 03:02:31",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add NeelakshSaxena\u002FVayu --skill reverse-engineering-malware-with-ghidra",{"tool":60,"command":61},"bunx","bunx skills add NeelakshSaxena\u002FVayu --skill reverse-engineering-malware-with-ghidra",{"tool":63,"command":64},"pnpm","pnpm dlx skills add NeelakshSaxena\u002FVayu --skill reverse-engineering-malware-with-ghidra","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freverse-engineering-malware-with-ghidra\u002FSKILL.md",true,[68,72,78],{"path":69,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Fapi-reference.md","REFERENCE","参考文档",2658,"https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freverse-engineering-malware-with-ghidra\u002Freferences\u002Fapi-reference.md",{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"scripts\u002Fagent.py","SCRIPT","脚本",8433,"https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freverse-engineering-malware-with-ghidra\u002Fscripts\u002Fagent.py",[85,92,99,106,113,120],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":20},"01M7ACCCVNCFKMA9X6D15X6G98","runpodctl","Runpod CLI for managing GPU\u002FCPU workloads from the terminal — pods, serverless endpoints, templates, network volumes, Hub deploys, models, SSH, and file transfer (send\u002Freceive). Use for terminal\u002FCI\u002Fscripting, Hub browse\u002Fdeploy, SSH setup, `doctor`, or when the Runpod MCP tools are not connected. For structured tool calls in an MCP-enabled session, prefer runpod-mcp.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpodctl\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":20},"01M7ACC63SRHEA5KMCHSMZK2TC","runpod","Start here for any Runpod task — running GPU\u002FCPU pods, deploying serverless endpoints, templates, network volumes, building images, or understanding how Runpod works. Routes to the right skill (runpod-mcp, runpodctl, flash, companion-clis, runpod-usage, runpod-templates, runpod-migrate) and indexes two dozen live-verified end-to-end examples (golden paths) — use it when the lane is unclear, and for any multi-step or provisioning task even when it is not.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":20},"01M7ACC0Q1C89N9BZBV91CTQTF","runpod-usage","How Runpod works and how to work it — pods vs serverless, GPU\u002FVRAM selection, storage, building a container, networking, plus the agentic pod development loop (provision → ssh-exec → set up → poll readiness) and on-pod install hygiene (uv\u002Fapt). Use to answer \"how does X work\", \"which GPU\", \"how do I build a container\", or \"how do I stand up a workload on a pod\". Guidance, not a tool — execute with runpodctl, runpod-mcp, or flash.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-usage\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":20},"01M7ACBRPE345GF5GM5B8P8RRC","runpod-templates","Runpod's official prebuilt pod templates (ComfyUI, PyTorch, and others): what each image ships, which ports and paths it uses, how to pick one, how to pin a version, and what is missing on first boot. Use when a task says \"run \u003CX> on a pod\" and an official template already covers it, instead of building an image — and when a user needs help with or wants to fix something about a Runpod template they are already running (won't boot, can't reach the UI, missing models, wrong CUDA line, broken ComfyUI workflow metadata on imported workflows): start here and route onward. Deploy with runpodctl or runpod-mcp; end-to-end walkthroughs live in the runpod router's golden paths.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-templates\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":20},"01M7ACBJATHKVX1TWES2F44GY8","runpod-migrate","Migrate a codebase from the Runpod GraphQL API or REST v1 to REST v2 — inventory which parts use which API version, rewrite the call sites, flag breaking changes, and verify. Use when someone asks to move to v2, asks what v2 would change, or asks which Runpod API their code is on. For managing infrastructure rather than migrating code, use runpod-mcp or runpodctl.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-migrate\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":20},"01M7ACBC7GHVH6T9YEAPCG2AP8","runpod-mcp","Manage Runpod infrastructure — pods, serverless endpoints, jobs, templates, network volumes, container-registry auth, GPU\u002FCPU catalog, and billing — via the Runpod MCP server's structured tool calls. Use when the Runpod MCP tools (create-pod, list-endpoints, …) are connected in this session, or to connect them (hosted OAuth or local npx). Prefer this over runpodctl for plain infra CRUD when MCP is available; use runpodctl for the terminal, file transfer, or SSH setup.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-mcp\u002FSKILL.md",[],[]]