Communitygithub.com

dotnet-reverse

.NET / C# 바이너리 리버스 엔지니어링. 대상이 .NET 어셈블리(PE 헤더에 CLR 포함, .exe/.dll 관리형 프로그램), C# 컴파일 결과물(NativeAOT 포함), 레드팀 Sharp* 도구(Rubeus/SharpHound 등), .NET 난독화 프로그램(ConfuserEx/SmartAssembly/Babel/Eazfuscator), .NET 로더/정보 탈취/쉘 악성코드일 때 사용합니다. dnSpyEx + de4dot을 우선 사용하며, AI가 직접 조작해야 할 때는 dnSpy MCP와 연동합니다. 순수 네이티브 바이너리에는 사용하지 않습니다(reverse-engineering/ida-reverse 사용).

dotnet-reverse란 무엇인가요?

이 스킬은 .NET 및 C# 바이너리를 리버스 엔지니어링하기 위한 포괄적인 작업 흐름을 제공합니다. 관리형 PE(CLR 헤더 포함), 레드팀 Sharp* 도구, 난독화된 .NET 악성코드(ConfuserEx, SmartAssembly, Babel, Eazfuscator 등)를 대상으로 합니다. dnSpyEx와 de4dot을 핵심 도구로 사용하며, IL 보기를 통해 C# 역컴파일러가 놓칠 수 있는 상태 머신이나 제어 흐름을 정확히 분석합니다. 또한 dnSpy MCP와의 연동을 통해 AI가 직접 역컴파일 및 IL 검사를 수행할 수 있습니다. 6단계(식별, 탐지, 난독화 해제, 정적 분석, 동적 분석, 패치)로 구성된 명확한 작업 흐름을 제공하며, 각 단계마다 구체적인 명령어와 확인 사항을 제시하여 일관된 분석 결과를 보장합니다.

지원 대상✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/zhaoxuya520/reverse-skill/tree/main/skills/dotnet-reverse

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

.NET / C# 리버스 작업 규범

ACTION REQUIRED(읽은 후 즉시 실행)

  1. NOW: DIE/file/CLR 헤더로 대상이 .NET 관리형인지 확인(아니면 ida-reverse/ / reverse-engineering/로 전환)
  2. NOW: 난독화 의심 시 → 먼저 de4dot으로 언패킹, *-clean.exe 생성, 원본 샘플 보존
  3. NEXT: dnSpyEx(또는 dnSpy MCP / ilspycmd) 정적: C# 탐색 + IL 보기로 핵심 판단 확인
  4. ACT: 평문/C2가 필요할 때 동적 디버깅; 로직 수정이 필요할 때 IL 패치를 C# 재컴파일보다 우선
  5. 단계 종료 시 사용자에게 3~6개 항목의 다음 단계 메뉴 제공(보고서 내보내기 포함)

적용 범위

다음 상황에 해당할 때 이 스킬을 우선 사용합니다:

  • .NET / C# 컴파일 결과물(관리형 PE / .exe / .dll) 식별 및 리버스
  • 레드팀 Sharp* 도구 체인(Rubeus, SharpHound, SharpShell 등) 분석
  • ConfuserEx / SmartAssembly / Babel / Eazfuscator / .NET Reactor 등의 난독화 해제
  • .NET 로더 / 정보 탈취 / RAT의 복호화 및 C2 로직 리버스
  • C# 프로그램 패치(판단 변경, 상수 변경, 키젠)
  • IL2CPP 이전 Mono/Unity 관리형 계층 분석(참고: IL2CPP 컴파일 후에는 네이티브이므로 reverse-engineering/ + seed-014 사용)

대상이 순수 네이티브 바이너리(C/C++/Go/Rust 컴파일, CLR 없음)인 경우 reverse-engineering/, ida-reverse/, radare2/를 사용하세요.

