1 Introduction
A sandbox is an isolated, instrumented machine (almost always a virtual machine) in which you deliberately run a suspicious file and record everything it does: processes started, files written, registry keys changed, network connections. When the run ends, the machine is reverted to a clean snapshot.
This is dynamic analysis: observing behaviour at runtime. It complements static analysis, which examines the file without executing it. For a SOC or CTI analyst, a sandbox is the fastest way to answer "what does this attachment do, and which IOCs can I hunt for?" in minutes, without being a reverse engineer.
| Static analysis | Dynamic analysis | |
|---|---|---|
| Principle | Inspect the file at rest | Run it and observe |
| Typical output | hashes, file type, strings, PE imports and sections, macros, signature, entropy | Process tree, file/registry changes, DNS/HTTP traffic, API calls, memory dumps |
| Tools | file, strings/FLOSS, Detect It Easy, pefile, olevba (oletools), capa, YARA | CAPE, ANY.RUN, Joe Sandbox, Hybrid Analysis, or a manual lab with Procmon and Wireshark |
| Strength | Safe; sees all code paths, even those that never run | Defeats packing and obfuscation: the code has to unpack itself to run |
| Weakness | Blind to packed or encrypted payloads | Only sees the path taken during this run; can be evaded |
The right order is: hash lookup first (has this file already been analysed?), then quick static triage, then sandbox. If you are not sure how to read the verdicts, see Reading a file analysis report.
2 What's Recorded
A sandbox hooks the operating system (API monitoring, a kernel driver, or introspection from the hypervisor) and captures the network traffic leaving the VM. A typical run lasts 2 to 5 minutes and produces:
Process tree
Every process created, with parent, PID, full command line and integrity level. Usually the most informative part of a report.
File system activity
Files created, modified, deleted or renamed: payloads in %TEMP%, ransom notes, encrypted files, scripts.
Registry changes
Keys and values written (persistence via Run keys, services, disabled security settings) and keys read (often environment checks).
Network
DNS queries, HTTP requests (URL, user agent), TLS SNI and JA3/JA4 fingerprints, contacted IPs, and a full PCAP that IDS rules can be run against.
API calls
Sequences such as VirtualAllocEx → WriteProcessMemory → CreateRemoteThread (process injection) or CryptEncrypt in a loop over user files.
Dropped files
Copies of every file written during the run, with hashes: the next stages you will want to analyse and block too.
Memory dumps
Snapshots of process memory, where unpacked code, decrypted strings and malware configurations (C2 list, campaign ID, keys) appear in clear.
Signatures & screenshots
Behavioural rules that fired ("creates a Run key", "detects a VM"), YARA and IDS hits, often mapped to ATT&CK, plus screenshots of the desktop.
3 Reading a Report
Do not stop at the score. A score is an aggregate of signatures, some of them weak; your job is to reconstruct the story and extract what is actionable. Here are the key extracts from a run of a (fictional) Invoice_4471.docm:
PROCESS TREE
WINWORD.EXE (2148) "C:\Users\admin\Desktop\Invoice_4471.docm"
└─ powershell.exe (3312) -nop -w hidden -enc SQBFAFgAIAAoAE4AZQB3AC0ATwBi...
└─ rundll32.exe (4020) C:\Users\admin\AppData\Local\Temp\upd.dll,Start
NETWORK
DNS cdn-update.example A 203.0.113.45
HTTPS 203.0.113.45:443 SNI=cdn-update.example GET /s2/upd.dll (216 KB)
HTTPS 203.0.113.45:443 POST /api/v1/beacon every ~60 s
FILES
created C:\Users\admin\AppData\Local\Temp\upd.dll
SHA-256 fb18cd2a74c578b056a81a207cfe4b93d412c707c7f6751c0d4ea32219da4bf2
REGISTRY
set HKCU\Software\Microsoft\Windows\CurrentVersion\Run\OneDriveUpdate
= "rundll32.exe C:\Users\admin\AppData\Local\Temp\upd.dll,Start"
SIGNATURES
[high] Office application spawns a script interpreter
[high] PowerShell with encoded command line
[medium] Persistence via Run registry key
[medium] Queries keyboard layout (T1614.001)
[low] Checks for VirtualBox registry keys (T1497.001)
A reading method
Check the run conditions: OS version, Office version, duration, whether internet access was allowed. A document that needs Office and runs on a VM without it proves nothing.
Read the process tree from the top: here Word spawning PowerShell is already highly abnormal. Decode the base64 command (it is UTF-16LE) to see the download URL.
Follow the network: separate the malicious traffic (download, beacon) from background noise (Windows Update, certificate checks, telemetry). Regular POSTs every ~60 s are typical of C2 beaconing.
Look at persistence and dropped files: what survives a reboot, and which new files need their own analysis.
Challenge the signatures: "queries keyboard layout" is also done by legitimate software. Signatures are leads, not proof; the behaviour you saw in steps 2–4 is.
This run maps cleanly to ATT&CK: T1204.002, T1059.001, T1027.010, T1105, T1218.011, T1547.001, T1071.001. The full mapping method is in Understanding MITRE ATT&CK.
4 Evasion Techniques
Malware authors know their samples will end up in sandboxes, so many check their environment first and simply do nothing (or something harmless) if it looks like an analysis machine. ATT&CK tracks these behaviours mainly under T1497 Virtualization/Sandbox Evasion, T1622 Debugger Evasion and T1480 Execution Guardrails.
| Family | What the malware checks | ATT&CK |
|---|---|---|
| VM detection | VirtualBox/VMware drivers, services and registry keys (VBoxService.exe, vmtoolsd.exe), MAC prefixes (08:00:27 VirtualBox, 00:0C:29/00:50:56 VMware), the CPUID hypervisor bit, a disk under 60 GB, 1–2 CPUs, little RAM | T1497.001 |
| Debugger detection | IsDebuggerPresent, CheckRemoteDebuggerPresent, the PEB BeingDebugged flag, timing differences caused by breakpoints | T1622 |
| Sleep / timing | Sleeping 10+ minutes before acting (longer than the run), detecting that the sandbox "fast-forwarded" a sleep by comparing clocks, only triggering after a given date | T1497.003 |
| User interaction | Waiting for mouse movement or clicks, scrolling to page 2 of a document, number of recent documents, browser history, system uptime, a password-protected archive whose password is in the email | T1497.002 |
| Geofencing | Keyboard layout or system language (some families exit on Russian or other CIS layouts), public IP geolocation, time zone, Active Directory domain name of the target | T1614.001, T1480 |
| Server-side gating | The payload server only answers once per IP, only to target countries, or is already offline when you analyse the sample | — |
A "clean" verdict is not proof of innocence
"No malicious activity" only means "nothing malicious was observed during this run, in this environment". Treat an empty report as inconclusive when: the process tree is almost empty, the sample exits within seconds, it reads VM-related keys then stops, the network calls fail, or the file needs a specific argument, DLL export or parent process to run. Re-run with a longer duration, a different OS/locale, internet access through a VPN exit in the target country, or interactive mode, and combine with static analysis. Sandbox-evasion checks are themselves a strong malicious indicator.
5 Safe Handling
Never on your workstation
Never open, double-click or "just check" a sample on a production or personal machine. Use a dedicated sandbox or an isolated lab VM.
Transport samples in an encrypted archive
The convention is a ZIP or 7z protected with the password infected. It stops antivirus from deleting the sample and prevents anyone from opening it by accident. Add the SHA-256 in the ticket.
Control the network
A lab VM must not reach your internal network. Either simulate the internet (INetSim, FakeNet-NG) or route traffic through a dedicated VPN/Tor exit, never through your company's IP: the attacker sees who is analysing their payload.
Revert after every run
Restore the clean snapshot, disable shared folders, clipboard and drag-and-drop between host and VM, and keep the hypervisor up to date (VM escapes exist, even if rare).
Defang what you share
In tickets, chats and reports, write hxxps://cdn-update[.]example rather than a clickable link.
Think before uploading to a public service
On public sandboxes and free tiers, the file, its report and often its content become visible to everyone. A real invoice, a contract or an HR document attached to a phishing email may contain personal or confidential data. Attackers also watch these platforms to learn their sample has been spotted. Search the hash first; upload only if allowed by your policy and the data's sensitivity (respect TLP), or use a private/on-premise sandbox.
6 Tools & Services
A few widely used options, each with a different trade-off. Check each provider's current terms, as free offerings and visibility rules change.
CAPE (CAPEv2)
Open-source, self-hosted sandbox descended from Cuckoo. Its name stands for Config And Payload Extraction: it specialises in unpacking and extracting malware configurations. Private by design, but you operate it yourself.
ANY.RUN
Cloud sandbox where you interact with the VM live: click "Enable Content", type an archive password, browse to a phishing page. Very useful against user-interaction checks. Tasks on the free plan are public.
Joe Sandbox
Commercial sandbox (cloud or on-premise) known for very detailed reports across Windows, Linux, macOS and Android. A free cloud tier exists, with public results.
Hybrid Analysis
Free community service run by CrowdStrike on its Falcon Sandbox technology. Large searchable database of public reports, handy for checking whether a hash has already been analysed.
Searching a hash on these platforms reveals nothing about you. Submitting a file does. When in doubt, search first.
Try it on mlab.sh
Before submitting anything, look up the hash of a suspicious file, then enrich the domains and IPs found in the sandbox report.
Start analyzing on mlab.sh7 Building Detections
A sandbox report is raw material. Turn it into something that protects the whole fleet, from the most fragile to the most durable level of the Pyramid of Pain:
IOCs
Hashes of the sample and dropped files, payload URL, C2 domain and IP. Filter out noise first (Microsoft, certificate authorities, CDNs), then share them as STIX indicators with a validity period.
YARA
Strings seen in dropped files or memory dumps (unique paths, mutexes, config markers) become YARA rules that catch future variants, not just this hash.
Sigma
Behaviour from the process tree ("WINWORD.EXE spawns powershell.exe with -enc") becomes a Sigma rule for your SIEM or EDR logs.
Suricata / Snort
The PCAP shows the exact C2 URI, headers and TLS SNI: material for network rules.
For example, a first YARA rule built from this run:
rule LedgerLoader_Stage2_Training
{
meta:
description = "LedgerLoader second stage seen in sandbox run (training example)"
author = "mlab Academy"
date = "2026-10-21"
hash = "fb18cd2a74c578b056a81a207cfe4b93d412c707c7f6751c0d4ea32219da4bf2"
strings:
$persist = "OneDriveUpdate" ascii wide
$uri = "/api/v1/beacon" ascii
$stage = "/s2/upd.dll" ascii
condition:
uint16(0) == 0x5A4D and filesize < 500KB and 2 of them
}
Finally, map the observed behaviour to ATT&CK. Sandboxes do it automatically, but their mapping is generated from signatures and is often noisy or too broad: keep only the techniques you actually confirmed in the process tree, files, registry and network.
Related Modules
Reading a file analysis report
Deciphering sandbox and antivirus reports: understanding verdicts and key indicators.
Recognizing a malicious file
Warning signs to look for before opening a suspicious file.
Writing YARA rules
Learn to write YARA rules that detect whole malware families: strings, conditions, modules, testing with yara/YARA-X and performance tips.
Source: mlab Academy — Cybersecurity Awareness Platform
URL: https://academy.mlab.sh//page/sandbox-analysis
Module: Dynamic analysis in a sandbox — Detection Engineering
Disclaimer: This content is for awareness purposes only.