Windows Steal Authentication Certificates - ESC1 Authentication
Description
The following analytic identifies when a suspicious certificate is granted using Active Directory Certificate Services (AD CS) with a Subject Alternative Name (SAN) and then immediately used for authentication. This action alone may not be malicious, however improperly configured certificate templates can be abused to permit privilege escalation and environment compromise due to over permissive settings (AD CS ESC1).
- Type: TTP
-
Product: Splunk Enterprise, Splunk Enterprise Security, Splunk Cloud
- Last Updated: 2023-05-25
- Author: Steven Dick
- ID: f0306acf-a6ab-437a-bbc6-8628f8d5c97e
Annotations
ATT&CK
Kill Chain Phase
- Exploitation
NIST
- DE.CM
CIS20
- CIS 10
CVE
Search
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
`wineventlog_security` EventCode IN (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
| 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]+)"
| rename Attributes as object_attrs, EventCode as signature_id, name as signature, RequestId as ssl_serial, Requester as ssl_subject_common_name
| eval user = lower(coalesce(req_user_1,req_user_2))
| join user [
| search `wineventlog_security` EventCode=4768 CertThumbprint=*
| rename TargetUserName as user, Computer as auth_dest, IpAddress as auth_src
| fields auth_src,auth_dest,user ]
| eval src = upper(coalesce(auth_src,req_src)), dest = upper(coalesce(auth_dest,req_dest_1,req_dest_2)), risk_score = 90
| eval flavor_text = case(signature_id=="4887", "User account [".'user'."] authenticated after a suspicious certificate was issued for it by [".'src_user'."] using certificate request ID: ".'ssl_serial')
| fields - req_* auth_*
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `windows_steal_authentication_certificates___esc1_authentication_filter`
Macros
The SPL above uses the following Macros:
windows_steal_authentication_certificates_-_esc1_authentication_filter is a empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Required fields
List of fields required to use this analytic.
- _time
- Attributes
- Computer
- EventCode
- Requester
- RequestId
- TargetUserName
- Computer
- IpAddress
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 for authentication. Sources or templates used in these processes may need to be tuned out for accurate function.
Associated Analytic Story
RBA
Risk Score | Impact | Confidence | Message |
---|---|---|---|
90.0 | 100 | 90 | Possible AD CS ESC1 authentication on $dest$ |
The Risk Score is calculated by the following formula: Risk Score = (Impact * Confidence/100). Initial Confidence and Impact is set by the analytic author.
Reference
- 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/
Test Dataset
Replay any dataset to Splunk Enterprise by using our replay.py
tool or the UI.
Alternatively you can replay a dataset into a Splunk Attack Range
source | version: 1