All skills
ljagiello avatar

/ctf-malware

@61c2efe
by Lukasz Jagielloljagiello/ctf-skills3.4k stars
393

Provides malware analysis and network traffic techniques for CTF challenges. Use when analyzing obfuscated scripts, malicious packages, custom crypto protocols, C2 traffic, PE/.NET binaries, RC4/AES encrypted communications, YARA rules, shellcode analysis, memory forensics for malware (Volatility malfind, process injection detection), anti-analysis techniques (VM/sandbox detection, timing evasion, API hashing, process injection, environment checks), or extracting malware configurations and indicators of compromise.

Use this Skill: https://skilld.dev/gh/ljagiello/ctf-skills/ctf-malware

This session only. Nothing lands on disk.

pe-and-dotnet.md

≈761 tokens on demand. Your agent reads this file only when SKILL.md points to it.

PE, .NET, and Binary Malware Analysis

Table of Contents


PE Analysis

peframe malware.exe      # Quick triage
pe-sieve                 # Runtime analysis
pestudio                 # Static analysis (Windows)

Sandbox Evasion Checks

Look for:

  • VM detection (VMware, VirtualBox artifacts)
  • Debugger detection (IsDebuggerPresent)
  • Timing checks (sleep acceleration)
  • Environment checks (username, computername)
  • File/registry checks for analysis tools

Malware Configuration Extraction

Common storage locations:

  • .data section (hardcoded)
  • Resources (PE resources, .NET resources)
  • Registry keys written at install
  • Encrypted config file dropped to disk

Extraction tools:

# PE resources
wrestool -x -t 10 malware.exe -o config.bin

# .NET resources
monodis --mresources malware.exe

# Strings in .rdata/.data
objdump -s -j .rdata malware.exe

.NET DNS-based C2

Pattern: Deobfuscated .NET malware with DNS C2

Analysis with dnSpy:

  1. Find network functions (TcpClient, DnsClient, etc.)
  2. Identify encoding/encryption wrappers
  3. Look for command dispatch (switch on opcode)

AsmResolver for programmatic analysis:

using AsmResolver.DotNet;
var module = ModuleDefinition.FromFile("malware.dll");
foreach (var type in module.GetAllTypes()) {
    foreach (var method in type.Methods) {
        // Analyze method body
    }
}

.NET Malware Analysis (C2 Extraction)

Tools: ILSpy, dnSpy, dotPeek

LimeRAT C2 extraction (Whisper Of The Pain):

  1. Open .NET binary in dnSpy
  2. Find configuration class with Base64 encoded string
  3. Identify decryption method (typically AES-256-ECB with derived key)
  4. Key derivation: MD5 of hardcoded string -> first 15 + full 16 bytes + null = 32-byte key
  5. Decrypt: Base64 decode -> AES-ECB decrypt -> reveals C2 IP/domain
from Crypto.Cipher import AES
import hashlib, base64

key_source = '${8\',`d0}n,~@J;oZ"9a'
md5 = hashlib.md5(key_source.encode()).hexdigest()
# Key = first 15 bytes of MD5 + full 16 bytes + null (64 hex chars -> 32 bytes)
key = bytes.fromhex(md5[:30] + md5 + '00')[:32]

cipher = AES.new(key, AES.MODE_ECB)
plaintext = cipher.decrypt(base64.b64decode(encrypted_b64))

PyInstaller + PyArmor Unpacking

# Step 1: Extract PyInstaller archive
python pyinstxtractor.py malware.exe
# Look for main .pyc file in extracted directory

# Step 2: If PyArmor-protected, use unpacker
# github.com/Svenskithesource/PyArmor-Unpacker
# Three methods available; choose based on PyArmor version

# Step 3: Clean up deobfuscated source
# Remove fake/dead-code functions (confusion code)
# Identify core encryption/exfiltration logic

Source: SKILL.md on GitHub

2 warnings16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides a comprehensive toolkit and reference for malware analysis and network traffic techniques in CTF challenges. It includes methods for static and dynamic analysis, memory forensics, and C2 protocol decryption. While it contains high-risk operations like executing untrusted binaries and using elevated privileges for network monitoring, these are inherent to its primary purpose as a security analysis resource.

  • Socket16d

    1 alert: gptSecurity

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    4/4 files flagged

  • ZeroLeaks5mo

    1 finding · Score: 86/100

Signed by skilld at 61c2efe. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 3 weeks ago
metadata
{
  "user-invocable": "false"
}
All 1 allowed tools
Bash Read Write Edit Glob Grep Task WebFetch WebSearch
Other metadata
compatibility
Requires filesystem-based agent (Claude Code or similar) with bash, Python 3, and internet access for tool installation.

README badge

README badge for ljagiello/ctf-skills/ctf-malware