# Process Hollowing

## Hollow with Shellcode

* <https://github.com/chvancooten/OSEP-Code-Snippets/blob/main/Shellcode%20Process%20Hollowing/Program.cs>
* <https://github.com/S3cur3Th1sSh1t/Creds/blob/master/Csharp/DinvokeProcessHollow.cs>

1\. Create the target process (e. g., `svchost.exe`) in a suspended state.

![](/files/-Mefs9YRV8KZ-_xztvMw)

2\. Query created process to extract its base address pointer from PEB (**P**rocess **E**nvironment **B**lock).

![](/files/-Mefs9YSkPsyiRA7g6HA)

3\. Read 8 bytes of memory (for 64-bit architecture) pointed by the image base address *pointer* in order to get the actual value of the image base address.

![](/files/-Mefs9YTHKKU0oxSs1d7)

4\. Read 0x200 bytes of the loaded EXE image and parse PE structure to get the EntryPoint address.

![](/files/-Mefs9YU4u_4A6tC53oK)

5\. Write the shellcode to the EntryPoint address and resume thread execution.

![](/files/-Mefs9YVwGGUDlQjwgzf)

## Hollow with EXE

* <https://github.com/m0n0ph1/Process-Hollowing>
* <https://gist.github.com/gnh1201/6a3836468c898f7ad3a3656e6f24dce3>
* <https://www.ired.team/offensive-security/code-injection-process-injection/process-hollowing-and-pe-image-relocations>


---

# 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://ppn.snovvcra.sh/red-team/dev/code-injection/process-hollowing.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.
