Skip to content
Threat Feed
medium advisory

Detection of Unauthorized PowerShell Certificate Export

Adversaries may leverage the PowerShell cmdlet 'Export-Certificate' to exfiltrate cryptographic material from the Windows Certificate Store, enabling impersonation and decryption of sensitive data.

This threat brief focuses on the exploitation of the PowerShell cmdlet 'Export-Certificate' by malicious actors to target the Windows Certificate Store. Adversaries frequently attempt to gain unauthorized access to certificates to facilitate credential theft, impersonate legitimate users, or intercept and decrypt sensitive network communications. This activity is often part of a post-compromise stage where an attacker seeks to establish long-term persistence or gain further access to protected corporate resources. Defenders should monitor for execution of this cmdlet via PowerShell Script Block Logging (Event ID 4104), as its use is rarely required for routine end-user operations. The detection of this command is critical for identifying potential exfiltration of sensitive identity or encryption assets.

Attack Chain

  1. Initial access is established through spearphishing, credential harvesting, or exploitation of a remote service.
  2. The attacker performs initial discovery to locate the Windows Certificate Store and determine targets of interest.
  3. The attacker gains administrative or elevated local privileges required to access and export certificates.
  4. The attacker executes the PowerShell cmdlet 'Export-Certificate' to serialize a certificate into a file.
  5. The attacker attempts to bypass file monitoring or exfiltration protections while extracting the exported file.
  6. The exported certificate file is staged for exfiltration to external C2 infrastructure.
  7. The final objective is the use of the stolen certificate to authenticate as a victim or decrypt intercepted traffic.

Impact

Successful exfiltration of certificates can lead to severe security incidents, including the bypass of multi-factor authentication, the decryption of encrypted communications, and the assumption of a victim's digital identity across the enterprise. These incidents can compromise the integrity of internal communications and facilitate lateral movement within the network.

Recommendation

  • Deploy PowerShell Script Block Logging (Event ID 4104) across all Windows endpoints to ensure visibility into command execution.
  • Implement the following detection logic in your SIEM to alert on the usage of 'Export-Certificate' across the environment.
  • Audit current administrative scripts to identify and filter out legitimate business processes that require certificate exports, minimizing false positive noise.

Immediate actions

Enable PowerShell Script Block Logging (Event ID 4104) across all Windows endpoints.

IT Operations 7d

Threat Hunt

Search for Event ID 4104 containing 'export-certificate' in the last 30 days.

T1649 high high confidence hunt now

Data: PowerShell Operational Logs

Mitigations

Restrict local administrative rights to reduce the risk of unauthorized certificate access.

medium_term IT Operations

T1649

Detection coverage 1

Detect PowerShell Export-Certificate Cmdlet

medium

Detects the use of the PowerShell cmdlet Export-Certificate which may indicate credential exfiltration.

sigma tactics: credential_access techniques: T1649 sources: process_creation, windows

Detection queries are available on the platform. Get full rules →