Skip to content

Lesson 4 of 12 · 22m

Sandboxes: Useful Liars

What a sandbox verdict really means, when uploading a sample is a leak, how to make samples actually detonate, and the evasion tricks that produce clean reports for dirty files.

A sandbox report is a witness statement, not a verdict. "No malicious activity observed" means nothing we recognized happened in the 120 seconds we watched, in this VM, with this configuration. I once signed off on a loader that came back clean from two sandboxes. It slept for ten minutes in a loop of short NtDelayExecution calls — too fragmented for the sandbox's sleep-skipping to collapse into one. EDR caught it on 40 hosts the next morning. Static triage had shown the VM checks; I trusted a green badge over my own notes. Don't repeat that.

The wrong mental model: clean means benign

A clean report proves exactly one thing: in that environment, that sample didn't trigger a signature. The failure modes are asymmetric — a false negative is invisible (nothing happened to see), while a false positive at least leaves evidence. Commodity loaders are built around this: they check for analysis conditions first and ExitProcess cleanly if they find them. To the sandbox, that graceful exit looks identical to a benign file doing nothing. The correct classification for "clean + suspicious static" is inconclusive, and the word belongs in your report.

Public vs private: uploading is publishing

Uploading to VirusTotal or a public sandbox shares the file with every subscriber — and actors watch those services for their own hashes. Targeted samples routinely contain the victim's email address, internal hostnames, or a phishing kit with stolen credentials baked in. The rule:

  1. Hash lookup first. Already public? You've lost nothing.
  2. Unknown and targeted? Private sandbox only — self-hosted CAPE, or a commercial sandbox in private mode (Any.Run and Triage both offer it).
  3. Public upload only with the IR lead's sign-off, after the client knows it's happening.

Getting it to actually run

Half of "clean" reports are samples that never executed in the first place:

  • DLLs: DllMain often does nothing interesting. List the exports, then call the one that matters — DllRegisterServer and ServiceMain are the classics.
  • Scripts: .js/.vbs run under wscript.exe; .hta under mshta.exe.
  • Documents: macros need Office installed and the Enable Content click the lure asked for.
  • Containers: ISO/IMG/ZIP deliveries hide an .lnk that launches the real payload — detonate the shortcut, not the container.
# CAPE: run a DLL's export with a longer timeout
python3 utils/submit.py --package dll --options "function=DllRegisterServer" --timeout 300 9e1c4f.dll
C:\> rundll32.exe C:\Users\Public\9e1c4f.dll,DllRegisterServer

The evasion checklist

What commodity loaders check before doing anything interesting:

if (GetTickCount64() < 10 * 60 * 1000) ExitProcess(0);  // uptime < 10 min: fresh sandbox VM
if (si.dwNumberOfProcessors < 2)       ExitProcess(0);  // 1 vCPU: cheap analysis VM
if (ms.ullTotalPhys < (4ULL << 30))    ExitProcess(0);  // < 4 GB RAM
if (mac_prefix_is(0x08, 0x00, 0x27))   ExitProcess(0);  // VirtualBox OUI
if (recent_docs_count() < 10)          ExitProcess(0);  // nobody actually uses this machine
if (keyboard_layout_is_cis())          ExitProcess(0);  // geofence: don't detonate at home

Countermeasures: realistic VMs (4 vCPUs, 8 GB RAM, a lived-in profile with browser history, recent documents, and uptime), changed MAC prefixes and SMBIOS strings, human-interaction emulation, longer timeouts, and running the same sample under two or three configurations. Sandboxes fight back with sleep-skipping and API-hammering — which is why fragmented sleeps like my ten-minute loader still work.

Reading the report in the right order

Process tree → dropped files → network (DNS names, HTTP paths) → memory dumps and extracted configs → then signatures. Signatures are heuristics; "queries computer name" fires on every installer ever built. The tree and the drops are what happened.

Field notes

  • Record the environment in your report — OS build, timeout, network mode. IR needs to know whether "no C2 seen" means "no C2" or "INetSim answered."
  • Behind INetSim, every resolved IP is the sinkhole. Never paste sandbox-resolved IPs into an IOC list.
  • If the sample checks for a debugger or VM, that check is itself a reportable behavior — it tells you the family cares about your existence.
  • Same sample, two configs, different behavior: that delta is often more informative than either run alone.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.