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

ESC4

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


Direct Indicators

LogEvent IDMeaningForensic ValueNotes
Security5136Directory object modifiedCriticalESC4 involves modification of certificate template permissions. Review changes to template ACLs such as enrollment rights or Write permissions.
Security4886Certificate issuedHighCertificate issuance following template modification may indicate exploitation.
Security4887Certificate request approvedMediumSuspicious approvals shortly after template changes.
Security4768Kerberos TGT requestHighCertificate obtained after template abuse may be used for PKINIT authentication.
Security4624Successful logonHighCertificate-based authentication may follow template modification.
Sysmon1Process creationMediumExecution of tools like Certipy, Certify, or PowerView to modify template permissions.
Sysmon3Network connectionMediumConnections to domain controller or CA during exploitation.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Template ACL modificationChanges to enrollment or write permissions on certificate templatesCriticalCore configuration change enabling ESC4 exploitation.
Low privilege account gaining template rightsUnexpected delegation of enrollment rights to non-admin usersHighIndicates attacker manipulation of template ACLs.
Certificate enrollment shortly after ACL changeCertificates issued soon after template permission modificationCriticalSuggests attacker modified template then enrolled certificate.
Authentication using certificateUser authenticating via PKINIT after template abuseHighIndicates certificate-based impersonation.
Administrative activity after authenticationPrivilege escalation actions following certificate-based loginCriticalAttacker leveraging certificate for domain compromise.

Common Tools

ToolUsage
CertipyEnumerates and exploits ESC4 by modifying template ACLs.
CertifyUsed to request certificates after template permissions are modified.
PowerViewModifies AD object ACLs including certificate templates.
BloodHoundIdentifies paths allowing template modification.
RubeusUses issued certificates to request Kerberos tickets.

Relevant Artifacts

  • Domain controller Security logs (5136, 4886)
  • Certificate Authority logs (4886, 4887)
  • Certificate template configuration
  • AD object ACL change history
  • Sysmon logs (1, 3)
  • PKINIT authentication logs
  • EDR telemetry detecting certificate abuse tools
  • Prefetch artifacts showing execution of Certipy or PowerView

MITRE ATT&CK References

  • T1649 Steal or Forge Authentication Certificates
  • T1550 Use Alternate Authentication Material
  • T1098 Account Manipulation
  • T1078 Valid Accounts

Decision Tree

  1. Is the suspicious event present?
    • Look for Event 5136 modifying certificate template ACLs.
  2. What host generated the event?
    • Identify the workstation modifying the template object.
  3. Is the account expected to perform this action?
    • Template modifications should normally only occur from PKI administrators.
  4. Pivot:
    • Source host → inspect execution of Certipy, Certify, or PowerView.
    • Account → verify permission changes and enrollment activity.
    • Network → analyze PKINIT authentication events following template modification.
  5. Confirm exploitation
    • Determine whether attacker issued certificate after modifying template permissions.

Example Detection Templates

KQL

SecurityEvent
| where EventID == 5136
| where ObjectDN contains "Certificate Templates"
| project TimeGenerated, SubjectUserName, ObjectDN, AttributeLDAPDisplayName
SecurityEvent
| where EventID == 4886
| summarize count() by CertificateTemplate, Requester, bin(TimeGenerated, 10m)

EQL

any where event.code == "5136"

Sigma

title: Suspicious Certificate Template Permission Modification
id: adcs-esc4-detection
status: experimental
description: Detects modification of certificate template permissions which may enable ESC4 exploitation
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID: 5136
  condition: selection
fields:
  - SubjectUserName
  - ObjectDN
falsepositives:
  - Legitimate PKI administrative operations
level: high
tags:
  - attack.persistence
  - attack.t1098

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Template ACL protectionRestrict who can modify certificate template permissionsCriticalPrevents attackers enabling vulnerable templates.
PKI administration controlLimit PKI administrative privileges to dedicated accountsHighReduces attack surface.
Template auditingRegularly audit certificate template ACLsHighDetects unauthorized permission changes.
MonitoringAlert on Event 5136 involving certificate templatesHighEarly detection of configuration tampering.
AD security reviewsReview delegation rights in AD periodicallyHighIdentifies risky permissions enabling ESC4.