| name | malware-analysis |
| description | Malware analysis and reverse engineering toolkit. Use this skill whenever the user needs to analyze suspicious files, extract IOCs, deobfuscate malware, analyze Android APKs, trace Node.js loaders, or perform any malware-related investigation. Trigger on mentions of malware, suspicious executables, PE/ELF analysis, Yara rules, ClamAV, Android malware, obfuscation, control-flow analysis, or any security investigation involving potentially malicious software. |
Malware Analysis Skill
A comprehensive toolkit for malware analysis, reverse engineering, and threat investigation.
Quick Start
sudo apt-get install -y yara clamav
python scripts/yara_rules_fetcher.py
yara -w rules/malware_rules.yar /path/to/suspicious/file
Core Analysis Workflows
1. Static Analysis Pipeline
Run this sequence for initial triage of suspicious files:
md5sum file.exe
sha256sum file.exe
./scripts/malware_scanner.sh /path/to/file
capa file.exe
strings file.exe | grep -iE "(http|url|cmd|powershell|reg|wmi)"
2. Yara Rule Management
python scripts/yara_rules_fetcher.py
yara -w rules/malware_rules.yar suspicious.exe
yara -w -r rules/malware_rules.yar /path/to/directory/
python3 yarGen.py --excludegood -m /path/to/malware/
3. Android Malware Analysis
APK Triage
unzip -l app.apk
unzip -o app.apk -d extracted/
grep -r "su\|Runtime.exec\|getDeviceId\|getSimSerial" extracted/
grep -A5 "BOOT_COMPLETED" extracted/AndroidManifest.xml
Native Library Analysis (JNI Deobfuscation)
Use the bundled angr script to decode obfuscated JNI strings:
python scripts/angr_jni_decoder.py \
--so /path/to/libnative.so \
--base-addr 0x00100000 \
--decoder-addr 0x00100e10 \
--output decoded_strings.json
Kimwolf Botnet Detection
ls -la /dev/ | grep -E "@niggabox|@niggakernel"
ps aux | grep -E "netd_services|tv_helper"
ss -tunap | grep ":853"
file /data/data/<pkg>/niggakernel
strings niggakernel | grep -iE "(c2|http|dns|google|cloudflare)"
4. Control-Flow Obfuscation Analysis
For malware using JMP/CALL RAX dispatchers (e.g., SLOW#TEMPEST):
python scripts/unicorn_dispatcher.py \
--input suspicious.exe \
--dispatcher-addr 0x00401234 \
--output patched.exe
5. Node.js Loader Analysis
npx nexe_unpacker suspicious.exe
node -r ./tracer.js extracted/main.js
6. AutoIt Loader Analysis
find / -name "*.a3x" 2>/dev/null
find / -name "AutoIt3.exe" 2>/dev/null
schtasks /query /fo LIST /v | findstr /i "AutoIt3"
python scripts/autoit_decryptor.py \
--input payload.a3x \
--secret <hmac-secret> \
--output decrypted.bin
Detection Techniques
File Stacking
find /var/www -type f -newermt "2024-01-01" -ls
ls -lt /var/www/html/ | head -20
Baseline Comparison
find /important/folder -type f -exec sha256sum {} \; > baseline.txt
find /important/folder -type f -exec sha256sum {} \; > current.txt
diff baseline.txt current.txt
Statistical Analysis
awk '{print $7}' access.log | sort | uniq -c | sort -rn | head -20
grep -E "\.php|\.asp|\.aspx" access.log | awk '{print $7}' | sort | uniq -c | sort -rn
IOC Management
Extract IOCs from Analysis
strings file.exe | grep -oE "https?://[^ ]+"
strings file.exe | grep -oE "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
strings file.exe | grep -oE "[a-zA-Z0-9-]+\.[a-zA-Z]{2,}"
strings file.exe | grep -oE "[a-fA-F0-9]{32,64}"
Loki IOC Scanner
./Loki -f /path/to/file -i iocs.txt
Apple Binary Analysis
codesign -vv -d /path/to/binary 2>&1 | grep -E "Authority|TeamIdentifier"
codesign --verify --verbose /path/to/binary
spctl --assess --verbose /path/to/binary
Reference Tools
| Tool | Purpose | Command |
|---|
| Yara | Pattern matching | yara -w rules.yar target |
| ClamAV | Antivirus scanning | clamscan target |
| Capa | Capability detection | capa target.exe |
| Loki | IOC scanning | ./Loki -f target -i iocs.txt |
| FLOSS | String extraction | floss target.exe |
| PEpper | PE analysis | ./PEpper target.exe |
| DiE | Packer detection | die target.exe |
| rkhunter | Rootkit detection | rkhunter --check |
Online Analysis Services
Safety Guidelines
- Always analyze in isolated environments (VMs, sandboxes)
- Network isolation - disable or monitor network access
- Snapshot before execution - save VM state for rollback
- Don't run unknown malware on production systems
- Use proper PPE - gloves, masks when handling physical media
- Document everything - maintain chain of custody
Output Formats
Analysis Report Template
# Malware Analysis Report
## Sample Information
- Filename: <name>
- Size: <bytes>
- MD5: <hash>
- SHA256: <hash>
- File Type: <type>
## Static Analysis
- Packers: <detected packers>
- Imports: <suspicious imports>
- Strings: <notable strings>
- Capabilities: <capa results>
## Dynamic Analysis
- Behavior: <observed behavior>
- Network: <C2, domains, IPs>
- File System: <created/modified files>
- Registry: <registry changes>
## IOCs
- Hashes: <list>
- Domains: <list>
- IPs: <list>
- File Paths: <list>
## Conclusion
<summary of findings>
Next Steps
After initial analysis:
- Correlate with threat intelligence - check IOCs against known campaigns
- Deep reverse engineering - use IDA/Ghidra for detailed analysis
- Behavioral analysis - run in sandbox with monitoring
- Yara rule creation - generate rules for detection
- Report generation - document findings for stakeholders
References