핵심 원칙

  • 식별 후 진행: 먼저 .NET 관리형 프로그램인지 확인(PE 헤더 CLR + #~ / #Strings 스트림 + mscoree _CorExeMain)한 후 dnSpy 사용 결정, IDA 사용 금지
  • IL 우선, C# 차선: dnSpyEx의 C# 역컴파일러는 정보 손실/왜곡 가능(컴파일러 생성 상태 머신, async/await, yield). 핵심 판단과 패치는 반드시 IL 편집기를 사용하고, C# 보기는 빠른 탐색용으로만 사용
  • de4dot 선행: 난독화 도구 발견 시 먼저 de4dot으로 언패킹 후 정적 분석 진행, 그렇지 않으면 문자열/제어 흐름이 모두 혼란스러움
  • MCP 연동: 환경에 dnSpy MCP(dnspy_* 도구)가 등록되어 있으면 MCP를 통해 decompile / IL 검사를 우선 진행, GUI 전환 최소화
  • 증거 기반 출력: 난독화 해제 결과물, 추출된 설정/C2/키, 패치 diff는 모두 파일로 저장

도구 체인 매핑

기능우선 도구비고
역컴파일 + 디버깅 + 패치dnSpyEx최고, 유일한 IL 편집기 GUI; 구버전 dnSpy는 업데이트 중단, Ex 브랜치 사용
경량 CLI / 헤드리스 역컴파일ILSpy (ilspycmd)배치, 스크립트, Linux/macOS에 적합
난독화 해제de4dotConfuserEx 풀 패키지, SmartAssembly 등 주요 쉘의 기본 해제 도구
난독화 도구 식별Detect It Easy (DIE) / file먼저 쉘 유형 판단 후 de4dot 매개변수 결정
프로그래밍 방식 IL 조작dnlibC# 스크립트로 메타데이터 / 문자열 복호화기 일괄 수정
AI 직접 조작dnSpy MCPdnspy_decompile / dnspy_inspect_il 등의 도구 인터페이스

전제: Windows 호스트에 dnSpyEx + de4dot 설치(choco 또는 릴리스); Linux/macOS는 ilspycmd + dotnet runtime 사용. 자세한 설치 매트릭스는 references/sharp-tools.md 참조.

6단계 작업 흐름

1. 식별(.NET 확인)

대상이 관리형 프로그램인지 확인, 네이티브 PE를 .NET으로 분석하지 않도록 주의:

# Windows
file target.exe                       # "PE32 executable ... for MS Windows" 만으로는 부족
# 핵심: CLR 존재 여부 확인
powershell -c "[System.Reflection.AssemblyName]::GetAssemblyName('target.exe')"
# 또는
dnSpyEx에 직접 드래그 앤 드롭 — 열리면 관리형

# 일반
strings target.exe | grep -iE "mscoree|_CorExeMain|mscorlib|System\\."

.NET 식별 표시:

  • PE 헤더 Data Directory[14] (CLR Runtime Header) 가 0이 아님
  • mscoree.dll 임포트 / _CorExeMain 진입점
  • #~, #Strings, #US, #GUID, #Blob 메타데이터 스트림
  • mscorlib / System.Private.CoreLib 문자열

NativeAOT 예외: 네이티브로 컴파일되어 CLR 헤더가 없지만 System.Private.CoreLib 문자열과 재구성된 타입 메타데이터가 있음 — 이런 경우 reverse-engineering/(IDA/r2) 사용, 이 스킬은 식별 힌트만 제공.

2. 탐지(난독화 도구 확인)

# DIE 빠른 식별
diec target.exe                        # Detect It Easy CLI
# 또는 dnSpyEx에 드래그, 대량의 깨진 클래스명 / 제어 흐름 변형 확인

일반 난독화 도구 → 언패킹 전략(자세한 내용은 references/obfuscators.md 참조):

난독화 도구특징de4dot 처리
ConfuserEx (1.0.0 / 2.x)<module> anti-tamper, 제어 흐름 변형, 문자열 암호화de4dot target.exe 일반적으로 자동 식별
SmartAssemblycircular/string encoding, 리소스 압축de4dot target.exe
Babel.NET메서드 본문 암호화, 제어 흐름de4dot target.exe
Eazfuscator.NET문자열/리소스 암호화de4dot, 일부 버전은 수동 필요
.NET Reactoranti-tamper + necrobitde4dot, 신규 버전은 실패할 수 있어 수동 필요

3. 난독화 해제(언패킹)

# de4dot 기본 자동 식별 (대부분의 쉘)
de4dot target.exe -o target-clean.exe

# 유형 지정(자동 식별 실패 시)
de4dot --type cfze target.exe          # ConfuserEx
de4dot --type sa target.exe            # SmartAssembly

# 다중 난독화 / de4dot unknown 보고
# de4dot --detect target.exe 명령어로 식별 결과 확인
de4dot --detect target.exe             # 식별 결과 확인
# anti-tamper를 먼저 패치한 후 de4dot를 실행해야 할 수 있음(references/obfuscators.md 참조)

결과물: target-clean.exe, 이후 분석에 사용. 원본 샘플은 비교용으로 보관.

4. 정적 분석(Static Analyze)

dnSpyEx로 언패킹된 샘플 로드:

  • C# 보기: 클래스 구조, 메서드 시그니처, 문자열 빠른 탐색(위치 파악용)
  • IL 보기: 핵심 판단, 암호화 로직, 상태 머신은 반드시 IL 확인(오른쪽 클릭 → Edit IL 또는 IL 보기)
  • 진입점 찾기: Main / Startup / 모듈 초기화자 (Module .cctor)
  • 핵심 로직 찾기: flag, password, verify, check, encrypt, http, Config 검색
문자열 위치 파악 → 역참조 → 해당 메서드 찾기 → IL 보기로 판단 로직 확인

5. 동적 분석(동적 디버깅)

dnSpyEx 디버거: 프로세스 연결 / 디버깅 시작, 주요 메서드에 중단점 설정, 실행 시 관찰:

  • 복호화된 평문 문자열(많은 난독화 도구는 문자열을 런타임에 복호화)
  • C2 주소, 설정 복호화 결과
  • 예외 기반 제어 흐름(안티 디버그에서 try/catch로 실제 경로 숨기기 자주 사용)

.NET 동적 디버깅은 네이티브보다 훨씬 친숙 — 객체 값, 문자열 내용을 직접 볼 수 있음. 정적 분석에 시간 낭비하지 말고 동적 디버깅을 우선.

6. 패치(필요 시 수정)

dnSpyEx → 메서드 오른쪽 클릭 → Edit Method (C#) 또는 Edit IL
  - 판단 변경: ldc.i4.0 → ldc.i4.1 (false→true)
  - 상수 변경: 문자열/숫자 직접 편집
  - 검증 제거: 전체 블록을 nop 처리
File → Save Module → 원본 파일 교체

IL 패치 신뢰성 > C# 패치: C# 재컴파일은 실패할 수 있음(참조 누락, 구문 오류), IL 편집은 거의 왜곡되지 않음. 자세한 내용은 references/common-workflow.md 참조.

트리거 시나리오 라우팅

사용자가 다음을 언급하면 이 스킬로 진입:

  • ".NET / C# 바이너리 리버스" / "C# 프로그램 역컴파일"
  • "dnSpy 분석" / "dnSpyEx 패치"
  • "ConfuserEx / SmartAssembly / Babel 난독화 해제 / 언패킹"
  • "Sharp* 도구 분석" (Rubeus / SharpHound / SharpShell)
  • ".NET 악성코드 / 로더 / 정보 탈취 리버스"
  • "C# 프로그램 패치 / 키젠 / 판단 수정"

전환 시점

  • IL2CPP 컴파일된 Unity 게임 → reverse-engineering/ + seed-014_unity-il2cpp-reverse.md(IL2CPP는 네이티브, dnSpy 사용 불가)
  • NativeAOT 결과물 → reverse-engineering/(위와 동일, 네이티브)
  • 순수 네이티브 PE(CLR 없음) → reverse-engineering/ / ida-reverse/
  • 심볼/함수를 다른 버전으로 일괄 이전 필요 → binary-diff/
  • 공격 경로 / 호출 체인 다이어그램 필요 → diagram-generator/

라우팅 컨텍스트

상위 진입: skills/SKILL.md(총괄), routing.md 하위 출구:

  • IL2CPP / NativeAOT(네이티브) → reverse-engineering/
  • 심층 네이티브 .so/.dll 섹션 분석 → ida-reverse/ / radare2/
  • AI가 dnSpy를 직접 조작해야 함 → dnSpy MCP 등록 및 연동(references/sharp-tools.md 참조)

동급 연관 모듈:

  • reverse-engineering/languages-compiled.md(.NET 소개, 본 모듈로 연결)
  • apk-reverse/(Xamarin/MAUI Android 리버스 시 C# 계층 보려면 본 모듈로 복귀 가능)

참고 문서

  • references/obfuscators.md — ConfuserEx / SmartAssembly / Babel / Eazfuscator / .NET Reactor 난독화 해제 상세 + anti-tamper 우회
  • references/common-workflow.md — 전체 작업 흐름, IL 패치 신뢰성, 문자열 복호화기 추출, 상태 머신 식별
  • references/sharp-tools.md — 레드팀 Sharp* 도구 분석, 도구 설치 매트릭스, dnSpy MCP 통합, 커뮤니티 리소스 인덱스

작업 완료 자가 점검

  • CLR / 관리형 신원 확인(또는 본 스킬에서 전환)했는가?
  • 난독화 샘플을 먼저 de4dot/동등 언패킹 후 심층 분석했는가?
  • 핵심 로직을 IL 보기로 검증했는가(C# 의사 코드만 보지 않았는가)?
  • 결과물(clean 샘플 / 설정 / 패치 diff)을 파일로 저장하고 재현 가능한가?
  • 다음 단계 메뉴 또는 보고서 출구를 제공했는가?

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

api-security

Use for authorized security assessment of REST, GraphQL, WebSocket, or SOAP APIs, including discovery, authentication, authorization, rate-limit, and CI/CD testing.

apk-reverse

在 CLI 环境下做 Android APK 逆向时使用。适用于 APK 解包、Java 反编译、smali 修改、重打包、Frida 动态 Hook,以及按需切换到 so/native 分析。优先使用本机已安装的 jadx、apktool、frida、adb、ida-reverse、radare2。

attack-chain

Use for authorized multi-stage attack-path planning and orchestration when a task spans reconnaissance, initial access, privilege escalation, lateral movement, or impact assessment. Route single-stage tasks directly to their specialist skill.

binary-diff

|

binary-ninja-reverse

Use for authorized binary analysis in Binary Ninja, including HLIL/MLIL/LLIL inspection, strings/imports/exports, cross-references, types, patch review, Python API automation, and optional Binary Ninja MCP or localhost HTTP integration.

browser-automation

|

browser-extension-reverse

Use for authorized reverse engineering of browser extensions (Chrome/Firefox) including manifest analysis, background workers, and extension-based credential or traffic logic recovery.

case-review

Reviews a reverse-skill case package for scope readiness, Evidence to Finding to Path traceability, work item coverage, timeline references, and optional artifact hash integrity before report handoff.

cloud-k8s

Use for authorized cloud, container, and Kubernetes security assessment including metadata SSRF, IAM misconfig, container escape paths, and cluster RBAC review.

code-audit

Use for authorized source-code security review and SAST workflows including Semgrep, CodeQL patterns, dangerous API hunting, and fix verification.

ctf-sandbox

Thin PRIMARY for CTF / AWD / 靶场 multi-type orchestration. Hands off to the sidecar CTF-Sandbox-Orchestrator. Use when the user says CTF, AWD, 靶场, or 比赛题 and no more specific pwn/APK/IDA route already won.

database-security

Use for authorized database security assessment covering PostgreSQL/MySQL/MSSQL/Mongo/Redis exposure, authz, UDF/command paths, and misconfiguration review.

diagram-generator

generate, refine, validate, and render diagrams from natural language, notes, code snippets, schemas, tables, or existing diagram source. use for flowcharts, swimlanes, sequence diagrams, state diagrams, er diagrams, class diagrams, architecture/c4-style diagrams, dependency graphs, gantt charts, mind maps, user journeys, sankey-style flows, org charts, network graphs, and other visual models. supports mermaid by default, graphviz dot for complex graph layout, plantuml for uml-heavy engineering diagrams, and svg output when direct markup is more reliable.

digital-forensics

Use for authorized digital forensics including memory dumps, disk timelines, PCAP investigation, artifact triage, and IR evidence preservation.

docs-generator

|

edr-bypass-re

|

email-security

Use for authorized email security review including phishing analysis, header authentication (SPF/DKIM/DMARC), BEC patterns, and mailbox token abuse research.

firmware-pentest

|

ghidra-reverse

Use for free/open reverse engineering with Ghidra (headless or GUI), including decompile, cross-refs, and optional Ghidra MCP workflows when IDA is unavailable.

go-rust-reverse

Use for reverse engineering stripped Go and Rust binaries including runtime recognition, pclntab/moduel data recovery, panic strings, and idiomatic decompilation recovery.

관련 스킬