# Migrate

The `Migrate` command is a crucial feature in Amnesiac, designed for process migration after successful exploitation. It may serve different purposes:

1. **Avoiding** [**SessionID 0**](/amnesiac/beware/sessionid-0.md)**:** By migrating to another process, Amnesiac can avoid running within a [SessionID 0](/amnesiac/beware/sessionid-0.md) process, which is often restricted and lacks certain privileges.
2. **Executing Local Actions:** Migrating to a suitable process, such as "explorer," allows Amnesiac to execute [Local Actions](/amnesiac/sessions/local-actions.md) commands effectively. These commands may require execution from specific process IDs that have the necessary rights and access to users' activity.
3. **Impersonating Other Users' Sessions:** The migration process also enables Amnesiac to impersonate other users' sessions on the system, allowing for lateral movement.

The `Migrate` command injects an Amnesiac payload into a specified target process ID. The payload initiates a new child process, which inherits all properties and rights of the parent process.

Once the migration process is complete, a new session is obtained within Amnesiac. Users can interact with this session, allowing them to perform various actions within the target environment.

It's worth noting that the payload is encrypted before injection into the target process.

The process injection action itself is performed using the [PInject](/amnesiac/sessions/scripts-loading/pinject.md) module, and Amnesiac automates this action to facilitate process migration.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://leo4j.gitbook.io/amnesiac/sessions/local-actions/migrate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
