
Security
https://hmmnm.com/how-to-reverse-a-ransomware-sample-safely-static-triage-with-capa-floss-and-pestudio-in-a-flare-vm-lab/
Yes—you can analyze ransomware without executing it. Static triage in an isolated FLARE-VM lab using capa, FLOSS and PEStudio reveals capabilities, obfuscated strings and the encryption routine with zero detonation risk, provided you verify isolation before the sample ever touches disk.
Static analysis answers the questions that matter most in the first hour of incident response: what does this binary do, how does it encrypt, and what indicators can you push to detection engineering today? capa maps behaviors, FLOSS recovers strings that packers try to hide, and PEStudio exposes the PE structure, imports and entropy that tell you whether you’re looking at a vanilla loader or a heavily armored sample. None of it requires you to click “Run.” The Mandiant FLARE team built FLARE-VM precisely for this workflow—and if you follow the isolation discipline below, your host and your production network stay out of harm’s way.
FLARE-VM is Mandiant’s (now part of Google Cloud) free Windows-based reverse engineering distribution. It installs a curated toolset—PEStudio community edition, FLOSS, capa, x64dbg, IDA Free or Ghidra if you add them, plus dozens of utilities—onto a Windows 10 virtual machine. It is the de facto standard lab for malware analysts, and CISA’s own malware analysis reports assume exactly this kind of environment.
Build it like this:
Static triage needs no internet access. Resist the temptation to leave the VM networked “just in case”—you can copy results out via a transient shared folder that you re-disable immediately afterward, or use a snapshot-revert workflow where nothing you care about lives inside the guest.
Before any tool touches the binary, handle it correctly. Ransomware samples are distributed as password-protected ZIP archives—typically password infected—precisely so antivirus on the download path doesn’t detonate or quarantine them. Keep it that way until the file is inside the isolated VM.
Follow this discipline every single time:
Get-FileHash or hashmyfiles. The SHA-256 is your canonical identifier.Document the acquisition date, source, hash and archive password in your session notes. Every professional analysis report starts with this chain of custody.
Open the sample in PEStudio first—nothing executes on load, which is why it anchors most triage workflows. Work through these panels in order:
CryptAcquireContext, CryptGenKey, CryptEncrypt from advapi32, or BCrypt/NCrypt equivalents (BCryptOpenAlgorithmProvider, BCryptEncrypt). Add VirtualAlloc with WriteProcessMemory or CreateRemoteThread and you’re looking at process injection on top of encryption..text) screams packing or encryption. A single high-entropy section followed by tiny imports—a handful of LoadLibrary/GetProcAddress calls—is the classic packer signature.main—a common anti-analysis trick) and known-bad indicators from its bundled databases.If entropy is uniformly high and imports are skeletal, note it: capa will likely underperform on the packed payload, and you’ll need to interpret results accordingly.
Plain strings only sees statically declared text. Modern ransomware families—Conti, LockBit derivatives, BlackCat—build strings on the stack character by character at runtime, invisible to naive extraction. FLOSS (FireEye Labs Obfuscated String Solver), from the same Mandiant team, emulates the binary with the SLEIGH-based engine underlying Ghidra and deobfuscates these stack strings automatically.
Run it from a command prompt:
floss.exe sample.exe --only stack tight functions > floss_output.txt
Then grep the output for the ransomware telltales:
.locked, .crypt, .lockbit, family-specific markers that appended to victim files.README.txt, RESTORE_FILES.txt, !!!-GET-YOUR-FILES-BACK-!!!.html.d or onion).sbiedll.dll.Every one of these is an IOC candidate. Log them with context—which FLOSS output section they came from—because stack strings recovered via emulation carry more analytical weight than coincidental byte sequences.
capa is Mandiant’s capability enumeration engine. It matches behaviors—API call patterns, constants, instruction sequences—against hundreds of community rules and reports what the binary does, expressed in MITRE ATT&CK technique language. This is how capa identifies ransomware capabilities: it recognizes the API sequences and cryptographic constants that constitute behaviors like file encryption, key generation and persistence, then maps each to ATT&CK techniques such as T1486 (Data Encrypted for Impact) and T1490 (Inhibit System Recovery).
Run it:
capa.exe sample.exe -v > capa_report.txt
For ransomware, expect rule hits like:
encrypt data using AES / encrypt data using RSA via CryptoAPI or BCrypt patternsgenerate random encryption key — key material creation via CryptGenKey or BCryptGenerateKeyPairdelete volume shadow copies — vssadmin delete shadows or COM-based VSS destruction (T1490)check for debugger / check for sandbox — anti-analysis (T1497)persist via registry run key — T1547.001enumerate files / get common file extension — the file-discovery half of the encryption loop (T1083)Two interpretation notes. First, capa reports mitigations when confidence is low—if it says results are limited because the binary is packed, trust it and cross-check entropy in PEStudio. Second, capa’s rule database is extensible; the ransomware-specific rules from Mandiant’s public repository frequently catch family-specific builder quirks that generic rules miss. The project lives at github.com/mandiant/capa.
This is where the three tools converge. Ransomware almost universally uses hybrid encryption: a symmetric cipher (AES, ChaCha20, sometimes legacy RC4/RSA-only in older families) encrypts file contents, while an asymmetric key (RSA, ECC/ECIES) encrypts the symmetric key itself—so only the attacker’s private key can restore anything.
Cross-reference to find the routine:
CryptAcquireContext with PROV_RSA_AES, CryptDeriveKey, CryptEncrypt indicates CryptoAPI symmetric encryption; CryptImportKey with a large embedded blob often means an embedded RSA public key.-v or -vv) gives you the addresses where each rule matched. Note the function addresses for “encrypt data using AES” and “generate random encryption key.”ReadFile → buffer → AES block operations → WriteFile, with the extension-append and note-drop logic nearby.Look for known AES tables or S-box constants in PEStudio’s strings/bytes view—capa flags these too—and for hardcoded RSA public key blobs (large runs of high-entropy data near crypto imports). That embedded public key is often your config extraction entry point.
Most modern families carry an embedded configuration blob written by the affilate-facing builder: extension lists, note text, C2 URLs, payment amounts, victim ID formats, termination deadlines. Extracting it statically is high-value because the config is both an IOC goldmine and the input for detection signatures.
Practical approaches:
encode data using XOR hits point you at the decoder function; reimplement the loop in Python against the carved blob.Document every extracted element—extension list, wallet addresses, C2 endpoints, note text—with the offset or function address it came from. Detection engineering needs provenance, not just values.
Triage output becomes operational value when you convert it into signatures:
vssadmin” plus “high volume of file rename events with a novel extension” is a Sigma-ready behavioral chain, not just an IOC list.Validate everything against the capa report before publishing. If your YARA rule fires on strings capa can’t correlate to a real behavior, you may have built a false-positive machine.
Static triage has hard limits. Know them before they cost you a day:
diec from Detect It Easy), unpack in a debugger (x64dbg), or escalate to controlled detonation. Never brute-force it statically.capa shellcode.bin -f sc32).pe-sieve and hollows_hunter recover the in-memory image—but that requires dynamic execution.When you hit these walls, graduate to controlled dynamic analysis in the same VM: revert to the golden snapshot, re-enable host-only networking, use a monitoring stack (Procmon, API Monitor, Wireshark on the host-only interface) and detonate deliberately, not accidentally. Snapshot discipline is what makes this safe—every dynamic session is disposable.
You can’t build this skill without samples, and there are legitimate sources:
Close every session the same way: document hashes, findings, tool versions and rule outputs in your notes; export your YARA/SIGMA artifacts out of the VM; then revert to the golden snapshot. A lab that stays clean is a lab you can trust the next time a sample lands—because with ransomware, it’s never a question of if.
Yes—if properly isolated. Use host-only networking, disable shared folders and clipboard sharing, take clean snapshots, and keep the sample password-protected until it’s inside the guest. If you only perform static analysis, detonation risk is minimal; the real danger comes from dynamic execution in a misconfigured VM, which is why snapshot discipline is non-negotiable.
FLOSS deobfuscates and extracts strings, including stack strings that packers and ransomware build at runtime. capa matches binary behaviors against a community ruleset to report capabilities—file encryption, persistence, anti-analysis—mapped to MITRE ATT&CK techniques. They complement each other: FLOSS recovers the text, capa identifies the behavior.
No. The free version covers most triage needs: headers, imports, sections, entropy, flags and basic disassembly. The paid version adds advanced features like variant hunting, extended blacklists and deeper analysis—useful for full-time malware analysts, unnecessary for triage.
The sample is most likely packed or obfuscated. Check entropy and import sparseness in PEStudio to confirm, identify the packer with Detect It Easy, consider unpacking in x64dbg first, or run capa against the unpacked payload. You can also rerun capa with the vulnerability and anti-analysis rule scopes enabled, which sometimes surface matches even on armored binaries.
MalwareBazaar, the Malware-Traffic-Analysis.net exercise files, and CTF archives like Flare-On provide samples for research use. Always handle them in an isolated lab—host-only networking, snapshots, no shared folders—and respect each source’s usage terms.