Detect Code Signing in Google Chronicle
Adversaries may create, acquire, or steal code signing materials to sign their malware or tools. Code signing provides a level of authenticity on a binary from the developer and a guarantee that the binary has not been tampered with. Valid signatures can bypass security policies requiring signed code to execute, making this technique effective for defense evasion. Threat actors including FIN7, Scattered Spider, Kimsuky, and Patchwork have all leveraged purchased, stolen, or self-signed certificates to make malicious binaries appear legitimate.
MITRE ATT&CK
- Tactic
- Defense Evasion
- Technique
- T1553 Subvert Trust Controls
- Sub-technique
- T1553.002 Code Signing
- Canonical reference
- https://attack.mitre.org/techniques/T1553/002/
YARA-L Detection Query
rule t1553_002_code_signing_abuse {
meta:
author = "Argus Detection Engineering"
description = "Detects T1553.002 Code Signing abuse: signtool.exe/certutil.exe signing or cert import activity, suspicious cert file creation, and certificate trust store registry modifications"
severity = "HIGH"
mitre_attack_tactic = "Defense Evasion"
mitre_attack_technique = "T1553.002"
reference = "https://attack.mitre.org/techniques/T1553/002/"
version = "1.0"
events:
(
$e.metadata.event_type = "PROCESS_LAUNCH"
and (
re.regex($e.target.process.file.full_path, `(?i)signtool\.exe$`)
or re.regex($e.target.process.file.full_path, `(?i)certutil\.exe$`)
)
and (
re.regex($e.target.process.command_line, `(?i)(\-sign|/sign|/f |\-f |/p |\-p |/fd |\-fd |/tr |\-tr |sha256|sha1|\-addstore|\-addcert|\-importpfx|\-p12|trustedpublisher|authroot)`)
)
)
or
(
$e.metadata.event_type = "FILE_CREATION"
and re.regex($e.target.file.full_path, `(?i)\.(pfx|p12|cer|crt)$`)
and re.regex($e.target.file.full_path, `(?i)(\\Temp\\|\\Downloads\\|\\AppData\\Local\\|\\AppData\\Roaming\\|\\Users\\Public\\|\\ProgramData\\)`)
)
or
(
$e.metadata.event_type = "REGISTRY_MODIFICATION"
and re.regex($e.target.registry.registry_key, `(?i)(ROOT\\Certificates|TrustedPublisher\\Certificates|AuthRoot\\Certificates|SystemCertificates\\ROOT|SystemCertificates\\TrustedPublisher)`)
and not re.regex($e.principal.process.file.full_path, `(?i)(certutil\.exe|mmc\.exe|wuauclt\.exe|TrustedInstaller\.exe|svchost\.exe)$`)
)
match:
$e.principal.hostname over 5m
condition:
$e
} Chronicle YARA-L 2.0 rule detecting T1553.002 Code Signing abuse across three event types: process launches of signtool.exe or certutil.exe with signing/import arguments, suspicious certificate file creation in user-writable directories, and unauthorized modifications to Windows trusted certificate store registry keys. Uses UDM fields for process, file, and registry event correlation.
Data Sources
Required Tables
False Positives & Tuning
- Software vendors running internal code signing pipelines where signtool.exe is invoked from build orchestration scripts (powershell.exe or cmd.exe parent) on dedicated signing servers
- Enterprise PKI teams using certutil.exe to deploy root CA certificates across the organization — will trigger the CertutilImport and trusted store patterns
- Security tools such as SSL inspection proxies or endpoint DLP agents that write certificate files to AppData or ProgramData as part of HTTPS interception setup
Other platforms for T1553.002
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 and Use a Self-Signed Code Signing Certificate
Expected signal: Sysmon Event ID 1: Process Create for powershell.exe with New-SelfSignedCertificate in command line. Sysmon Event ID 1: Process Create for signtool.exe with command line containing '/sign', '/f', '.pfx', '/fd sha256', and the target binary path. Sysmon Event ID 11: File creation events for df00tech-codesign.pfx and df00tech-test.exe in %TEMP%. PowerShell ScriptBlock Log Event ID 4104 with the New-SelfSignedCertificate and Export-PfxCertificate commands.
- Test 2Import Self-Signed Certificate into Trusted Publishers Store
Expected signal: Sysmon Event ID 1: Process Create for certutil.exe with CommandLine containing '-addstore TrustedPublisher'. Sysmon Event ID 11: File creation for df00tech-publisher.cer in %TEMP%. Sysmon Event ID 13 (Registry Value Set): new value under HKLM\SOFTWARE\Microsoft\SystemCertificates\TrustedPublisher\Certificates\ keyed by the certificate thumbprint. PowerShell ScriptBlock Log Event ID 4104 for the New-SelfSignedCertificate commands.
- Test 3Verify Signed Binary Execution Trust (Authenticode Check Bypass Simulation)
Expected signal: Sysmon Event ID 1: Process Create for certutil.exe with '-addstore -user TrustedPublisher'. Sysmon Event ID 11: File creation events for df00tech-sign-test.cer and df00tech-payload.ps1 in %TEMP%. Sysmon Event ID 13: Registry modification under HKCU\SOFTWARE\Microsoft\SystemCertificates\TrustedPublisher\Certificates (user-store variant). PowerShell ScriptBlock Log Event ID 4104 for Set-AuthenticodeSignature cmdlet execution.
- Test 4macOS Ad-Hoc Code Signing
Expected signal: macOS Unified Log: codesign process execution with '--sign -' arguments visible in process audit logs. Endpoint Security Framework events for ES_EVENT_TYPE_NOTIFY_EXEC when codesign runs. Security.framework log entries in /var/log/system.log for code signing operations. If EDR is present (CrowdStrike, SentinelOne): process creation event for codesign with suspicious ad-hoc signing arguments. spctl execution generates Gatekeeper assessment log entries in /var/log/system.log.
References (11)
- https://attack.mitre.org/techniques/T1553/002/
- https://eclecticlight.co/2020/11/16/checks-on-executable-code-in-catalina-and-big-sur-a-first-draft/
- https://securelist.com/why-you-shouldnt-completely-trust-files-signed-with-digital-certificates/68593/
- http://www.symantec.com/connect/blogs/how-attackers-steal-private-keys-digital-certificates
- https://en.wikipedia.org/wiki/Code_signing
- https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool
- https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/certutil
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1553.002/T1553.002.md
- https://blog.talosintelligence.com/2020/09/cobalt-strike-paper.html
- https://www.crowdstrike.com/blog/scattered-spider-byovd-exploits/
- https://unit42.paloaltonetworks.com/backconfig-malware-targeting-government-military/
Unlock Pro Content
Get the full detection package for T1553.002 including response playbook, investigation guide, and atomic red team tests.