Langsung ke konten
Skillpedia
Keamanan35k Β· #8351

reverse-engineering-dotnet-malware-with-dnspy

Fungsinya

Tool ini membantu menganalisis program yang ditulis dengan .NET (seperti C# atau VB.NET) yang mungkin berbahaya. Tool ini memungkinkan Anda melihat kode asli, menghapus proteksi, dan menemukan informasi penting seperti kata sandi atau alamat komunikasi.

Kapan dipakai

  • βœ“Saat Anda memiliki program .NET yang mencurigakan dan ingin memahami apa yang dilakukannya.
  • βœ“Jika program .NET disamarkan (obfuscated) dan Anda perlu melihat kode yang sudah bersih.
  • βœ“Untuk menemukan informasi rahasia seperti kata sandi atau alamat server di dalam program .NET.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/reverse-engineering-dotnet-malware-with-dnspy/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œAnalisis program .NET yang mencurigakan ini dan beri tahu saya apakah ia mencoba mencuri kata sandi.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Tool ini menggunakan program seperti dnSpy dan de4dot untuk membuka kode program .NET. Tool ini menghapus proteksi dan menampilkan kode dengan cara yang bisa Anda baca dan telusuri untuk mencari informasi.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Reverse Engineering .NET Malware with dnSpy

When to Use

  • A malware sample is identified as a .NET assembly (C#, VB.NET, F#) requiring decompilation
  • Analyzing .NET-based malware families (AgentTesla, AsyncRAT, RedLine Stealer, Quasar RAT)
  • Deobfuscating .NET code protected by ConfuserEx, SmartAssembly, or custom obfuscators
  • Extracting hardcoded C2 configurations, encryption keys, and credentials from managed assemblies
  • Debugging .NET malware at runtime to observe decryption routines and dynamic behavior

Do not use for native (unmanaged) PE binaries; use Ghidra or IDA for native code analysis.

Prerequisites

  • dnSpy or dnSpyEx installed (https://github.com/dnSpyEx/dnSpy - community maintained fork)
  • de4dot for automated .NET deobfuscation (https://github.com/de4dot/de4dot)
  • ILSpy as an alternative decompiler for cross-validation
  • .NET SDK installed for recompiling modified assemblies during analysis
  • Isolated Windows VM for running dnSpy debugger on live malware
  • Detect It Easy (DIE) for identifying the .NET obfuscator used

Workflow

Step 1: Identify .NET Assembly and Obfuscator

Verify the sample is a .NET binary and detect protection:

# Check if file is .NET assembly
file suspect.exe
# Output should contain "PE32 executable" with .NET metadata

# Detect obfuscator with Detect It Easy
diec suspect.exe

# Python-based .NET detection
python3 << 'PYEOF'
import pefile

pe = pefile.PE("suspect.exe")

# Check for .NET COM descriptor
if hasattr(pe, 'DIRECTORY_ENTRY_COM_DESCRIPTOR'):
    print("[*] .NET assembly detected")
    print(f"    Runtime version: {pe.DIRECTORY_ENTRY_COM_DESCRIPTOR}")
else:
    # Check for mscoree.dll import (alternative detection)
    for entry in pe.DIRECTORY_ENTRY_IMPORT:
        if entry.dll.decode().lower() == "mscoree.dll":
            print("[*] .NET assembly detected (mscoree.dll import)")
            break
    else:
        print("[!] Not a .NET assembly")

# Check section names for .NET indicators
for section in pe.sections:
    name = section.Name.decode().rstrip('\x00')
    if name in ['.text', '.rsrc', '.reloc']:
        print(f"    Section: {name} (typical .NET)")
PYEOF

Step 2: Deobfuscate with de4dot

Remove common .NET obfuscation before manual analysis:

# Run de4dot to identify and remove obfuscation
de4dot suspect.exe -o suspect_cleaned.exe

# Force specific deobfuscator
de4dot suspect.exe -p cf  # ConfuserEx
de4dot suspect.exe -p sa  # SmartAssembly
de4dot suspect.exe -p dr  # Dotfuscator
de4dot suspect.exe -p rv  # Reactor
de4dot suspect.exe -p bl  # Babel.NET

# Verbose output for debugging
de4dot -v suspect.exe -o suspect_cleaned.exe

# Handle multi-file assemblies
de4dot suspect.exe suspect_helper.dll -o cleaned/
Common .NET Obfuscators:
━━━━━━━━━━━━━━━━━━━━━━━
ConfuserEx:      String encryption, control flow, anti-debug, anti-tamper
SmartAssembly:   String encoding, flow obfuscation, pruning
Dotfuscator:     Renaming, string encryption, control flow
.NET Reactor:    Native code generation, necrobit, anti-debug
Babel.NET:       String encryption, resource encryption, code virtualization
Crypto Obfuscator: String encryption, anti-debug, watermarking
Custom:          Malware-specific obfuscation (manual de4dot configuration needed)

Step 3: Open in dnSpy and Analyze Code

Load the deobfuscated assembly in dnSpy for source-level analysis:

dnSpy Analysis Workflow:
━━━━━━━━━━━━━━━━━━━━━━━
1. File -> Open -> Select cleaned assembly
2. Navigate to the entry point:
   - Assembly Explorer -> <namespace> -> Program class -> Main method
   - Or: Right-click assembly -> Go to Entry Point

3. Key areas to examine:
   - Entry point (Main) for initialization and execution flow
   - Form classes for UI-based malware (RATs, stealers)
   - Network/HTTP classes for C2 communication
   - Crypto/encryption classes for data protection
   - Resource access for embedded payloads
   - Timer/Thread classes for persistence and scheduling

4. Navigation shortcuts:
   Ctrl+G       - Go to token/address
   Ctrl+Shift+K - Search assemblies
   F12          - Go to definition
   Ctrl+R       - Analyze (find usages)
   F5           - Start debugging
   F9           - Toggle breakpoint

Step 4: Extract Configuration and C2 Data

Locate hardcoded configuration in the decompiled source:

// Common .NET malware configuration patterns:

// Pattern 1: Static class with hardcoded values

…
Pertanyaan umum

Apa itu .NET?

.NET adalah platform dari Microsoft yang digunakan untuk membuat berbagai jenis program, termasuk aplikasi desktop, situs web, dan game. Banyak program, termasuk sebagian yang berbahaya, dibuat menggunakan .NET.

Apa itu 'obfuscation'?

Obfuscation adalah teknik untuk membuat kode program sulit dibaca dan dipahami, seolah-olah kodenya diacak. Teknik ini sering dipakai oleh pembuat malware untuk menyembunyikan maksud mereka.

Bisakah saya memakai ini untuk menganalisis program jenis apa pun?

Tidak, tool ini khusus untuk program yang dibuat dengan .NET. Untuk program jenis lain (disebut 'native'), Anda memerlukan tool yang berbeda.

Detail

Deskripsi asli dari pembuat

Reverse engineers .NET malware samples using the dnSpy decompiler and debugger to read C#/VB.NET source, deobfuscate code protected by tools like ConfuserEx or SmartAssembly, and extract hardcoded C2 configurations, keys, and credentials. Use when a sample is identified as a .NET assembly (e.g. AgentTesla, AsyncRAT, RedLine Stealer, Quasar RAT) and needs decompilation, deobfuscation, or config ext

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularitas

Bintang GitHub
35k
Peringkat
#8351
Lisensi
Apache-2.0
Diperbarui
31/8/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa