Skip to main content

Sandboxing - Isolating Untrusted Code Safely

About 2 min read

A sandbox is a security technique that runs a program in an isolated environment to prevent it from affecting the entire system. It is used to safely analyze suspicious files and programs, and even if malware executes, the sandbox limits its effect on systems outside it. This concept is also applied to the isolation of the browser processes that render pages and the permission management of mobile apps.

What to Do with the Time Spent Waiting for a Verdict

Analysis in a sandbox differs from a check that matches against known patterns: it actually runs the item and observes its behavior. By nature, some amount of time passes before a verdict is available, so when it is placed in the middle of a flow such as an email delivery path, how to handle that waiting time becomes a design choice. Holding delivery until the verdict arrives is the safer side, since a dangerous attachment never reaches the recipient, but it introduces delays in daily work, and the delay is skewed - the attachments that are harder to analyze are the ones that arrive latest. Delivering first and retracting afterwards avoids the delay, but it leaves room for the recipient to open the message before the verdict exists, and retraction does not undo what has already been opened. In addition, observation yields only the behavior that occurred while it was being observed, so a specimen that does nothing right after launch offers little material for a decision. Preparing an isolated environment therefore does not settle safety by itself; deciding where in the workflow that waiting time is absorbed is also part of the design.

The Concept of a Sandbox

Sandbox (isolated environment)
Run suspicious program
Monitor and log behavior
↕ Access restriction
Host OS, file system, network (protected targets)

How a Sandbox Works

A sandbox uses virtualization, container technology, or restrictions on operating system permissions to create an isolated execution environment. A program can access only the resources inside the sandbox, and its access to the file system and network is restricted. Analyzing malware behavior in a sandbox is also used to create detection signatures.

Concrete Usage Scenarios

One misconception is that "a sandbox is a tool used only by security professionals." In reality, the browsers we use every day (such as Chrome and Edge) also apply a sandbox to the processes that render pages, limiting the effect malicious websites can have on the system.

In corporate security teams, one approach is to automatically run email attachments in a sandbox and check for suspicious behavior (such as file encryption or communication with external servers) before delivering them. However, some malware has "sandbox evasion" techniques that detect the sandbox environment and change its behavior, so the sandbox is combined with defense in depth that does not rely on it alone.

Everyday Use

When opening a suspicious file, one option is to check it in a sandbox environment. Once the "Windows Sandbox" feature of Windows 10/11 is turned on, you can open files in an isolated environment (it is not available on the Home edition, and virtualization must be enabled on the machine).

Was this article helpful?

Related Terms