Detect Digital Certificates in Splunk
Adversaries may create self-signed SSL/TLS certificates that can be used during targeting. SSL/TLS certificates are designed to instill trust and include key information, owner identity, and a digital signature from a verifying entity. In the case of self-signing, these certificates lack third-party CA trust but remain functional for encrypting traffic. Adversaries create self-signed certificates to encrypt C2 communications (as seen with APT29/WellMess using mutual TLS authentication), to enable adversary-in-the-middle attacks if installed as a trusted root certificate, or to impersonate legitimate services. PROMETHIUM used self-signed certificates for HTTPS C2, Gamaredon Group reused the same TLS certificate across infrastructure clusters, and Storm-0501 spoofed a 'Microsoft IT TLS CA 5' self-signed certificate. Detection must focus on observable side-effects: certificate generation tool execution on compromised hosts, suspicious certificate store modifications, and network TLS connections bearing anomalous certificate properties.
MITRE ATT&CK
- Tactic
- Resource Development
- Technique
- T1587 Develop Capabilities
- Sub-technique
- T1587.003 Digital Certificates
- Canonical reference
- https://attack.mitre.org/techniques/T1587/003/
SPL Detection Query
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
| eval lower_image=lower(Image)
| eval lower_cmdline=lower(CommandLine)
| eval lower_parent=lower(ParentImage)
| eval IsCertGenTool=if(match(lower_image, "(openssl(\.exe)?|makecert\.exe|pvk2pfx\.exe)"), 1, 0)
| eval IsCertGenArgs=if(IsCertGenTool=1 AND match(lower_cmdline, "(req -new|x509 -req|genrsa|genpkey|pkcs12 -export|-newkey rsa|-newkey ec|req -x509|-selfsign)"), 1, 0)
| eval IsPSCertCreate=if(match(lower_image, "(powershell\.exe|pwsh\.exe)") AND match(lower_cmdline, "(new-selfsignedcertificate|x509certificate2|system\.security\.cryptography\.x509|certificaterequest|rsacryptoserviceprovider)"), 1, 0)
| eval IsCertUtilImport=if(match(lower_image, "certutil\.exe") AND match(lower_cmdline, "(-addstore|-addrepo|-mergepfx|-importpfx|-p12|-importcert)"), 1, 0)
| eval TargetsRootStore=if(IsCertUtilImport=1 AND match(lower_cmdline, "(root|authroot|trustedpublisher|trustedpeople)"), 1, 0)
| eval IsLolBinCert=if(match(lower_image, "(wmic\.exe|mshta\.exe|wscript\.exe|cscript\.exe)") AND match(lower_cmdline, "(certificate|certutil|pfx|openssl)"), 1, 0)
| eval DetectionBranch=case(
IsCertGenArgs=1, "CertGenToolWithArgs",
IsCertGenTool=1 AND IsCertGenArgs=0, "CertGenToolExecution",
IsPSCertCreate=1, "PSCertificateCreation",
TargetsRootStore=1, "RootCertStoreModification",
IsCertUtilImport=1, "CertUtilImport",
IsLolBinCert=1, "LOLBinCertOperation",
true(), null())
| where isnotnull(DetectionBranch)
| eval SuspicionScore=IsCertGenArgs + IsPSCertCreate + IsCertUtilImport + TargetsRootStore + IsLolBinCert
| table _time, host, User, Image, CommandLine, ParentImage, ParentCommandLine, DetectionBranch, TargetsRootStore, SuspicionScore
| sort - _time Detects self-signed certificate creation and suspicious certificate store manipulation using Sysmon Event ID 1 (Process Creation). Evaluates command lines against five behavioral categories: direct certificate generation tool invocation with certificate-creation arguments (openssl req/genrsa/x509), PowerShell certificate class usage (New-SelfSignedCertificate, X509Certificate2), certutil.exe import operations, root/trusted store modifications (highest severity), and unusual LOLBin involvement in certificate operations. A cumulative SuspicionScore helps analysts prioritize: score >= 2 warrants elevated investigation, TargetsRootStore=1 warrants immediate escalation due to trust chain compromise risk.
Data Sources
Required Sourcetypes
False Positives & Tuning
- Development teams using openssl or New-SelfSignedCertificate to generate local development HTTPS certificates for localhost testing
- PKI administrators and IT operations staff managing internal certificate authority infrastructure and importing trusted root certificates from enterprise CAs
- DevOps pipelines running on Windows build agents that generate ephemeral self-signed certificates for containerized test environments
- Security penetration testers and red team operators running authorized exercises involving certificate-based C2 simulation
- Web server automation scripts that auto-generate self-signed certificates during IIS or Nginx initial configuration
Other platforms for T1587.003
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Create Self-Signed Certificate with PowerShell New-SelfSignedCertificate
Expected signal: Sysmon Event ID 1: Process Create for powershell.exe with CommandLine containing 'New-SelfSignedCertificate' and the DnsName value. Sysmon Event ID 11: File Create event for df00tech-test-cert.pfx in %TEMP%. PowerShell ScriptBlock Log Event ID 4104 capturing the full certificate creation and export script. Registry Event ID 12/13 for the temporary certificate store entry under HKCU\SOFTWARE\Microsoft\SystemCertificates\My.
- Test 2Generate Self-Signed Certificate with OpenSSL
Expected signal: Sysmon Event ID 1: Two Process Create events — first for 'openssl req -x509' with -subj containing the spoofed Microsoft subject, second for 'openssl pkcs12 -export'. Sysmon Event IDs 11: File Create events for .key, .crt, and .pfx files in %TEMP%. The -subj value '/CN=Microsoft IT TLS CA 5' directly matches the Storm-0501 technique documented in ATT&CK.
- Test 3Import Self-Signed Certificate to Root Certificate Store
Expected signal: Sysmon Event ID 1: Process Create for certutil.exe with CommandLine '-addstore Root' and the .cer file path. Sysmon Event ID 12/13: Registry key creation under HKLM\SOFTWARE\Microsoft\SystemCertificates\Root\Certificates\<thumbprint>. Sysmon Event ID 11: File Create for the .cer export in %TEMP%. Security Event ID 4657 (if object access auditing enabled) for the registry write to the certificate store.
- Test 4Certificate Generation via OpenSSL on Linux
Expected signal: Linux auditd execve syscall records for each openssl invocation with full argument list. Syslog process execution entries for openssl. File creation events in /tmp for .pem and .pfx files. If Sysmon for Linux is deployed: Event ID 1 (Process Create) with Image=/usr/bin/openssl and full CommandLine capture including the spoofed -subj value.
References (10)
- https://attack.mitre.org/techniques/T1587/003/
- https://www.splunk.com/en_us/blog/security/tall-tales-of-hunting-with-tls-ssl-certificates.html
- https://www.pwc.co.uk/cyber-security/pdf/pwc-cyber-threats-2020-a-year-in-retrospect.pdf
- https://blog.talosintelligence.com/2020/06/promethium-extends-with-strongpity3.html
- https://www.mandiant.com/resources/blog/storm-0501-ransomware
- https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/certutil
- https://learn.microsoft.com/en-us/powershell/module/pki/new-selfsignedcertificate
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicefileevents-table
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceregistryevents-table
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1587.003/T1587.003.md
Unlock Pro Content
Get the full detection package for T1587.003 including response playbook, investigation guide, and atomic red team tests.