Detection rules › Splunk

Windows Steal Authentication Certificates - ESC1 Abuse

Status
production
Severity
medium
Group by
Attributes, RequestId, Requester, computer_name, signature_id
Author
Steven Dick
Source
github.com/splunk/security_content

The following analytic detects when a new certificate is requested or granted against Active Directory Certificate Services (AD CS) using a Subject Alternative Name (SAN). It leverages Windows Security Event Codes 4886 and 4887 to identify these actions. This activity is significant because improperly configured certificate templates can be exploited for privilege escalation and environment compromise. If confirmed malicious, an attacker could gain elevated privileges or persist within the environment, potentially leading to unauthorized access to sensitive information and further exploitation.

MITRE ATT&CK coverage

TacticTechniques
Credential AccessT1649 Steal or Forge Authentication Certificates

Event coverage

Rule body splunk

name: Windows Steal Authentication Certificates - ESC1 Abuse
id: cbe761fc-d945-4c8c-a71d-e26d12255d32
version: 11
creation_date: '2023-07-28'
modification_date: '2026-05-13'
author: Steven Dick
status: production
type: TTP
description: The following analytic detects when a new certificate is requested or granted against Active Directory Certificate Services (AD CS) using a Subject Alternative Name (SAN). It leverages Windows Security Event Codes 4886 and 4887 to identify these actions. This activity is significant because improperly configured certificate templates can be exploited for privilege escalation and environment compromise. If confirmed malicious, an attacker could gain elevated privileges or persist within the environment, potentially leading to unauthorized access to sensitive information and further exploitation.
data_source:
    - Windows Event Log Security 4886
    - Windows Event Log Security 4887
search: "`wineventlog_security` EventCode IN (4886,4887) Attributes=\"*SAN:*upn*\" Attributes=\"*CertificateTemplate:*\" | stats count min(_time) as firstTime max(_time) as lastTime values(name) as name values(status) as status values(Subject) as ssl_subject values(SubjectKeyIdentifier) as ssl_hash by Computer, EventCode, Requester, Attributes, RequestId | `security_content_ctime(firstTime)`  | `security_content_ctime(lastTime)`| fillnull | rex field=Attributes \"(?i)CertificateTemplate:(?<object>[^\\r\\n]+)\" | rex field=Attributes \"(?i)ccm:(?<req_src>[^\\r\\n]+)\" | rex max_match=10 field=Attributes \"(?i)(upn=(?<req_user_1>[^\\r\\n&]+))\" | rex max_match=10 field=Attributes \"(?i)(dns=(?<req_dest_1>[^\\r\\n&]+))\" | rex field=Requester \"(.+\\\\\\\\)?(?<src_user>[^\\r\\n]+)\" | eval flavor_text = case(EventCode==\"4886\",\"A suspicious certificate was requested using request ID: \".'RequestId',EventCode==\"4887\", \"A suspicious certificate was issued using request ID: \".'RequestId'.\". To revoke this certifacte use this request ID or the SSL fingerprint [\".'ssl_hash'.\"]\"), dest = upper(coalesce(req_dest_1,req_dest_2)), src = upper(coalesce(req_src,Computer)) | fields - req_* | rename Attributes as object_attrs, EventCode as signature_id, name as signature, RequestId as ssl_serial, Requester as ssl_subject_common_name| `windows_steal_authentication_certificates___esc1_abuse_filter`"
how_to_implement: To implement this analytic, enhanced Audit Logging must be enabled on AD CS and within Group Policy Management for CS server. See Page 115 of first reference. Recommend throttle correlation by RequestId/ssl_serial at minimum.
known_false_positives: False positives may be generated in environments where administrative users or processes are allowed to generate certificates with Subject Alternative Names. Sources or templates used in these processes may need to be tuned out for accurate function.
references:
    - https://specterops.io/wp-content/uploads/sites/3/2022/06/Certified_Pre-Owned.pdf
    - https://github.com/ly4k/Certipy#esc1
    - https://pentestlaboratories.com/2021/11/08/threat-hunting-certificate-account-persistence/
drilldown_searches:
    - name: View the detection results for - "$src$" and "$dest$"
      search: '%original_detection_search% | search  src = "$src$" dest = "$dest$"'
      earliest_offset: $info_min_time$
      latest_offset: $info_max_time$
    - name: View risk events for the last 7 days for - "$src$" and "$dest$"
      search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$src$", "$dest$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
      earliest_offset: 7d
      latest_offset: "0"
finding:
    title: Possible AD CS ESC1 activity by $src_user$ - $flavor_text$
    entity:
        field: src_user
        type: user
        score: 50
intermediate_findings:
    entities:
        - field: src
          type: system
          score: 50
          message: Possible AD CS ESC1 activity by $src_user$ - $flavor_text$
analytic_story:
    - Windows Certificate Services
asset_type: Endpoint
mitre_attack_id:
    - T1649
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: endpoint
security_domain: endpoint
tests:
    - name: True Positive Test
      attack_data:
        - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1649/certify_abuse/certify_esc1_abuse_winsecurity.log
          source: XmlWinEventLog:Security
          sourcetype: XmlWinEventLog
      test_type: unit

Stages and Predicates

Stage 1: search

`wineventlog_security` EventCode IN (4886,4887) Attributes="*SAN:*upn*" Attributes="*CertificateTemplate:*"

Stage 2: stats

| stats count min(_time) as firstTime max(_time) as lastTime values(name) as name values(status) as status values(Subject) as ssl_subject values(SubjectKeyIdentifier) as ssl_hash by Computer, EventCode, Requester, Attributes, RequestId

Stage 3: search

| `security_content_ctime(firstTime)`

Stage 4: search

| `security_content_ctime(lastTime)`

Stage 5: fillnull

| fillnull

Stage 6: rex

| rex field=Attributes "(?i)CertificateTemplate:(?<object>[^\r\n]+)"

Stage 7: rex

| rex field=Attributes "(?i)ccm:(?<req_src>[^\r\n]+)"

Stage 8: rex

| rex max_match=10 field=Attributes "(?i)(upn=(?<req_user_1>[^\r\n&]+))"

Stage 9: rex

| rex max_match=10 field=Attributes "(?i)(dns=(?<req_dest_1>[^\r\n&]+))"

Stage 10: rex

| rex field=Requester "(.+\\\\)?(?<src_user>[^\r\n]+)"

Stage 11: eval

| eval flavor_text = case(EventCode=="4886","A suspicious certificate was requested using request ID: ".'RequestId',EventCode=="4887", "A suspicious certificate was issued using request ID: ".'RequestId'.". To revoke this certifacte use this request ID or the SSL fingerprint [".'ssl_hash'."]"), dest = upper(coalesce(req_dest_1,req_dest_2)), src = upper(coalesce(req_src,Computer))
flavor_text =
1.concat("A suspicious certificate was requested using request ID: ", 'RequestId')
-concat("A suspicious certificate was issued using request ID: ", 'RequestId', ". To revoke this certifacte use this request ID or the SSL fingerprint [", 'ssl_hash', "]")(default)

Stage 12: fields

| fields - req_*

Stage 13: rename

| rename Attributes as object_attrs, EventCode as signature_id, name as signature, RequestId as ssl_serial, Requester as ssl_subject_common_name

Stage 14: search

| `windows_steal_authentication_certificates___esc1_abuse_filter`

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
Attributeseq
  • "*CertificateTemplate:*" corpus 2 (splunk 2)
  • "*SAN:*upn*" corpus 2 (splunk 2)
EventCodein
  • 4886 corpus 2 (splunk 2)
  • 4887 corpus 3 (splunk 3)