How to Reverse a Ransomware Sample Safely: Static Triage with capa, FLOSS and PEStudio in a FLARE-VM Lab

How to Reverse a Ransomware Sample Safely: Static Triage with capa, FLOSS and PEStudio in a FLARE-VM Lab

📋 Key Takeaways
  • 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…
  • FLARE-VM is Mandiant's (now part of Google Cloud) free Windows-based reverse engineering distribution.
  • Before any tool touches the binary, handle it correctly.
  • Open the sample in PEStudio first—nothing executes on load, which is why it anchors most triage workflows.
13 min read · 2,550 words
Educational & Ethical Use Only — This article is provided for educational and ethical cybersecurity research purposes only. The techniques described should only be used on systems you own or have explicit permission to test. Always follow responsible disclosure and the laws applicable to you. Mitigations are included so engineers can harden real systems.
Security

🔎 Last updated · Editorial policy · Report an error

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.

TL;DR: You can triage ransomware without running it — here’s how

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.

Lab setup: Building and isolating FLARE-VM

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:

  1. Create a Windows 10 x64 VM in VMware Workstation, VirtualBox or Hyper-V. Allocate at least 2 CPU cores, 4 GB RAM and an 80 GB disk—FLARE-VM’s installer is hungry.
  2. Install the OS, take a clean snapshot before installing FLARE-VM, then run the FLARE-VM installer from github.com/mandiant/flare-vm. It takes 30–60 minutes.
  3. After installation and patching, take another snapshot. This is your “golden” state—every analysis session starts here and ends with a revert.
  4. Disable shared folders, drag-and-drop and clipboard sharing in the hypervisor settings. Ransomware that escapes via a mounted share is not hypothetical—it’s documented in real incidents.
  5. Set the network adapter to host-only (or no network at all for pure static work). Verify isolation from inside the guest: ping nothing, confirm the adapter has no route to your production subnet, and confirm the host’s other VMs are unreachable.

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.

Safety first: Handling and hashing the sample

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:

  • Never remove the .zip extension on your host. Windows Explorer preview handlers and Outlook have historically executed payloads from renamed extensions. Extract only inside the VM, only from the archive, only after snapshotting.
  • Compute hashes immediately: MD5, SHA-1 and SHA-256 using PowerShell’s Get-FileHash or hashmyfiles. The SHA-256 is your canonical identifier.
  • Check the hashes before deep analysis. Search them on VirusTotal (virustotal.com) and MalwareBazaar (bazaar.abuse.ch). Someone may have already analyzed this sample—existing YARA hits, sandbox reports and tags save hours and may identify the family outright.
  • Check CISA advisories (cisa.gov/stopransomware) for matching indicators. StopRansomware aggregates federal advisories for LockBit, ALPHV/BlackCat, Royal and others, complete with MITRE ATT&CK mappings you can compare against your own capa output later.

Document the acquisition date, source, hash and archive password in your session notes. Every professional analysis report starts with this chain of custody.

First-pass recon with PEStudio

