본문으로 건너뛰기
Skillpedia
보안35k · #8353

reverse-engineering-malware-with-ghidra

하는 일

이 프로그램은 악성 소프트웨어(바이러스 등)가 내부적으로 어떻게 작동하는지 조사하도록 돕습니다. 프로그램의 코드를 살펴보며 어떤 행동을 하는지, 어떻게 통신하는지, 어떤 비밀을 훔치려 하는지, 어떻게 자신을 숨기는지 파악합니다.

사용하는 경우

  • ✓백신이 의심스러운 프로그램을 표시했고 그것이 무엇을 하는지 알고 싶을 때.
  • ✓악성 프로그램이 서버로 정보를 보내는 방법을 알아내고 싶을 때.
  • ✓프로그램 안에 숨겨진 비밀번호나 키를 찾을 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/reverse-engineering-malware-with-ghidra/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 의심스러운 파일을 분석해서 서버와 어떻게 통신하는지 알아내 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 프로그램은 Ghidra라는 도구를 사용해, 이미 컴파일되어 기계어로 바뀐 프로그램의 코드를 읽습니다. 사람이 읽기 쉬운 형식으로 코드를 보여 주어 분석할 수 있게 합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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:

1. Launch Ghidra: ghidraRun (Linux) or ghidraRun.bat (Windows)
2. File -> New Project -> Non-Shared Project -> Select directory
3. File -> Import File -> Select malware binary
4. Ghidra auto-detects format (PE, ELF, Mach-O) and architecture
5. Accept default import options (or specify base address if known)
6. Double-click imported file to open in CodeBrowser
7. When prompted, run Auto Analysis with default analyzers enabled

Headless analysis for automation:

# Run Ghidra headless analysis with decompiler
/opt/ghidra/support/analyzeHeadless /tmp/ghidra_project MalwareProject \
  -import suspect.exe \
  -postScript ExportDecompilation.py \
  -scriptPath /opt/ghidra/scripts/ \
  -deleteProject

Step 2: Identify Key Functions and Entry Points

Navigate the binary to locate critical code sections:

Navigation Strategy:
━━━━━━━━━━━━━━━━━━━
1. Start at entry point (OEP) - follow execution from _start/WinMain
2. Check Symbol Tree for imported functions (Window -> Symbol Tree)
3. Search for cross-references to suspicious APIs:
   - VirtualAlloc/VirtualAllocEx (memory allocation for injection)
   - CreateRemoteThread (remote thread injection)
   - CryptEncrypt/CryptDecrypt (encryption operations)
   - InternetOpen/HttpSendRequest (C2 communication)
   - RegSetValueEx (persistence via registry)
4. Use Search -> For Strings to find embedded URLs, IPs, and paths
5. Check the Functions window sorted by size (large functions often contain core logic)

Ghidra keyboard shortcuts for efficient navigation:

G         - Go to address
Ctrl+E    - Search for strings
X         - Show cross-references to current location
Ctrl+Shift+F - Search memory for byte patterns
L         - Rename label/function
;         - Add comment
T         - Retype variable
Ctrl+L    - Retype return value

Step 3: Analyze Decompiled Code

Use Ghidra's decompiler to understand function logic:

// Example: Ghidra decompiler output for a decryption routine
// Analyst renames variables and adds types for clarity

void decrypt_config(BYTE *encrypted_data, int data_len, BYTE *key, int key_len) {
    // XOR decryption with rolling key
    for (int i = 0; i < data_len; i++) {
        encrypted_data[i] = encrypted_data[i] ^ key[i % key_len];
    }
    return;
}

// Analyst actions in Ghidra:
// 1. Right-click parameters -> Retype to correct types (BYTE*, int)
// 2. Right-click variables -> Rename to meaningful names
// 3. Add comments explaining the algorithm
// 4. Set function signature to propagate types to callers

Step 4: Trace C2 Communication Logic

Follow the network communication code path:

Analysis Steps for C2 Protocol Reverse Engineering:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. Find InternetOpenA/WinHttpOpen call -> trace to wrapper function
2. Follow data flow from encrypted config -> URL construction
3. Identify HTTP method (GET/POST), headers, and body format
4. Locate response parsing logic (JSON parsing, custom binary protocol)
5. Map the C2 command dispatcher (switch/case or jump table)
6. Document the command set (download, execute, exfiltrate, update, uninstall)

…

자주 묻는 질문

이것을 사용하려면 숙련된 프로그래머여야 하나요?

컴퓨터가 명령을 이해하는 방식(어셈블리 언어)과 프로그램이 운영체제와 상호작용하는 방식에 대한 기초 지식이 있으면 도움이 됩니다. 다만 Ghidra 도구가 코드를 더 읽기 쉽게 만들어 줍니다.

이것으로 바이러스를 만들 수 있나요?

이 도구는 기존 악성 소프트웨어를 이해하고 분석하기 위한 것이지, 만들기 위한 것이 아닙니다. 목표는 방어와 보안입니다.

‘역공학’이란 무엇인가요?

원래 설계도 없이 프로그램(여기서는 컴퓨터 프로그램)을 분해해 어떻게 만들어졌고 어떻게 작동하는지 이해하는 과정입니다.

상세 정보

작성자의 원본 설명

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 me

repo: mukul975/Anthropic-Cybersecurity-Skills

인기도

GitHub 스타
35k
순위
#8353
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