AD ์ธ์ฆ์
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
์๊ฐ
์ธ์ฆ์ ๊ตฌ์ฑ ์์
- ์ธ์ฆ์์ Subject๋ ์์ ์๋ฅผ ๋ํ๋ ๋๋ค.
- Public Key๋ ๊ฐ์ธ ํค์ ์์ ์ด๋ฃจ์ด ์ธ์ฆ์๋ฅผ ์ ๋นํ ์์ ์์ ์ฐ๊ฒฐํฉ๋๋ค.
- ์ ํจ ๊ธฐ๊ฐ์ NotBefore ๋ฐ NotAfter ๋ ์ง๋ก ์ ์๋๋ฉฐ ์ธ์ฆ์์ ์ ํจ ๊ธฐ๊ฐ์ ํ์ํฉ๋๋ค.
- ๊ณ ์ ํ Serial Number๋ Certificate Authority(CA)๊ฐ ์ ๊ณตํ๋ฉฐ ๊ฐ ์ธ์ฆ์๋ฅผ ์๋ณํฉ๋๋ค.
- Issuer๋ ์ธ์ฆ์๋ฅผ ๋ฐํํ CA๋ฅผ ๊ฐ๋ฆฌํต๋๋ค.
- SubjectAlternativeName์ subject์ ๋ํ ์ถ๊ฐ ์ด๋ฆ์ ํ์ฉํ์ฌ ์๋ณ ์ ์ฐ์ฑ์ ์ ๊ณตํฉ๋๋ค.
- Basic Constraints๋ ์ธ์ฆ์๊ฐ CA์ฉ์ธ์ง ์๋ ์ํฐํฐ์ฉ์ธ์ง ์๋ณํ๊ณ ์ฌ์ฉ ์ ํ์ ์ ์ํฉ๋๋ค.
- **Extended Key Usages (EKUs)**๋ Object Identifiers(OIDs)๋ฅผ ํตํด ์ฝ๋ ์๋ช ์ด๋ ์ด๋ฉ์ผ ์ํธํ์ ๊ฐ์ ์ธ์ฆ์์ ํน์ ์ฉ๋๋ฅผ ๊ตฌ๋ถํฉ๋๋ค.
- Signature Algorithm์ ์ธ์ฆ์๋ฅผ ์๋ช ํ๋ ๋ฐฉ๋ฒ์ ์ง์ ํฉ๋๋ค.
- Signature๋ ๋ฐํ์์ ๊ฐ์ธ ํค๋ก ์์ฑ๋์ด ์ธ์ฆ์์ ์ง์๋ฅผ ๋ณด์ฅํฉ๋๋ค.
ํน๋ณ ๊ณ ๋ ค ์ฌํญ
- **Subject Alternative Names (SANs)**๋ ํ๋์ ์ธ์ฆ์๋ฅผ ์ฌ๋ฌ ์ ์ฒด์ฑ์ ์ ์ฉํ ์ ์๊ฒ ํ์ฌ, ์ฌ๋ฌ ๋๋ฉ์ธ์ ๊ฐ์ง ์๋ฒ์ ํนํ ์ค์ํฉ๋๋ค. SAN ๊ท๊ฒฉ์ ์กฐ์ํด ์ฌ์นญํ๋ ๊ณต๊ฒฉ์ ๋ฐฉ์งํ๋ ค๋ฉด ์์ ํ ๋ฐ๊ธ ์ ์ฐจ๊ฐ ํ์์ ์ ๋๋ค.
Active Directory(AD)์ Certificate Authorities (CAs)
AD CS๋ ์ง์ ๋ ์ปจํ ์ด๋๋ฅผ ํตํด AD ํฌ๋ฆฌ์คํธ์์ CA ์ธ์ฆ์๋ฅผ ์ธ์ํ๋ฉฐ, ๊ฐ ์ปจํ ์ด๋๋ ๊ณ ์ ํ ์ญํ ์ ํฉ๋๋ค:
- Certification Authorities ์ปจํ ์ด๋์๋ ์ ๋ขฐ๋ ๋ฃจํธ CA ์ธ์ฆ์๊ฐ ์ ์ฅ๋ฉ๋๋ค.
- Enrolment Services ์ปจํ ์ด๋์๋ Enterprise CAs ๋ฐ ํด๋น ์ธ์ฆ์ ํ ํ๋ฆฟ์ ๋ํ ์ ๋ณด๊ฐ ํฌํจ๋ฉ๋๋ค.
- NTAuthCertificates ๊ฐ์ฒด์๋ AD ์ธ์ฆ์ ํ์ฉ๋ CA ์ธ์ฆ์๊ฐ ํฌํจ๋ฉ๋๋ค.
- AIA (Authority Information Access) ์ปจํ ์ด๋๋ ์ค๊ฐ CA ๋ฐ ๊ต์ฐจ CA ์ธ์ฆ์์ ํจ๊ป ์ธ์ฆ์ ์ฒด์ธ ๊ฒ์ฆ์ ๋์ต๋๋ค.
์ธ์ฆ์ ํ๋: ํด๋ผ์ด์ธํธ ์ธ์ฆ์ ์์ฒญ ํ๋ฆ
- ํด๋ผ์ด์ธํธ๊ฐ Enterprise CA๋ฅผ ์ฐพ๋ ๊ฒ์ผ๋ก ์์ฒญ ํ๋ก์ธ์ค๊ฐ ์์๋ฉ๋๋ค.
- ๊ณต๊ฐ-๊ฐ์ธ ํค ์์ ์์ฑํ ํ ๊ณต๊ฐ ํค์ ๊ธฐํ ์ธ๋ถ ์ ๋ณด๋ฅผ ํฌํจํ CSR์ด ์์ฑ๋ฉ๋๋ค.
- CA๋ ์ฌ์ฉ ๊ฐ๋ฅํ ์ธ์ฆ์ ํ ํ๋ฆฟ์ ๋ํด CSR์ ํ๊ฐํ๊ณ , ํ ํ๋ฆฟ ๊ถํ์ ๋ฐ๋ผ ์ธ์ฆ์๋ฅผ ๋ฐ๊ธํฉ๋๋ค.
- ์น์ธ๋๋ฉด CA๋ ์์ ์ ๊ฐ์ธ ํค๋ก ์ธ์ฆ์์ ์๋ช ํ์ฌ ํด๋ผ์ด์ธํธ์๊ฒ ๋ฐํํฉ๋๋ค.
์ธ์ฆ์ ํ ํ๋ฆฟ
AD ๋ด์์ ์ ์๋๋ ์ด ํ ํ๋ฆฟ์ ์ธ์ฆ์ ๋ฐ๊ธ ์ค์ ๊ณผ ๊ถํ์ ๊ท์ ํ๋ฉฐ, ํ์ฉ๋ EKU, ๋ฑ๋ก(enrollment) ๋๋ ์์ ๊ถํ ๋ฑ ์ธ์ฆ์ ์๋น์ค ์ ๊ทผ ๊ด๋ฆฌ๋ฅผ ์ํด ์ค์ํฉ๋๋ค.
์ธ์ฆ์ ๋ฑ๋ก
์ธ์ฆ์ ๋ฑ๋ก ํ๋ก์ธ์ค๋ ๊ด๋ฆฌ์๊ฐ ์ธ์ฆ์ ํ
ํ๋ฆฟ์ ์์ฑํ๋ฉด ์์๋๊ณ , ๊ทธ ํ
ํ๋ฆฟ์ Enterprise Certificate Authority(CA)์ ์ํด ๊ฒ์๋ฉ๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ํ
ํ๋ฆฟ์ด ํด๋ผ์ด์ธํธ ๋ฑ๋ก์ ์ฌ์ฉ ๊ฐ๋ฅํด์ง๋ฉฐ, ์ด๋ Active Directory ๊ฐ์ฒด์ certificatetemplates ํ๋์ ํ
ํ๋ฆฟ ์ด๋ฆ์ ์ถ๊ฐํ์ฌ ์ด๋ฃจ์ด์ง๋๋ค.
ํด๋ผ์ด์ธํธ๊ฐ ์ธ์ฆ์๋ฅผ ์์ฒญํ๋ ค๋ฉด ๋ฑ๋ก ๊ถํ(enrollment rights) ์ด ๋ถ์ฌ๋์ด์ผ ํฉ๋๋ค. ์ด๋ฌํ ๊ถํ์ ์ธ์ฆ์ ํ ํ๋ฆฟ ๋ฐ Enterprise CA ์์ฒด์ ๋ณด์ ์ค๋ช ์(security descriptor)์ ์ํด ์ ์๋ฉ๋๋ค. ์์ฒญ์ด ์ฑ๊ณตํ๋ ค๋ฉด ๋ ์์น ๋ชจ๋์ ๊ถํ์ด ๋ถ์ฌ๋์ด์ผ ํฉ๋๋ค.
ํ ํ๋ฆฟ ๋ฑ๋ก ๊ถํ
์ด ๊ถํ๋ค์ Access Control Entries(ACEs)๋ฅผ ํตํด ์ง์ ๋๋ฉฐ, ๋ค์๊ณผ ๊ฐ์ ๊ถํ๋ค์ ์์ธํ ๊ธฐ์ ํฉ๋๋ค:
- Certificate-Enrollment ๋ฐ Certificate-AutoEnrollment ๊ถํ(๊ฐ๊ฐ ํน์ GUID์ ์ฐ๊ด)
- ExtendedRights, ๋ชจ๋ ํ์ฅ ๊ถํ์ ํ์ฉ
- FullControl/GenericAll, ํ ํ๋ฆฟ์ ๋ํ ์ ์ฒด ์ ์ด ๊ถํ ์ ๊ณต
Enterprise CA ๋ฑ๋ก ๊ถํ
CA์ ๊ถํ์ Certificate Authority ๊ด๋ฆฌ ์ฝ์์์ ์ ๊ทผ ๊ฐ๋ฅํ ๋ณด์ ์ค๋ช ์์ ๋ช ์๋ฉ๋๋ค. ์ผ๋ถ ์ค์ ์ ๋ฎ์ ๊ถํ์ ์ฌ์ฉ์์๊ฒ ์๊ฒฉ ์ ๊ทผ์ ํ์ฉํ ์๋ ์์ด ๋ณด์์ ์ฐ๋ ค๊ฐ ๋ ์ ์์ต๋๋ค.
์ถ๊ฐ ๋ฐ๊ธ ์ ์ด
๋ค์๊ณผ ๊ฐ์ ์ ์ด๊ฐ ์ ์ฉ๋ ์ ์์ต๋๋ค:
- Manager Approval: ์์ฒญ์ ๋๊ธฐ(pending) ์ํ๋ก ๋๊ณ ์ธ์ฆ์ ๋งค๋์ ์ ์น์ธ์ด ์์ ๋๊น์ง ๋ณด๋ฅํฉ๋๋ค.
- Enrolment Agents and Authorized Signatures: CSR์ ํ์ํ ์๋ช ์์ ์๊ตฌ๋๋ Application Policy OID๋ฅผ ์ง์ ํฉ๋๋ค.
์ธ์ฆ์ ์์ฒญ ๋ฐฉ๋ฒ
์ธ์ฆ์๋ ๋ค์์ ํตํด ์์ฒญํ ์ ์์ต๋๋ค:
- Windows Client Certificate Enrollment Protocol (MS-WCCE), DCOM ์ธํฐํ์ด์ค ์ฌ์ฉ.
- ICertPassage Remote Protocol (MS-ICPR), named pipes ๋๋ TCP/IP ํตํด.
- certificate enrollment web interface, Certificate Authority Web Enrollment ์ญํ ์ด ์ค์น๋ ๊ฒฝ์ฐ.
- Certificate Enrollment Service (CES), Certificate Enrollment Policy (CEP) ์๋น์ค์ ํจ๊ป ์ฌ์ฉ.
- ๋คํธ์ํฌ ์ฅ์น๋ฅผ ์ํ Network Device Enrollment Service (NDES), Simple Certificate Enrollment Protocol (SCEP) ์ฌ์ฉ.
Windows ์ฌ์ฉ์๋ GUI(certmgr.msc ๋๋ certlm.msc)๋ ์ปค๋งจ๋๋ผ์ธ ๋๊ตฌ(certreq.exe ๋๋ PowerShell์ Get-Certificate ๋ช
๋ น)๋ฅผ ํตํด์๋ ์ธ์ฆ์๋ฅผ ์์ฒญํ ์ ์์ต๋๋ค.
# Example of requesting a certificate using PowerShell
Get-Certificate -Template "User" -CertStoreLocation "cert:\\CurrentUser\\My"
์ธ์ฆ์ ์ธ์ฆ
Active Directory (AD) supports certificate authentication, primarily utilizing Kerberos and Secure Channel (Schannel) protocols.
Kerberos ์ธ์ฆ ํ๋ก์ธ์ค
Kerberos ์ธ์ฆ ํ๋ก์ธ์ค์์ ์ฌ์ฉ์์ Ticket Granting Ticket (TGT) ์์ฒญ์ ์ฌ์ฉ์์ ์ธ์ฆ์์ ์๋ private key๋ก ์๋ช
๋๋ค. ์ด ์์ฒญ์ ๋๋ฉ์ธ ์ปจํธ๋กค๋ฌ์์ ์ธ์ฆ์์ validity, path, revocation status ๋ฑ์ ํฌํจํ ์ฌ๋ฌ ๊ฒ์ฆ์ ๊ฑฐ์น๋ค. ๊ฒ์ฆ์๋ ๋ํ ์ธ์ฆ์๊ฐ ์ ๋ขฐํ ์ ์๋ ์ถ์ฒ์ธ์ง ํ์ธํ๊ณ ๋ฐ๊ธ์๊ฐ NTAUTH certificate store์ ์กด์ฌํ๋์ง๋ ํ์ธํ๋ ์ ์ฐจ๊ฐ ํฌํจ๋๋ค. ๊ฒ์ฆ์ ์ฑ๊ณตํ๋ฉด TGT๊ฐ ๋ฐ๊ธ๋๋ค. AD์ NTAuthCertificates ๊ฐ์ฒด๋ ๋ค์ ์์น์ ์๋ค:
CN=NTAuthCertificates,CN=Public Key Services,CN=Services,CN=Configuration,DC=<domain>,DC=<com>
์ธ์ฆ์ ์ธ์ฆ์ ์ ๋ขฐ๋ฅผ ๊ตฌ์ถํ๋ ๋ฐ ์ค์ฌ์ ์ด๋ค.
Secure Channel (Schannel) Authentication
Schannel์ ์์ ํ TLS/SSL ์ฐ๊ฒฐ์ ์ง์ํ๋ฉฐ, ํธ๋์ ฐ์ดํฌ ๋์ ํด๋ผ์ด์ธํธ๊ฐ ์ธ์ฆ์๋ฅผ ์ ์ํ๊ณ ํด๋น ์ธ์ฆ์๊ฐ ์ฑ๊ณต์ ์ผ๋ก ๊ฒ์ฆ๋๋ฉด ์ ๊ทผ์ด ํ์ฉ๋ฉ๋๋ค. ์ธ์ฆ์๋ฅผ AD ๊ณ์ ์ ๋งคํํ๋ ๋ฐฉ๋ฒ์๋ Kerberos์ S4U2Self ๊ธฐ๋ฅ์ด๋ ์ธ์ฆ์์ Subject Alternative Name (SAN) ๋ฑ ์ฌ๋ฌ ๋ฐฉ๋ฒ์ด ์์ ์ ์์ต๋๋ค.
AD Certificate Services Enumeration
AD์ ์ธ์ฆ์ ์๋น์ค๋ LDAP ์ฟผ๋ฆฌ๋ฅผ ํตํด ์ด๊ฑฐํ ์ ์์ผ๋ฉฐ, Enterprise Certificate Authorities (CAs) ๋ฐ ๊ทธ ๊ตฌ์ฑ ์ ๋ณด๋ฅผ ๋๋ฌ๋ ๋๋ค. ์ด๋ ํน๊ถ ์์ด ๋๋ฉ์ธ์ ์ธ์ฆ๋ ๋ชจ๋ ์ฌ์ฉ์๊ฐ ์ ๊ทผํ ์ ์์ต๋๋ค. Certify ๋ฐ Certipy ๊ฐ์ ๋๊ตฌ๋ AD CS ํ๊ฒฝ์์ ์ด๊ฑฐ ๋ฐ ์ทจ์ฝ์ ํ๊ฐ์ ์ฌ์ฉ๋ฉ๋๋ค.
Commands for using these tools include:
# Enumerate trusted root CA certificates, Enterprise CAs and HTTP enrollment endpoints
# Useful flags: /domain, /path, /hideAdmins, /showAllPermissions, /skipWebServiceChecks
Certify.exe cas [/ca:SERVER\ca-name | /domain:domain.local | /path:CN=Configuration,DC=domain,DC=local] [/hideAdmins] [/showAllPermissions] [/skipWebServiceChecks]
# Identify vulnerable certificate templates and filter for common abuse cases
Certify.exe find
Certify.exe find /vulnerable [/currentuser]
Certify.exe find /enrolleeSuppliesSubject # ESC1 candidates (CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT)
Certify.exe find /clientauth # templates with client-auth EKU
Certify.exe find /showAllPermissions # include template ACLs in output
Certify.exe find /json /outfile:C:\Temp\adcs.json
# Enumerate PKI object ACLs (Enterprise PKI container, templates, OIDs) โ useful for ESC4/ESC7 discovery
Certify.exe pkiobjects [/domain:domain.local] [/showAdmins]
# Use Certipy for enumeration and identifying vulnerable templates
certipy find -vulnerable -u john@corp.local -p Passw0rd -dc-ip 172.16.126.128
# Enumerate Enterprise CAs and certificate templates with certutil
certutil.exe -TCAInfo
certutil -v -dstemplate
์ฐธ๊ณ ์๋ฃ
- https://www.specterops.io/assets/resources/Certified_Pre-Owned.pdf
- https://comodosslstore.com/blog/what-is-ssl-tls-client-authentication-how-does-it-work.html
- GhostPack/Certify
- GhostPack/Rubeus
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


