Detect Code Signing Certificates in Elastic Security
Adversaries may buy and/or steal code signing certificates to sign malicious payloads, enabling their software to appear legitimate and bypass security controls that trust signed code. Code signing provides authenticity guarantees that cause users and security tools to trust signed executables more readily than unsigned binaries. Adversaries purchase certificates using front organizations or stolen identity information, or directly steal signing materials from compromised third parties. Real-world threat actors including Wizard Spider (DigiCert, GlobalSign certs), OilRig, BlackTech, MegaCortex (fake company certificates), and Kimsuky have all leveraged stolen or fraudulently-obtained code signing certificates. Detection pivots to observable artifacts when signed malicious code executes in the environment: certificate anomalies (revoked, expired, recently-issued, or from unusual certificate authorities), discrepancies between file metadata and certificate subjects, Windows Code Integrity enforcement events, and low-prevalence signed executables executing from user-writable paths.
MITRE ATT&CK
- Tactic
- Resource Development
- Technique
- T1588 Obtain Capabilities
- Sub-technique
- T1588.003 Code Signing Certificates
- Canonical reference
- https://attack.mitre.org/techniques/T1588/003/
Elastic Detection Query
any where
event.category == "process" and event.type == "start" and
(
process.code_signature.trusted == false or
process.code_signature.valid == false or
process.code_signature.status in (
"expired", "revoked", "invalid",
"errorUntrustedRoot", "errorExpired", "errorChaining"
)
) and
(
process.executable like~ "*\\AppData\\*" or
process.executable like~ "*\\Temp\\*" or
process.executable like~ "*\\Downloads\\*" or
process.executable like~ "*\\Users\\Public\\*" or
process.executable like~ "*\\ProgramData\\*"
) and
not process.code_signature.subject_name in~ (
"Microsoft Corporation",
"Microsoft Windows Publisher",
"Google LLC",
"Adobe Inc.",
"Oracle America, Inc.",
"Mozilla Corporation",
"Cisco Systems, Inc.",
"VMware, Inc.",
"Intel Corporation",
"NVIDIA Corporation",
"Apple Inc.",
"Amazon.com, Inc."
) Detects process execution from user-writable paths (AppData, Temp, Downloads, Users\Public, ProgramData) where the binary is signed but has certificate trust anomalies — expired, revoked, invalid, or untrusted root. Maps to ECS process.code_signature.* fields populated by Elastic Endpoint Security or Sysmon via Elastic Agent. Filters known-good publishers to reduce noise.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate consumer applications installed to AppData (Slack, Discord, Teams, Zoom) whose code signing certificates recently expired before the publisher renewed them — creates a temporary false positive window during the publisher's cert rotation cycle
- Enterprise internal tools signed with certificates issued by a private PKI or internal CA that is not present in the operating system trust store, causing code_signature.trusted to be false even though the binary is organizationally legitimate
- Software deployment agents (SCCM, Intune, Chocolatey) that stage signed installer packages in Temp or ProgramData directories during managed update workflows before relocating binaries to their final installation path under Program Files
Other platforms for T1588.003
Testing Methodology
Validate this detection against 5 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 Code Signing Certificate and Sign Test Binary
Expected signal: Sysmon Event ID 11 (File Create): argus_signed_test.exe created in %TEMP%. Sysmon Event ID 1 (Process Create): powershell.exe spawning csc.exe (C# compiler) to build the test binary. Sysmon Event ID 13 (Registry Value Set): certificate written to HKCU\SOFTWARE\Microsoft\SystemCertificates\My\. DeviceFileEvents in MDE: file creation event for the test executable in user temp path.
- Test 2Inspect Authenticode Certificate Chain on Suspicious Executable
Expected signal: Sysmon Event ID 11 (File Create): argus_lolbin_test.exe in %TEMP%. Sysmon Event ID 1 (Process Create): certutil.exe with -verify -urlfetch flags and temp path argument. Sysmon Event ID 3 (Network Connection): certutil.exe making outbound HTTPS connections to Microsoft CRL distribution points (crl.microsoft.com, ocsp.msocsp.com) for revocation checking. DeviceProcessEvents: certutil.exe spawned from PowerShell/cmd.exe.
- Test 3Enumerate Code Signing Certificates Including Private Key Holders
Expected signal: Sysmon Event ID 1 (Process Create): PowerShell accessing multiple certificate stores. Sysmon Event ID 11 (File Create): codesign_enum.csv created in %TEMP%. DeviceRegistryEvents: reads to HKLM\SOFTWARE\Microsoft\SystemCertificates\{My,Root,CA,TrustedPublisher}. DeviceFileEvents in MDE: CSV output file creation in user temp directory.
- Test 4Validate Executable Signatures Using Sigcheck Sysinternals Tool
Expected signal: Sysmon Event ID 1 (Process Create): sigcheck.exe launching from %TEMP% with -a -h flags. Sysmon Event ID 3 (Network Connection): sigcheck.exe may attempt outbound connection to VirusTotal API if -vt flag is included. DeviceProcessEvents: sigcheck.exe spawned by PowerShell with the target path argument covering %TEMP% executables.
- Test 5Query Windows Code Integrity Logs for Historical Certificate Enforcement Events
Expected signal: Sysmon Event ID 1 (Process Create): PowerShell executing Get-WinEvent against the Code Integrity operational log. DeviceProcessEvents: PowerShell with Get-WinEvent in command line. If any Code Integrity events were previously logged on this system (e.g., from WDAC policy enforcement), they will be returned. In environments without WDAC policy configured, Event IDs 3033/3034 may not appear, but 3036 (certificate details) often does.
References (10)
- https://attack.mitre.org/techniques/T1588/003/
- https://en.wikipedia.org/wiki/Code_signing
- https://learn.microsoft.com/en-us/microsoft-365/security/defender/advanced-hunting-devicefilecertificateinfo-table
- https://learn.microsoft.com/en-us/sysinternals/downloads/sigcheck
- https://learn.microsoft.com/en-us/windows/security/threat-protection/windows-defender-application-control/event-id-explanations
- https://crt.sh/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1588.003/T1588.003.md
- https://www.mandiant.com/resources/blog/fin12-ransomware-intrusion-actor-pursuing-high-value-targets
- https://symantec-enterprise-blogs.security.com/blogs/threat-intelligence/palmerworm-espionage-apt-target-taiwan
- https://www.ibm.com/reports/threat-intelligence
Unlock Pro Content
Get the full detection package for T1588.003 including response playbook, investigation guide, and atomic red team tests.