Detect Digital Certificates in Google Chronicle
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/
YARA-L Detection Query
rule t1587_003_self_signed_certificate_creation {
meta:
author = "Argus Detection Engineering"
description = "Detects self-signed certificate creation via cert generation tools, PowerShell .NET crypto APIs, and certutil root store manipulation — MITRE T1587.003"
mitre_attack_tactic = "Resource Development"
mitre_attack_technique = "T1587.003"
severity = "HIGH"
confidence = "MEDIUM"
version = "1.0"
events:
$e.metadata.event_type = "PROCESS_LAUNCH"
(
(
re.regex($e.target.process.file.full_path, `(?i)(openssl(\.exe)?|makecert\.exe|pvk2pfx\.exe|certmgr\.exe)$`)
and re.regex($e.target.process.command_line, `(?i)(req[\s]+-new|x509[\s]+-req|genrsa|genpkey|pkcs12[\s]+-export|-newkey[\s]+rsa|-newkey[\s]+ec|req[\s]+-x509|-selfsign)`)
)
or
(
re.regex($e.target.process.file.full_path, `(?i)(powershell\.exe|pwsh\.exe)$`)
and re.regex($e.target.process.command_line, `(?i)(New-SelfSignedCertificate|X509Certificate2|System\.Security\.Cryptography\.X509Certificates|CertificateRequest|RSACryptoServiceProvider|ECDsaCng)`)
)
or
(
re.regex($e.target.process.file.full_path, `(?i)certutil\.exe$`)
and re.regex($e.target.process.command_line, `(?i)(-addstore|-addrepo|-MergePFX|-importpfx|-p12|-importcert)`)
)
or
(
re.regex($e.target.process.file.full_path, `(?i)(openssl(\.exe)?|makecert\.exe|pvk2pfx\.exe|certmgr\.exe)$`)
and not re.regex($e.target.process.command_line, `(?i)(req[\s]+-new|x509[\s]+-req|genrsa|genpkey|pkcs12[\s]+-export|-newkey[\s]+rsa|-newkey[\s]+ec|req[\s]+-x509|-selfsign)`)
)
)
condition:
$e
} Chronicle YARA-L 2.0 rule detecting self-signed certificate creation and certificate store manipulation via UDM PROCESS_LAUNCH events. Four branches: openssl/makecert/pvk2pfx with certificate-specific argument patterns, PowerShell invocations of New-SelfSignedCertificate or .NET X509 cryptographic classes, certutil commands importing certificates into trusted root stores, and bare certificate tool execution without specific argument signatures. Uses re.regex() for case-insensitive matching against UDM target process fields.
Data Sources
Required Tables
False Positives & Tuning
- System administrators using openssl or makecert.exe to generate SSL certificates for internal web services, development servers, or homelab environments during authorized change windows
- Enterprise software installers that bundle and invoke openssl or certutil during product setup to configure HTTPS endpoints or import application-specific CA certificates (common with network appliance management software)
- Automated infrastructure provisioning tools (Ansible, Chef, Puppet, Terraform provisioners) that execute certificate generation commands as part of idempotent system configuration management playbooks on managed nodes
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.