> For the complete documentation index, see [llms.txt](https://docs.hex-rays.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hex-rays.com/add-ons/malware/concepts/isolated-system-emulation.md). Agents can also search and read this documentation through its [MCP server](https://docs.hex-rays.com/~gitbook/mcp).

# Isolated System Emulation

When you find a code sequence that you do not understand, you can step through it to learn what it does. But debugging malware is risky, and to do it safely you usually must leave your analysis to set up a VM or a remote debugger.

Isolated system emulation removes this risk. Start an interactive emulation session with one click on the dedicated toolbar button (the "magic wand") on the Analysis toolbar. The sample runs in the [Speakeasy](https://docs.hex-rays.com/add-ons/malware/concepts/emulators/speakeasy.md) or [Sogen](https://docs.hex-rays.com/add-ons/malware/concepts/emulators/sogen.md) emulator, never on your system, so you cannot run malicious code by accident. The add-on sets up the debugger configuration for you.

Step, set breakpoints, and stop with IDA's debugger controls. A session is fast to start, so you can run a sequence again until you understand it. When you rename an item during emulation, IDA keeps the new name in the disassembly and pseudocode views.

![The toolbar button and its tooltip, with Sogen as the configured emulator](https://492083732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFP6ibt8r6WPBHTqekG9u%2Fuploads%2Fgit-blob-41bb36be59194691733ef48d20df131831f69cfa%2Femulation-toolbar-tooltip.png?alt=media)

## Isolation

The sample runs in the emulator, never on your system. It cannot change your files, run code on your host, or connect to your network.

This applies to:

* isolated system emulation with Speakeasy or Sogen
* the [Speakeasy sandbox run](https://docs.hex-rays.com/add-ons/malware/concepts/sandbox-integration.md)
* [automated unpacking](https://docs.hex-rays.com/add-ons/malware/concepts/automated-unpacking.md) with the `bochs`, `speakeasy`, or `sogen` backend

During interactive emulation with Speakeasy, the sample sees only the emulated file system of Speakeasy, which contains decoy files. It does not see the files on your system. In the guest, the sample is at `C:\Windows\system32\<file name>`. Files that the sample writes stay in the memory of the emulator. Each session starts a new Speakeasy process, so changes that the sample makes do not go into the next session.

During interactive emulation with Sogen, the sample sees the files of the [Sogen root](https://docs.hex-rays.com/add-ons/malware/concepts/emulators/sogen.md#sogen-root), which it cannot change, and a copy of its own folder. Each session gets its own copies of the user profiles and temporary directories, and the add-on deletes them when the session ends. Changes that the sample makes to files and the registry do not go into the next session.

The Speakeasy sandbox run gives the sample a copy of its own folder, so that the sample finds the DLLs and other files that it loads from there. The add-on copies the sample and the files next to it, up to 512 MiB, to a temporary directory, and deletes the copy after the run. The sample cannot get access to other folders on your system.

{% hint style="warning" %}
Some settings let the sample go outside the emulator. When you use them, the isolation does not apply:

* Sogen with `sogen_network` set to `live`: the sample uses the real network of your host.
* Automated unpacking with `default_debugger` set to `win32`, or with `default_remote` set to `true`: the sample runs on a real system.
  {% endhint %}

## Speakeasy

[Speakeasy](https://docs.hex-rays.com/add-ons/malware/concepts/emulators/speakeasy.md) models the Windows API in Python. It runs 32-bit and 64-bit Windows PE files. When the sample calls an API that Speakeasy does not model, the call returns 1 and the session continues.

Interactive emulation runs PE files only. For other file types, the toolbar button and the menu item are disabled.

For a DLL, Speakeasy runs the TLS callbacks and `DllMain`. It does not run the exports.

## Sogen

[Sogen](https://docs.hex-rays.com/add-ons/malware/concepts/emulators/sogen.md) emulates Windows at the syscall layer and runs the real Windows system DLLs, so the sample behaves very close to how it does on a real system. It runs 64-bit PE files, and 32-bit PE files through WOW64. Before you use Sogen for the first time, set up the [Sogen root](https://docs.hex-rays.com/add-ons/malware/concepts/emulators/sogen.md#sogen-root) with **Extensions → Malware Analysis → Emulation → Set up Sogen...**.

In the guest, the sample is at `C:\sample\<file name>`, and the other files of its folder are next to it. Sogen stops first in the Windows loader, before the entry point. When the add-on adds the entry point breakpoint, it continues to the entry point for you.

For when to use Speakeasy or Sogen, see [Choose an emulator](https://docs.hex-rays.com/add-ons/malware/concepts/emulators.md#choose-an-emulator). The unpacker can also use Bochs. For when to use each emulator to unpack, see [Emulators and real debuggers](https://docs.hex-rays.com/add-ons/malware/concepts/automated-unpacking.md#emulators-and-real-debuggers).

## Configuration

To change the settings, select **Extensions → Malware Analysis → Emulation → Configure emulator...**.

| Setting             | Default     | Description                                                                                                                                                                                                                                                                                                                      |
| ------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `backend`           | `speakeasy` | The emulator to use: `speakeasy` or `sogen`.                                                                                                                                                                                                                                                                                     |
| `speakeasy_timeout` | `0`         | The time in seconds of emulated execution, after which Speakeasy ends the session. The time when the debugger is paused does not count. `0` turns off the limit.                                                                                                                                                                 |
| `load_export_names` | `true`      | If `true`, when a module loads, the add-on reads its export table from the emulator memory and names each export, for example `kernel32_HeapFree`, as IDA's Windows debuggers do.                                                                                                                                                |
| `sogen_root`        | empty       | The path to a Sogen root. The directory must contain `filesys/c`. When empty, the add-on uses the root from **Set up Sogen...**.                                                                                                                                                                                                 |
| `sogen_analyzer`    | empty       | The path to the Sogen analyzer binary. When empty, the add-on uses the analyzer from the `ida-sogen-runtime` component.                                                                                                                                                                                                          |
| `sogen_network`     | `offline`   | The network of the sample in Sogen. With `offline`, the sample can connect only to other sockets in the emulator, and DNS lookups fail. With `live`, the sample uses the real network of your host, and the add-on logs a warning. Use `live` only when you want the sample to download its next stage or contact its C2 server. |

To start a session, select **Malware Analysis → Emulation → Start interactive emulation → with Speakeasy** or **with Sogen**, or click the toolbar button, which uses the `backend` setting. To stop a session, select **Debugger → Terminate process**. If the database has no breakpoints, the add-on adds a breakpoint at the entry point, and the session stops first at the entry point. TLS callbacks and DLL initializers run before this stop. To stop in a TLS callback, set a breakpoint there before you start the session.

{% hint style="info" %}
The toolbar button shows the configured emulator in its tooltip, and the first two letters of the emulator name on its icon, for example `So` for Sogen. To change the emulator, right-click the button and select another one. This changes the `backend` setting, but does not start a session.
{% endhint %}

![The right-click menu of the toolbar button](https://492083732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFP6ibt8r6WPBHTqekG9u%2Fuploads%2Fgit-blob-0548f809e46f337c95f31d69898f3cb158015cbd%2Femulation-backend-menu.png?alt=media)

To restart a session, stop it, and then click the toolbar button or select the menu item again. Do not use IDA's **Debugger** menu to start the process again: when a session ends, the add-on restores your debugger settings, so IDA does not start the emulator.

During a session, the add-on selects IDA's remote GDB debugger on `127.0.0.1` and a random free port. When the session ends, the add-on restores your debugger settings.

The IDC function `start_emulator()` starts a session with the configured backend. `start_emulator_with_backend("speakeasy")` or `start_emulator_with_backend("sogen")` starts a session with that backend.

If you have a question, an idea, or a problem, email <support@hex-rays.com>. The Malware Analysis team reads every message and replies quickly.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hex-rays.com/add-ons/malware/concepts/isolated-system-emulation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
