Zum Inhalt springen
Skillpedia
Sicherheit35k · #8351

reverse-engineering-dotnet-malware-with-dnspy

Was er macht

Dieses Tool hilft dir, möglicherweise schädliche Programme zu analysieren, die in .NET geschrieben sind (etwa in C# oder VB.NET). Du kannst damit den ursprünglichen Code ansehen, Schutzmechanismen entfernen und wichtige Informationen wie Passwörter oder Server-Adressen finden.

Wann du ihn nutzt

  • ✓Wenn du ein verdächtiges .NET-Programm hast und wissen willst, was es tut.
  • ✓Wenn ein .NET-Programm verschleiert ist und du den sauberen Code sehen musst.
  • ✓Um geheime Informationen wie Passwörter oder Server-Adressen in einem .NET-Programm zu finden.

Link zum Skill

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

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/reverse-engineering-dotnet-malware-with-dnspy/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Analysiere dieses verdächtige .NET-Programm und sag mir, ob es versucht, Passwörter zu stehlen.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Das Tool nutzt Programme wie dnSpy und de4dot, um den Code des .NET-Programms zu öffnen. Es entfernt Schutzmechanismen und zeigt den Code so an, dass du ihn lesen und nach Informationen durchsuchen kannst.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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

…
Häufige Fragen

Was ist .NET?

.NET ist eine Plattform von Microsoft, mit der sich verschiedene Arten von Programmen erstellen lassen, darunter Desktop-Anwendungen, Websites und Spiele. Viele Programme, auch schädliche, werden mit .NET entwickelt.

Was bedeutet 'Verschleierung' (Obfuscation)?

Verschleierung ist eine Technik, die den Code eines Programms schwer lesbar macht, als wäre er durcheinandergewürfelt. Malware-Entwickler nutzen sie oft, um ihre Absichten zu verbergen.

Kann ich das für jede Art von Programm nutzen?

Nein, dieses Tool ist speziell für Programme gedacht, die mit .NET erstellt wurden. Für andere Programme (sogenannte 'native' Programme) brauchst du andere Tools.

Details

Originalbeschreibung des Autors

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

Beliebtheit

GitHub-Sterne
35k
Platz im Ranking
#8351
Lizenz
Apache-2.0
Aktualisiert
31.8.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills