Malware Analysis & Sandboxing
🦠 Malware Analysis & Sandboxing
Overview
This skill enables Claude to assist with malware analysis workflows including static analysis, dynamic/behavioral analysis, YARA rule generation, sandbox environment setup, and malware classification. Claude can interpret analysis results, identify malware families, and generate detection signatures.
⚠️ WARNING: Always handle malware samples in isolated, controlled environments. Never execute suspicious files on production systems. Use dedicated VMs or sandboxes.
Prerequisites
Required
- Python 3.8+
yara-python,pefile,hashlib
Optional
- YARA — Pattern matching for malware
- Cuckoo Sandbox / CAPE — Automated dynamic analysis
- Docker — Container-based isolation
- Volatility — Memory analysis
- VirusTotal API — Multi-engine scanning
- Ghidra — Binary reverse engineering
pip install yara-python pefile python-magic requests ssdeep
Core Capabilities
1. Static Malware Analysis
Analyze malware without execution:
When the user asks to analyze a malware sample:
- Calculate cryptographic hashes (MD5, SHA-1, SHA-256, Imphash, SSDeep)
- Identify file type and format (PE, ELF, script, document, etc.)
- Calculate entropy to detect packing or encryption
- Extract embedded strings (C2 URLs, IPs, registry keys, mutex names)
- Analyze imports/exports for suspicious API calls
- Identify packing/obfuscation (UPX, Themida, custom packers)
- Extract embedded resources and overlays
- Check for known malware signatures
- Map suspicious APIs to MITRE ATT&CK techniques
- Generate IOCs (hashes, strings, network indicators)
Suspicious API Categories:
| Category | APIs |
|---|---|
| Process Injection | CreateRemoteThread, WriteProcessMemory, VirtualAllocEx, NtMapViewOfSection |
| Persistence | RegSetValueEx, CreateService, SchTasks, WinExec |
| Anti-Analysis | IsDebuggerPresent, CheckRemoteDebuggerPresent, GetTickCount, QueryPerformanceCounter |
| Network | InternetOpenUrl, HttpSendRequest, WSAStartup, connect, URLDownloadToFile |
| Crypto | CryptEncrypt, CryptDecrypt, CryptHashData, BCryptEncrypt |
| File Operations | CreateFileW, WriteFile, DeleteFileW, MoveFileW |
| Keylogging | SetWindowsHookEx, GetAsyncKeyState, GetKeyState |
2. YARA Rule Generation
Create detection rules from samples:
When the user asks to create YARA rules:
- Extract unique byte sequences from the sample
- Identify distinctive strings and patterns
- Select stable indicators unlikely to change between variants
- Write YARA rules with proper metadata
- Test rules against the sample and benign files for false positives
- Optimize rules for performance (avoid expensive regex)
- Add condition complexity scoring
YARA Rule Template:
rule MalwareFamily_Variant : tag1 tag2 {
meta:
author = "Analyst Name"
description = "Detects [Malware Family] [Variant]"
date = "2024-01-01"
hash = "sha256_hash"
reference = "https://example.com/report"
tlp = "WHITE"
strings:
$s1 = "unique_string_1" ascii wide
$s2 = { 4D 5A 90 00 03 00 00 00 } // hex pattern
$s3 = /regex_pattern/
condition:
uint16(0) == 0x5A4D and
filesize < 5MB and
2 of ($s*)
}
3. Dynamic/Behavioral Analysis
Guide sandbox-based analysis:
When the user asks for dynamic analysis:
- Recommend appropriate sandbox environment
- Configure monitoring (API hooks, network capture, filesystem monitoring)
- Suggest detonation parameters (timeout, user simulation)
- Analyze behavioral reports (process trees, file modifications, registry changes)
- Map behaviors to MITRE ATT&CK techniques
- Identify C2 communication patterns
- Extract dropped files and secondary payloads
- Correlate static and dynamic findings
4. Malware Classification & Family Identification
Classify unknown samples:
When the user asks to classify malware:
- Compare hashes against known malware databases
- Analyze behavioral patterns for family indicators
- Check for known packer/crypter signatures
- Compare string patterns with known families
- Use function-level similarity (SSDeep, import hash)
- Map to known threat actor campaigns
- Assign confidence level to classification
5. Sandbox Environment Setup
Guide secure analysis environment creation:
When the user asks to set up a sandbox:
- VM configuration (isolated network, snapshots, minimal OS)
- Analysis tool installation checklist
- Network monitoring setup (INetSim, FakeDNS)
- Anti-anti-VM countermeasures
- Automated analysis pipeline configuration
- Data collection and evidence preservation
Usage Instructions
Example Prompts
> Perform static analysis on this suspicious PE file
> Generate YARA rules from these malware samples
> Set up a malware analysis sandbox with Docker
> What MITRE ATT&CK techniques does this malware use?
> Create a behavioral analysis report from this Cuckoo sandbox output
> Classify this sample — what malware family does it belong to?
Script Reference
static_analyzer.py
python scripts/static_analyzer.py --file malware.exe --output report.json
python scripts/static_analyzer.py --file sample.dll --hashes --strings --imports
yara_generator.py
python scripts/yara_generator.py --samples ./malware_samples/ --output rules.yar
python scripts/yara_generator.py --file single_sample.exe --rule-name "MyMalware" --output rule.yar
Integration Guide
Chaining with Other Skills
- ← Threat Hunting (06): Receive suspicious samples identified during hunts
- ← Incident Response (07): Analyze malware collected during IR engagements
- → Reverse Engineering (04): Deep-dive into complex samples
- → Blue Team Defense (15): Generate detection signatures from analysis
- → Threat Hunting (06): Feed IOCs back for environment-wide hunting
References
More from masriyan/claude-code-cybersecurity-skill
reverse engineering & binary analysis
Binary analysis, disassembly, decompilation, firmware RE, and protocol reverse engineering
10incident response & digital forensics
IR playbook execution, evidence collection, timeline analysis, memory forensics, and post-incident reporting
10cryptographic analysis & assessment
Cipher identification, SSL/TLS auditing, hash analysis, key strength assessment, and crypto implementation review
10exploit development & payload engineering
Proof-of-concept development, payload crafting, shellcode generation, and exploitation techniques
10vulnerability scanning & assessment
Automated vulnerability scanning, CVE detection, dependency auditing, and security configuration assessment
7cloud security & container hardening
AWS/Azure/GCP security auditing, container hardening, IaC scanning, and Kubernetes security
7