Open the sample in PEStudio first—nothing executes on load, which is why it anchors most triage workflows. Work through these panels in order:

  • Headers and general properties: Compile timestamp (note it—many builders fake it), subsystem, whether it’s a DLL or EXE, and overlay presence. A large overlay on a small PE often means an embedded config blob or second-stage payload.
  • Imports: This is your crypto clue. Look for 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.
  • Sections and entropy: PEStudio color-codes section entropy. Anything above ~7.0 on a code-named section (e.g., .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.
  • Flags and blacklists: PEStudio flags anomalies like mismatched section characteristics, TLS callbacks (which run before main—a common anti-analysis trick) and known-bad indicators from its bundled databases.
  • Strings preview: A quick look before FLOSS. If you already see readable ransom note text, the sample is likely unpacked and your job just got easier.

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.

Recovering hidden strings with FLOSS

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:

  • File extensions: .locked, .crypt, .lockbit, family-specific markers that appended to victim files.
  • Ransom note filenames and content: README.txt, RESTORE_FILES.txt, !!!-GET-YOUR-FILES-BACK-!!!.html.
  • Cryptocurrency wallets: BC1… (Bech32), 1…/3… (legacy Bitcoin), or Monero addresses (starting with 4 or 8).
  • C2 indicators: URLs, IP addresses, Tor v2/v3 onion strings (56-character base32 ending in d or onion).
  • Attacker contact: TOX IDs, email addresses, Negotiator/Telegram handles.
  • Anti-analysis strings: VM tool names (VBoxService, vmtoolsd), debugger artifacts, and sandbox DLLs like 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.

Mapping capabilities with capa

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 patterns
  • generate random encryption key — key material creation via CryptGenKey or BCryptGenerateKeyPair
  • delete 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.001
  • enumerate 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.

Identifying the encryption routine

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:

  1. Start in PEStudio’s imports panel. Filter for crypto APIs. CryptAcquireContext with PROV_RSA_AES, CryptDeriveKey, CryptEncrypt indicates CryptoAPI symmetric encryption; CryptImportKey with a large embedded blob often means an embedded RSA public key.
  2. Pull the matching capa hits. capa’s verbose output (-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.”
  3. Jump to those addresses in PEStudio’s disassembly view (or export to Ghidra/IDA for deeper work). You’re looking for the encryption loop: ReadFile → buffer → AES block operations → WriteFile, with the extension-append and note-drop logic nearby.
  4. Distinguish the layers. The asymmetric operation (RSA encryption of a small buffer—the session key) typically happens once per run or per file and calls into different functions than the bulk symmetric loop. Per-file RSA wrapping is the stronger ransomware design because it defeats naive key recovery; identifying which layer is which tells you whether a recovered key from incident response could actually decrypt anything.

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.

Extracting ransomware configuration data

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:

  • Overlay analysis: If PEStudio shows a large overlay, carve it out (CyberChef or a hex editor) and inspect. Many builder-generated samples append config at the end of the last section.
  • Stack strings from FLOSS: Ransom note text and contact info frequently surface fully reconstructed in FLOSS output even when the rest of the binary is obfuscated.
  • XOR/rolling-key decoding: Configs are commonly XOR-encoded with a fixed or derived key. Capa’s encode data using XOR hits point you at the decoder function; reimplement the loop in Python against the carved blob.
  • Known family parsers: Research communities publish config extractors for LockBit, BlackCat and Phobos lineages on MalwareBazaar and GitHub. Match your SHA-256 against prior research before writing your own parser.

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.

Turning findings into detections

Triage output becomes operational value when you convert it into signatures:

  • YARA rules: Combine distinctive stack strings (FLOSS), unique byte sequences from the config blob, and behavioral constants (AES S-box usage patterns, the builder’s crypto constants) into a YARA rule. Test it against your sample and a corpus of benign binaries to tune specificity. Mandiant publishes exemplar rules in the capa repository worth studying.
  • SIGMA hunting hypotheses: capa’s ATT&CK mapping translates directly into detection logic. “Delete volume shadow copies via vssadmin” plus “high volume of file rename events with a novel extension” is a Sigma-ready behavioral chain, not just an IOC list.
  • Config-based IOCs: C2 URLs, wallet addresses and Tor endpoints go to your threat intel platform immediately—configs change per campaign, which is exactly why extracting them yourself beats trusting stale feeds.

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.

Common pitfalls and when static analysis isn’t enough

Static triage has hard limits. Know them before they cost you a day:

  • Packed samples: High entropy, minimal imports, capa returning “results limited.” Your options: identify the packer (PEiD-style signatures, PEStudio packer detection, diec from Detect It Easy), unpack in a debugger (x64dbg), or escalate to controlled detonation. Never brute-force it statically.
  • Shellcode loaders: Position-independent shellcode with no PE header can’t be analyzed with PE tools. Load it in a shellcode emulator or extract and analyze with capa’s shellcode mode (capa shellcode.bin -f sc32).
  • Mirror-loaded / in-memory-only binaries: Reflective loaders map PEs without the loader, breaking import resolution. Tools like pe-sieve and hollows_hunter recover the in-memory image—but that requires dynamic execution.
  • Time-based and environment-keyed logic: Some families derive keys from machine-specific data; static analysis shows the mechanism but not the values.

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.

Practice safely: Sample sources and next steps

You can’t build this skill without samples, and there are legitimate sources:

  • MalwareBazaar (bazaar.abuse.ch) — abuse.ch’s sample exchange with tag-based search; ransomware samples ship as password-protected archives for research use.
  • Malware-Traffic-Analysis.net (malware-traffic-analysis.net) — PCAPs plus samples from real incidents with exercises; ideal for pairing static triage with network behavior.
  • CTF archives: Flare-On (Mandiant’s annual reverse engineering CTF) challenges are purpose-built training material—harder than field triage, which is the point.
  • MITRE ATT&CK evaluations (attackevals.mitre.org) and academic dataset releases for reproducible test corpora.

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.

Frequently Asked Questions

Is it safe to analyze ransomware in a VM?

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.

What is the difference between capa and FLOSS?

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.

Do I need a license for PEStudio?

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.

What if capa returns no results on my sample?

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.

Where can I legally get ransomware samples to practice on?

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.

HMMNM Security
Published by HMMNM Security

Hands-on cybersecurity tutorials, CVE breakdowns, and guided learning paths — written and lab-tested by the HMMNM Security team.

Keep going — the structured way
This post is one step. The learning paths chain the next ones for you, with progress tracking and no account needed.
Follow a learning path →

Prabhu Kalyan Samal

Application Security Consultant and founder of Hmmnm. Certified Red Team Operator, Burp Suite Certified Practitioner, eWPTX, CompTIA SecurityX and Azure Security Engineer. Writes hands-on labs and threat analysis on web, cloud and AI-agent security.