T1587.002

Code Signing Certificates

Adversaries may create self-signed code signing certificates that can be used during targeting. Code signing is the process of digitally signing executables and scripts to confirm the software author and guarantee that the code has not been altered or corrupted. Adversaries leverage self-signed certificates to make malicious payloads appear more trustworthy — security tools and users are more likely to trust a signed binary even when the signing authority is unknown. Threat actors including Daggerfly (macOS malware), PROMETHIUM (StrongPity spyware installers), and Patchwork (BackConfig RAT) have created self-signed certificates impersonating legitimate software vendors to sign malicious payloads. This technique is commonly paired with T1553.002 (Code Signing) to bypass application allowlisting, reduce user suspicion, and evade detection tooling that weights signed binaries as lower risk.

Microsoft Sentinel / Defender
kusto
// T1587.002 — Code Signing Certificate Creation and Manipulation
// Multi-branch detection covering native SDK tools, PowerShell cmdlets, OpenSSL, certutil, and signtool
let LookbackPeriod = 24h;
let PowerShellCertKeywords = dynamic([
    "New-SelfSignedCertificate",
    "Export-PfxCertificate",
    "Export-Certificate",
    "X509Certificate2(",
    "CertEnroll.CX509",
    "CertificateRequest",
    "codeSigning",
    "1.3.6.1.5.5.7.3.3"
]);
// Branch 1: Windows SDK certificate tools (makecert, pvk2pfx)
let NativeSdkTools = DeviceProcessEvents
| where Timestamp > ago(LookbackPeriod)
| where (FileName =~ "makecert.exe")
    or (FileName =~ "pvk2pfx.exe")
| extend DetectionBranch = case(
    FileName =~ "makecert.exe", "MakeCert-NativeSDK",
    FileName =~ "pvk2pfx.exe", "Pvk2Pfx-KeyConversion",
    "Unknown"
  );
// Branch 2: PowerShell certificate creation cmdlets
let PowerShellCert = DeviceProcessEvents
| where Timestamp > ago(LookbackPeriod)
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where ProcessCommandLine has_any (PowerShellCertKeywords)
| extend DetectionBranch = "PowerShell-CertCmdlet";
// Branch 3: OpenSSL code signing cert creation
let OpenSSLCert = DeviceProcessEvents
| where Timestamp > ago(LookbackPeriod)
| where FileName =~ "openssl.exe"
| where ProcessCommandLine has_any ("req ", "x509 ", "pkcs12", "genpkey", "genrsa")
| where ProcessCommandLine has_any ("codeSigning", "1.3.6.1.5.5.7.3.3", "-x509", "extendedKeyUsage")
| extend DetectionBranch = "OpenSSL-CertCreation";
// Branch 4: certutil certificate store manipulation
let CertutilImport = DeviceProcessEvents
| where Timestamp > ago(LookbackPeriod)
| where FileName =~ "certutil.exe"
| where ProcessCommandLine has_any ("-addstore", "-importpfx", "-add")
| extend DetectionBranch = "CertUtil-StoreImport";
// Branch 5: signtool signing operations
let SigntoolActivity = DeviceProcessEvents
| where Timestamp > ago(LookbackPeriod)
| where FileName =~ "signtool.exe"
| where ProcessCommandLine has "sign"
| extend DetectionBranch = "SignTool-ExecutableSigning";
// Union all branches with normalized schema
NativeSdkTools
| union PowerShellCert
| union OpenSSLCert
| union CertutilImport
| union SigntoolActivity
| extend IsSuspiciousParent = InitiatingProcessFileName has_any (
    "cmd.exe", "wscript.exe", "mshta.exe", "cscript.exe",
    "regsvr32.exe", "rundll32.exe", "msiexec.exe"
  )
| extend IsTempLocation = ProcessCommandLine has_any ("\\Temp\\", "\\AppData\\", "\\Downloads\\", "\\Public\\")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         DetectionBranch, IsSuspiciousParent, IsTempLocation
| sort by Timestamp desc
medium severity medium confidence

Data Sources

Process: Process Creation File: File Creation Microsoft Defender for Endpoint

Required Tables

DeviceProcessEvents DeviceFileEvents DeviceRegistryEvents

False Positives

  • Software developers creating self-signed certificates for internal code signing during development and testing pipelines
  • IT administrators managing internal PKI infrastructure and importing certificates to enterprise certificate stores
  • CI/CD build systems (Jenkins, GitHub Actions runners, Azure DevOps agents) that create or use signing certificates as part of release automation
  • Security tools such as Fiddler, Burp Suite, and Charles Proxy that create local CA certificates for TLS interception
  • Certificate authority enrollment agents and autoenrollment services performing legitimate certutil operations
  • macOS developers using codesign tooling through Windows Subsystem for Linux or cross-compilation environments

Unlock Pro Content

Get the full detection package for T1587.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections