मुख्य सामग्री पर जाएँ
Skillpedia
सिक्योरिटी35k · #8351

reverse-engineering-dotnet-malware-with-dnspy

यह क्या करती है

यह टूल .NET में लिखे प्रोग्राम (जैसे C# या VB.NET) का विश्लेषण करने में मदद करता है जो दुर्भावनापूर्ण हो सकते हैं। यह आपको मूल कोड देखने, सुरक्षा परतें हटाने, और पासवर्ड या कम्युनिकेशन एड्रेस जैसी ज़रूरी जानकारी खोजने देता है।

कब इस्तेमाल करें

  • ✓जब आपके पास कोई संदिग्ध .NET प्रोग्राम हो और आप समझना चाहते हों कि वह क्या करता है।
  • ✓अगर कोई .NET प्रोग्राम obfuscated किया गया हो और आपको उसका साफ़ कोड देखना हो।
  • ✓किसी .NET प्रोग्राम के अंदर पासवर्ड या सर्वर एड्रेस जैसी छिपी जानकारी खोजने के लिए।

Skill का लिंक

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

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/reverse-engineering-dotnet-malware-with-dnspy/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“इस संदिग्ध .NET प्रोग्राम का विश्लेषण करो और बताओ कि क्या यह पासवर्ड चुराने की कोशिश करता है।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह टूल dnSpy और de4dot जैसे प्रोग्राम का उपयोग करके .NET प्रोग्राम का कोड खोलता है। यह सुरक्षा परतें हटाता है और कोड ऐसे रूप में दिखाता है जिसे आप पढ़ सकें और उसमें जानकारी खोज सकें।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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

…
अक्सर पूछे जाने वाले सवाल

.NET क्या है?

.NET Microsoft का एक प्लेटफ़ॉर्म है, जिससे डेस्कटॉप ऐप, वेबसाइट और गेम जैसे कई तरह के प्रोग्राम बनाए जाते हैं। कई प्रोग्राम, जिनमें कुछ दुर्भावनापूर्ण भी शामिल हैं, .NET से बने होते हैं।

'obfuscation' क्या है?

Obfuscation एक तकनीक है जिससे प्रोग्राम के कोड को पढ़ना और समझना मुश्किल बना दिया जाता है, जैसे उसे उलझा दिया गया हो। मैलवेयर बनाने वाले अक्सर अपने इरादे छिपाने के लिए इसका उपयोग करते हैं।

क्या मैं इसे किसी भी तरह के प्रोग्राम का विश्लेषण करने के लिए इस्तेमाल कर सकता हूँ?

नहीं, यह टूल सिर्फ़ .NET से बने प्रोग्राम के लिए है। दूसरे प्रकार के प्रोग्राम (जिन्हें 'native' कहा जाता है) के लिए आपको अलग टूल चाहिए होंगे।

जानकारी

लेखक का मूल विवरण

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

लोकप्रियता

GitHub स्टार
35k
रैंकिंग में स्थान
#8351
लाइसेंस
Apache-2.0
अपडेट की गई
31/8/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills