Operator On The Wire
Join
← Back to Knowledge Base
BLUE TEAM / THREAT HUNT / ACTIVE DIRECTORY / ADCS

ESC2

This note documents detection patterns related to ADCS ESC2 within Active Directory environments.


Direct Indicators

LogEvent IDMeaningForensic ValueNotes
Security4886Certificate issuedCriticalReview CertificateTemplate and Requester. ESC2 involves templates allowing Any Purpose / Subordinate CA certificates which can be abused for authentication.
Security4887Certificate request approvedHighSuspicious approval of requests for powerful templates capable of signing other certificates.
Security4768Kerberos TGT requestHighCertificate obtained via ESC2 can be used for PKINIT authentication. Look for TGT requests following certificate issuance.
Security4624Successful logonHighCertificate-based authentication events shortly after certificate issuance.
Security4672Special privileges assignedHighPrivileged session established after certificate authentication.
Sysmon1Process creationMediumExecution of certificate abuse tools such as Certipy or Certify.
Sysmon3Network connectionMediumConnections to CA or domain controller during certificate exploitation.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Enrollment in dangerous templateCertificate template allowing Any Purpose EKUCriticalAllows attacker to generate certificates usable for authentication.
Unexpected certificate usageUser authenticating with certificate instead of passwordHighPossible certificate abuse scenario.
Certificate issued to unusual accountsCertificates issued to service accounts or administrators unexpectedlyHighMay indicate attacker enrollment.
Certificate usage from new hostAuthentication from workstation not previously associated with accountHighIndicates attacker-controlled host.
Immediate privileged actionsAdministrative activity following certificate authenticationCriticalIndicates attacker using certificate for escalation.

Common Tools

ToolUsage
CertipyEnumerates and exploits ESC2 certificate templates.
CertifyRequests certificates from vulnerable ADCS templates.
ForgeCertUsed if attacker obtains CA key material.
RubeusUses certificates for Kerberos PKINIT authentication.
ImpacketSupports certificate authentication workflows.

Relevant Artifacts

  • ADCS Security logs (4886, 4887)
  • Domain controller logs (4768, 4624)
  • Certificate Authority database records
  • Certificate template configuration
  • Sysmon logs (1, 3)
  • PKINIT authentication logs
  • EDR telemetry detecting certificate abuse tools
  • Prefetch artifacts showing execution of Certipy / Certify

MITRE ATT&CK References

  • T1649 Steal or Forge Authentication Certificates
  • T1550 Use Alternate Authentication Material
  • T1558 Steal or Forge Kerberos Tickets
  • T1078 Valid Accounts

Decision Tree

  1. Is the suspicious event present?
    • Identify certificate issuance events (4886) for templates allowing broad EKUs.
  2. What host generated the event?
    • Determine system requesting certificate from CA.
  3. Is the account expected to perform this action?
    • Investigate low privilege accounts requesting powerful certificate templates.
  4. Pivot:
    • Source host → inspect execution of Certipy or Certify.
    • Account → check authentication method after certificate issuance.
    • Network → inspect PKINIT authentication events.
  5. Confirm exploitation
    • Determine whether issued certificate was used to authenticate to domain services.

Example Detection Templates

KQL

SecurityEvent
| where EventID == 4886
| summarize count() by CertificateTemplate, Requester, bin(TimeGenerated, 10m)
| order by count_ desc
SecurityEvent
| where EventID == 4768
| summarize count() by TargetUserName, IpAddress, bin(TimeGenerated, 5m)

EQL

any where event.code == "4886"

Sigma

title: Suspicious ADCS Certificate Enrollment ESC2
id: adcs-esc2-detection
status: experimental
description: Detects suspicious certificate issuance which may indicate ESC2 exploitation
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID: 4886
  condition: selection
fields:
  - CertificateTemplate
  - Requester
falsepositives:
  - Legitimate certificate enrollment
level: medium
tags:
  - attack.credential_access
  - attack.t1649

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Template EKU restrictionAvoid templates with Any Purpose EKUCriticalLimits certificate abuse scenarios.
Enrollment permissionsRestrict enrollment rights to trusted groupsHighPrevents low privilege users requesting dangerous certificates.
Template auditingRegularly review certificate template configurationHighDetects vulnerable template settings.
MonitoringAlert on certificate issuance for privileged identitiesHighEarly detection of abuse.
PKI hardeningRestrict access to Certificate Authority infrastructureHighPrevents attackers abusing CA functionality.