Sandboxes: How They Work and Where They Fail
Static analysis tells you what a file could do. To see what it does, analysts run it in a controlled environment and watch. Doing that by hand in the analysis lab takes an hour per sample; an automated sandbox does it in minutes: it reverts a VM, copies the sample in, runs it, records everything for a few minutes, and writes a report. Sandboxes process the bulk of samples in every security operations team. They also miss things in predictable ways, and knowing those ways is what separates a useful report from a misleading one.
How a sandbox run works
- Revert a guest VM (Windows or Linux) to a clean snapshot with typical software installed (Office, a browser, a PDF reader).
- Submit the sample with options: which program opens it, how long to run, whether to simulate a user (mouse moves, clicks on dialogs), network mode (none, simulated Internet like INetSim, or routed through a VPN).
- Monitor: an in-guest agent or a hypervisor-level monitor records processes, API calls, file and registry changes, network traffic (as a pcap), screenshots and memory dumps.
- Analyse: signatures (YARA on files and memory, behaviour rules mapped to ATT&CK) score the run.
- Report: a verdict and score, a process tree, dropped files with hashes, contacted hosts, and the evidence behind every signature.
Open-source options include CAPE (a maintained descendant of the Cuckoo sandbox, focused on payload and configuration extraction) and the original Cuckoo Sandbox, whose classic 2.x line is no longer maintained (CERT-EE has since published a rewrite, Cuckoo3). Commercial and online services (Joe Sandbox, ANY.RUN, Hybrid Analysis, VMRay, vendors' cloud sandboxes in mail gateways and EDR) work the same way. Online services come with the sharing caveat: submissions are often visible to other users.
A sandbox report, read critically
Here is a shortened report from a lab session: the benign lab sample labagent.exe (it reads a configuration, writes one file, sets one registry value and makes HTTP requests to a lab.test name) run in a CAPE-style sandbox with INetSim. Scope: the analysis VM 10.10.0.20 on the isolated lab network; the fake Internet is 10.10.0.53.
lab session: sandbox report (benign lab sample, isolated network, INetSim)
Target labagent.exe SHA-256 4e1f…c3a9 PE32+ executable (GUI) x86-64
Duration 180 s Network: INetSim (10.10.0.53) User simulation: on
Score 6.5 / 10
Process tree
explorer.exe (1204)
└─ labagent.exe (4512) "C:\Users\lab\Downloads\labagent.exe"
└─ cmd.exe (4630) /c whoami /all > "%TEMP%\w.txt"
Signatures
[3] Reads system information (hostname, OS version) T1082
[4] Writes a value under HKCU\...\CurrentVersion\Run T1547.001
[4] Decodes Base64 configuration in memory T1140
[5] Periodic HTTP requests to one host (6 requests, 60 s) T1071.001
[2] Creates a mutex: Global\LabAgent-Mutex-7f3a
Network
DNS update.beacon.lab.test A -> 10.10.0.53 (INetSim)
HTTP GET http://update.beacon.lab.test/api/v1/ping?id=lab-0001 UA "LabAgent/1.0" x6
Dropped files
C:\Users\Public\Libraries\labagent.dat 112 bytes SHA-256 9b0d…77e1How an analyst reads it:
- The score is a summary of signatures, not a verdict. A legitimate updater also reads the hostname, sets a Run value and polls a server. What makes it suspicious is the combination plus the context (an unsigned program from Downloads, a
whoami /allchild process, a configuration decoded in memory). - The network section is the easiest win: the domain, URL path and user agent are immediately searchable in proxy and DNS logs.
- What is missing matters: no second stage, no lateral movement. Either it has no such capability, or the 180 seconds and INetSim's default answers were not enough to trigger it.
Turning a report into data
Reports are also available as JSON, which is how teams feed them into their pipelines. The example summarises a synthetic report in that style: it orders signatures by severity, extracts network indicators, and lists the reasons the run might be incomplete.
report = {
"target": {"name": "labagent.exe", "type": "PE32+"},
"info": {"duration": 180, "network": "inetsim", "user_simulation": True},
"signatures": [
{"name": "system_info_discovery", "severity": 3, "ttp": "T1082"},
{"name": "persistence_run_key", "severity": 4, "ttp": "T1547.001"},
{"name": "decode_base64_config", "severity": 4, "ttp": "T1140"},
{"name": "periodic_http_beacon", "severity": 5, "ttp": "T1071.001"},
{"name": "mutex_created", "severity": 2, "ttp": None},
],
"network": {"dns": [{"request": "update.beacon.lab.test", "answer": "10.10.0.53"}],
"http": [{"uri": "/api/v1/ping?id=lab-0001", "host": "update.beacon.lab.test",
"user_agent": "LabAgent/1.0", "count": 6}]},
"behavior": {"sleep_calls_skipped_s": 0, "processes": 2, "anti_vm_checks": ["reads BIOS vendor string"]},
}
for s in sorted(report["signatures"], key=lambda s: -s["severity"]):
print(f"sev {s['severity']} {s['name']:<24} {s['ttp'] or '-'}")
iocs = sorted({d["request"] for d in report["network"]["dns"]} |
{h["host"] + h["uri"].split("?")[0] for h in report["network"]["http"]} |
{"UA:" + h["user_agent"] for h in report["network"]["http"]})
print("network IOCs:", iocs)
caveats = []
if report["info"]["duration"] < 300:
caveats.append("short run: delayed behaviour may be missed")
if report["info"]["network"] != "routed":
caveats.append("simulated Internet: real server responses (second stage) never arrived")
if report["behavior"]["anti_vm_checks"]:
caveats.append("sample checked its environment: " + "; ".join(report["behavior"]["anti_vm_checks"]))
print("caveats:")
for c in caveats:
print(" -", c)sev 5 periodic_http_beacon T1071.001
sev 4 persistence_run_key T1547.001
sev 4 decode_base64_config T1140
sev 3 system_info_discovery T1082
sev 2 mutex_created -
network IOCs: ['UA:LabAgent/1.0', 'update.beacon.lab.test', 'update.beacon.lab.test/api/v1/ping']
caveats:
- short run: delayed behaviour may be missed
- simulated Internet: real server responses (second stage) never arrived
- sample checked its environment: reads BIOS vendor string
The caveats are the part most reports bury. Writing them next to the findings keeps the conclusion honest: "no second stage observed in a 3-minute run with simulated Internet, and the sample checked its environment".
Where sandboxes fail
| Limit | Effect | What analysts do |
|---|---|---|
| Time | Samples that wait (minutes, hours, until a date) show nothing | Longer runs; look for long sleeps and timers in static analysis |
| Environment checks | Samples that look for VMs, sandbox tools, few files, no user activity stay quiet | Note the checks as findings (they are a strong malicious signal); use realistic guests |
| User interaction | Payloads behind "enable content", a second click, a password | User simulation, supply the password from the email |
| Missing dependencies | Wrong OS version, missing runtime, wrong architecture | Match the victim's environment |
| No real server | Second stages and commands from the operator never arrive | Accept the gap; analyse static configuration and later stages separately |
| Arguments and context | DLLs that need an export name, scripts that need a parent | Run with the right loader or arguments |
A quiet sandbox report proves very little. A noisy one proves capabilities, not intent.
How sandbox output is used for detection
- Indicators go to blocking and hunting (domains, URLs, hashes of dropped files, mutexes).
- Behaviour signatures become EDR and SIEM detections (a program from Downloads that sets a Run value and spawns
cmd.exe /c whoami). - Memory dumps from the run feed YARA scans for unpacked payloads that never touched the disk.
Pitfalls
- Trusting the verdict colour. Green means "nothing triggered in this run", not "safe".
- Uploading confidential documents to public sandboxes to "check the attachment".
- Forgetting the guest is generic. A sample aimed at one company's software stack may only act there.
Practice
1. A sandbox returns "clean" for a document from a phishing email. List three reasons it might still be malicious.
The payload needs a user action (enable content, a click, a password in the email body); the sample checked for a VM or sandbox and stayed quiet; it waits longer than the run or downloads its payload from a server that the simulated network couldn't provide.
2. Add a caveat to the code when user_simulation is false.
if not report["info"]["user_simulation"]: caveats.append("no user simulation: dialogs and clicks never happened").
3. Why is "the sample checked the BIOS vendor string" a useful finding even if nothing else happened?
Legitimate software rarely cares whether it runs in a VM; environment checks are a strong indicator of evasive intent, and they explain why the run was quiet.
Test yourself
What does a 'clean' sandbox verdict prove?
- The file is harmless
- Nothing suspicious happened in that run, in that environment, in that time
- The file is signed
- The file is a known good file
Why might a sample make no second-stage download in a sandbox with INetSim?
- INetSim blocks DNS
- The fake server returns generic content, not the real payload
- INetSim deletes files
- Sandboxes have no network stack
Which project is an actively maintained descendant of the Cuckoo sandbox?
- CAPE
- Volatility
- YARA
- Sigma
Which part of a sandbox report is usually the fastest to act on?
- The screenshot
- Network indicators such as domains, URLs and user agents
- The VM's CPU model
- The score