| name | reverser-ransomware-analysis |
| description | Ransomware family identification and analysis — encryption scheme identification, key recovery techniques, ransom note parsing, shadow copy/recovery inhibition analysis, decryptor availability check, and IOC extraction for common ransomware families. |
| allowed-tools | Bash Read Write |
| metadata | {"when_to_use":"ransomware encrypted files ransom note decrypt recovery key lockbit revil conti blackcat alphv encryption crypto aes rsa chacha payment bitcoin","subdomain":"reverser","tags":"ransomware, encryption, decryptor, key recovery, incident response","mitre_attack":"T1486, T1490, T1489"} |
Ransomware Analysis
Identify ransomware families, analyze encryption implementations, attempt key recovery, and extract IOCs for threat intelligence and incident response.
Quick Reference
strings ransom_note.txt | head -20
ls -la /path/to/encrypted/ | head -20
strings <TARGET> | grep -iE 'vssadmin|wmic.*shadowcopy|bcdedit|wbadmin'
python3 -c "
import math
data=open('encrypted_file','rb').read()
c=[data.count(bytes([b])) for b in range(256)]
t=len(data)
e=-sum((x/t)*math.log2(x/t) for x in c if x)
print(f'Entropy: {e:.3f}/8 — {\"fully encrypted\" if e > 7.9 else \"partial/header encryption\" if e > 7.0 else \"not encrypted\"}')"
MITRE ATT&CK Mapping
| Technique | ID | How It Appears |
|---|
| Data Encrypted for Impact | T1486 | File encryption using AES/ChaCha20 + RSA key wrap |
| Inhibit System Recovery | T1490 | vssadmin delete shadows, bcdedit, wbadmin delete catalog |
| Service Stop | T1489 | Stopping SQL, Exchange, backup services before encryption |
| System Shutdown/Reboot | T1529 | Forced reboot after encryption; bootlocker ransomware |
| Data Destruction | T1485 | Wiper variants masquerading as ransomware |
| Exfiltration Over C2 | T1041 | Double extortion: data exfil before encryption |
| Defacement: Internal | T1491.001 | Desktop wallpaper change to ransom note |
1. Family Identification
Determine which ransomware family you're dealing with.
cat ransom_note.txt
strings <TARGET> | grep -iE 'lockbit\|revil\|conti\|blackcat\|phobos\|dharma\|stop\|djvu'
yara -r /opt/yara-rules/ransomware/ <TARGET>
strings <TARGET> | grep -iE 'Global\\|mutex\|pipe'
2. Encryption Scheme Analysis
Reverse the crypto implementation to assess recoverability.
strings <TARGET> | grep -iE 'CryptEncrypt\|CryptGenKey\|CryptImportKey\|CryptAcquireContext'
strings <TARGET> | grep -iE 'AES\|RSA\|ChaCha\|Salsa\|Blowfish\|RC4\|ECDH\|Curve25519'
strings <TARGET> | grep -iE 'BCrypt\|NCrypt\|OpenSSL\|mbedtls\|sodium\|libcrypto'
python3 << 'EOF'
import pefile
pe = pefile.PE("<TARGET>")
for entry in pe.DIRECTORY_ENTRY_IMPORT:
dll = entry.dll.decode()
for imp in entry.imports:
name = imp.name.decode() if imp.name else f"ord_{imp.ordinal}"
if any(k in name.lower() for k in ['crypt', 'rsa', 'aes', 'key', 'encrypt', 'hash', 'rand']):
print(f" {dll}: {name}")
EOF
python3 << 'EOF'
import struct
with open("encrypted_file.lockbit", "rb") as f:
f.seek(-256, 2)
trailer = f.read()
print("Trailer hex:", trailer.hex())
f.seek(0)
header = f.read(64)
(, header.hex())
EOF
3. Key Recovery Techniques
strings <TARGET> | grep -c "CryptGenRandom"
vol3 -f memory.raw windows.memmap --pid <RANSOMWARE_PID> --dump
python3 << 'EOF'
import re
data = open("pid.<PID>.dmp", "rb").read()
candidates = []
for i in range(len(data) - 32):
block = data[i:i+32]
unique = len(set(block))
if unique > 28:
candidates.append((i, block.hex()))
print(f"Found {len(candidates)} candidates")
for off, h in candidates[:20]:
print(f" 0x{off:08x}: {h}")
EOF
python3 << 'EOF'
orig = open("original.docx", "rb").read()
enc = open("original.docx.encrypted", "rb").read()
keystream = bytes(a ^ b for a, b in zip(orig, enc))
print("First 64 bytes of keystream:", keystream[:64].hex())
EOF
4. Recovery Inhibition Analysis
strings <TARGET> | grep -iE 'vssadmin\s+delete\|shadows\s*/all'
strings <TARGET> | grep -iE 'wmic\s+shadowcopy\s+delete'
strings <TARGET> | grep -iE 'Get-WmiObject.*ShadowCopy.*Delete'
strings <TARGET> | grep -iE 'bcdedit.*recoveryenabled.*no'
strings <TARGET> | grep -iE 'bcdedit.*bootstatuspolicy.*ignoreallfailures'
strings <TARGET> | grep -iE 'wbadmin\s+delete\s+catalog'
strings <TARGET> | grep -iE 'delete\s+systemstatebackup'
strings <TARGET> | grep -iE 'net\s+stop\|sc\s+stop\|taskkill\|Stop-Service'
vssadmin list shadows
5. Ransom Note Parsing and IOC Extraction
python3 << 'EOF'
import re
with open("ransom_note.txt", "r", errors="ignore") as f:
note = f.read()
onions = re.findall(r'[a-z2-7]{16,56}\.onion', note)
print("Tor URLs:", onions)
btc = re.findall(r'\b[13][a-km-zA-HJ-NP-Z1-9]{25,34}\b', note)
btc += re.findall(r'\bbc1[a-zA-HJ-NP-Z0-9]{25,90}\b', note)
print("BTC addresses:", btc)
xmr = re.findall(r'\b4[0-9AB][1-9A-HJ-NP-Za-km-z]{93}\b', note)
print("XMR addresses:", xmr)
emails = re.findall(r'[\w.+-]+@[\w-]+\.[\w.]+', note)
print("Emails:", emails)
victim_ids = re.findall(r'(?:ID|key|token|code)\s*[:=]\s*([A-Za-z0-9+/=\-]{16,})', note, re.I)
print("Victim IDs:", victim_ids)
EOF
6. Binary-Level Behavioral Analysis
strings <TARGET> | grep -iE '\.doc\|\.xls\|\.pdf\|\.jpg\|\.png\|\.sql\|\.mdb\|\.zip'
strings <TARGET> | grep -iE 'windows\|system32\|boot\|ntldr\|bootmgr\|\.exe\|\.dll\|\.sys'
strings <TARGET> | grep -iE 'NetShareEnum\|WNetOpenEnum\|GetAdaptersInfo\|IcmpSendEcho'
strings <TARGET> | grep -iE 'taskkill.*sql\|taskkill.*oracle\|taskkill.*backup'
strings <TARGET> | grep -iE 'SeDebugPrivilege\|AdjustTokenPrivileges\|runas\|ShellExecute.*admin'
strings <TARGET> | grep -iE 'IsDebuggerPresent\|CheckRemoteDebugger\|GetSystemDefaultLangID\|GetKeyboardLayout'
Tools & Resources
| Tool | Purpose | Install |
|---|
| ID Ransomware | Family identification from note/sample | id-ransomware.malwarehunterteam.com |
| CyberChef | Crypto analysis, encoding/decoding | gchq.github.io/CyberChef |
| Emsisoft Decryptors | Free decryption tools | emsisoft.com/ransomware-decryption |
| NoMoreRansom | Decryptor repository | nomoreransom.org |
| ransomwhe.re | Ransomware payment tracking | ransomwhe.re |
| Volatility 3 | Memory forensics for key recovery | github.com/volatilityfoundation/volatility3 |
| YARA | Ransomware family signatures | github.com/Yara-Rules/rules |
| vssadmin | Shadow copy management | Built into Windows |
| Raccine | Ransomware vaccine (VSS protection) | github.com/Neo23x0/Raccine |
Detection Signatures
| Indicator | Description | Detection |
|---|
| Mass file rename with new extension | Bulk encryption in progress | Sysmon File Create (Event 11) burst |
vssadmin delete shadows /all /quiet | Shadow copy deletion | Sysmon Event ID 1 + command line |
bcdedit /set recoveryenabled no | Recovery disabling | Sysmon Event ID 1 |
| Ransom note dropped in every directory | Encryption complete signal | File create events for README.txt, DECRYPT.txt |
| High-entropy file writes | Active encryption | I/O monitoring: write entropy > 7.9 |
| Services stopped in rapid succession | Pre-encryption service kill | Windows Event Log 7036 burst |
| Network share enumeration | Lateral movement / spread | NetShareEnum API calls, SMB traffic |
| Mutex creation with known names | Family identification | Sysmon Event ID 17 |
Error Handling & Edge Cases
| Issue | Resolution |
|---|
| Ransomware sample won't run (anti-VM) | Patch anti-analysis checks; use bare-metal analysis host |
| No ransom note found | Check alternate locations: Desktop, every drive root, C:\Users\Public |
| Encrypted file has zero additional bytes | Header-only encryption — may be partially recoverable |
| Wiper disguised as ransomware | Check if decryption key actually exists; analyze if key is generated but never saved |
| Double-encrypted (two families) | Decrypt in reverse order; identify families by extension stacking |
| Network-propagating variant | Isolate host immediately; analyze SMB/RDP lateral movement code |
| Key deleted from memory | Cold boot attack; check pagefile.sys, hiberfil.sys for key remnants |
Decision Gate
IF ransom note present:
→ Upload to ID Ransomware for family identification
→ Check NoMoreRansom / Emsisoft for free decryptor
→ Extract IOCs (onion URLs, BTC wallets, emails)
→ If decryptor exists → decrypt and recover
IF no decryptor available:
→ Analyze encryption implementation in binary
→ Check for crypto weaknesses (hardcoded key, weak PRNG, implementation bugs)
→ Attempt memory forensics for key material
→ Check for intact shadow copies / backup catalog
IF wiper suspected (no real key):
→ Document as destructive attack, not ransomware
→ Focus on IOC extraction and attribution
→ File recovery via disk carving (PhotoRec, foremost)