Skip to content

Lesson 1 of 12 · 22m

The Lab: Detonating Without Burning Down the House

Lab safety is about containing signal as much as code: host-only networks, INetSim's fake internet, snapshots, and the sample-handling habits that keep you off the incident timeline.

Years ago a new analyst on my team detonated an invoice-themed loader on a VM with bridged networking. Nothing got infected — the VM did its job. But the loader beaconed out through our corporate NAT, the operator saw a callback from a security vendor's address block, and within the hour the C2 we'd been quietly tracking for two weeks went dark. The damage wasn't code. It was intelligence. A lab contains signal, not just malware.

The wrong mental model

People think lab safety means "the malware can't reach my host." That is the rarest of the three failures and the easiest to prevent. Here is what actually goes wrong, in order of how often I've watched it happen:

  1. Leakage — the sample reaches the real internet from an IP that identifies you. The operator learns they've been caught; worse, a spambot or skimmer module does real harm from your address space and you get to explain that to legal.
  2. Contamination — you run sample B on a VM still dirty from sample A, attribute A's persistence to B, and publish a report that is quietly wrong.
  3. Escape — code reaches the host or LAN. Hypervisor escapes are expensive exploits, not commodity loader features. Your actual escape paths are shared folders, the shared clipboard, drag-and-drop, and you double-clicking things on the host "just to check."

The reference layout

host  (no shared folders, no clipboard, no drag-and-drop)
 └─ host-only net 10.0.0.0/24  — no route to the LAN or internet
     ├─ win10-analysis  10.0.0.20   FLARE-VM tooling, snapshot "clean-baseline"
     └─ remnux          10.0.0.1    INetSim + Wireshark; gateway AND DNS for the victim
VBoxManage modifyvm "win10-analysis" --nic1 hostonly --hostonlyadapter1 vboxnet0
VBoxManage modifyvm "win10-analysis" --clipboard-mode=disabled --drag-and-drop=disabled
VBoxManage snapshot "win10-analysis" take "clean-baseline" --description "FLARE-VM, tools, no samples"

The REMnux box is the entire internet. INetSim answers every DNS query with itself, serves canned HTTP/HTTPS, accepts SMTP, and logs all of it:

# /etc/inetsim/inetsim.conf
start_service dns
start_service http
start_service https
start_service smtp
service_bind_address  10.0.0.1
dns_default_ip        10.0.0.1

Consequence you must hold in your head for every later lesson: in this lab, every resolved IP is your sinkhole. Domains in a capture are real. Addresses are not.

Handling samples like they're loaded

sha256sum invoice_0412.exe | tee -a case-2291/hashes.txt
mv invoice_0412.exe 7f3a9c41e2b8d05f6a1c9e7d3b42f08a6e5d1c3b9a7f2e4d8c6b0a1f3e5d7c9b.bin
7z a -tzip -pinfected case-2291-samples.zip *.bin   # "infected" is the industry convention

Rename to the hash with a dead extension so nothing executes on a stray double-click, and store samples in a infected-password zip — AV and email gateways eat loose samples, and the password is the convention everyone on an IR team already knows. Defang every URL you paste into tickets or chat (hxxps://cdn-telemetry-update[.]top) — chat clients unfurl links, which means fetching them from your corporate IP. That's leakage without a VM at all.

When you genuinely need live internet

Some second stages only get served to "real" victims — the C2 checks user agent, ASN, or referer. Going live is a decision, not a toggle: separate egress (a throwaway cloud box or a commercial VPN, never corporate), sign-off from the IR lead, a time box, and a note in the case log. Assume the operator sees you, because the anecdote at the top is not hypothetical.

Field notes

  • Revert to clean-baseline after every detonation. "I'll just try one more thing" is how run two inherits run one's registry keys.
  • Turn off Defender's automatic sample submission in the analysis VM — otherwise it quietly uploads your targeted sample before you've decided whether sharing it is acceptable.
  • VirtualBox's DMI strings announce themselves (HKLM\HARDWARE\ACPI\DSDT\VBOX__). Expect samples to check; expect to explain it in your report.
  • Keep a timestamped analysis log. IR will ask "when did you first execute it?" and the answer goes into the incident timeline.
  • The host is not your lab. Never refang a URL on the host to "just check something."

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.