Detection: Windows Steal Authentication Certificates CryptoAPI

Description

The following analytic detects the extraction of authentication certificates using Windows Event Log - CAPI2 (CryptoAPI 2). It leverages EventID 70, which is generated when a certificate's private key is acquired. This detection is significant because it can identify potential misuse of certificates, such as those extracted by tools like Mimikatz or Cobalt Strike. If confirmed malicious, this activity could allow attackers to impersonate users, escalate privileges, or access sensitive information, posing a severe risk to the organization's security.

1`capi2_operational` EventCode=70 
2| xmlkv UserData_Xml 
3| stats count min(_time) as firstTime max(_time) as lastTime by Computer, UserData_Xml 
4| rename Computer as dest 
5| `security_content_ctime(firstTime)`
6| `security_content_ctime(lastTime)` 
7| `windows_steal_authentication_certificates_cryptoapi_filter`

Data Source

Name Platform Sourcetype Source Supported App
Windows Event Log CAPI2 70 Windows icon Windows 'xmlwineventlog' 'XmlWinEventLog:Microsoft-Windows-CAPI2/Operational' N/A

Macros Used

Name Value
capi2_operational (source=XmlWinEventLog:Microsoft-Windows-CAPI2/Operational)
windows_steal_authentication_certificates_cryptoapi_filter search *
windows_steal_authentication_certificates_cryptoapi_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1649 Steal or Forge Authentication Certificates Credential Access
KillChainPhase.EXPLOITAITON
NistCategory.DE_AE
Cis18Value.CIS_10
APT29

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Risk Event True
This configuration file applies to all detections of type anomaly. These detections will use Risk Based Alerting.

Implementation

To implement this analytic, one will need to enable the Microsoft-Windows-CAPI2/Operational log within the Windows Event Log. Note this is a debug log for many purposes, and the analytic only focuses in on EventID 70. Review the following gist for additional enabling information.

Known False Positives

False positives may be present in some instances of legitimate applications requiring to export certificates. Filter as needed.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message Risk Score Impact Confidence
Certificates were exported via the CryptoAPI 2 on $dest$. 24 30 80
The Risk Score is calculated by the following formula: Risk Score = (Impact * Confidence/100). Initial Confidence and Impact is set by the analytic author.

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Passing N/A N/A N/A
Unit Passing Dataset XmlWinEventLog:Microsoft-Windows-CAPI2/Operational XmlWinEventLog
Integration ✅ Passing Dataset XmlWinEventLog:Microsoft-Windows-CAPI2/Operational XmlWinEventLog

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: GitHub | Version: 2