Windows Event ID 5059: Key migration operation
Written when a cryptographic key migration operation is performed. It captures migration involving key export/import and draws attention from the angle of key-material exfiltration.
Overview
The subcategory is Audit Other System Events. It is generated when a cryptographic key is exported or imported through a Key Storage Provider (KSP). It applies only when the “Microsoft Software Key Storage Provider” or the “Microsoft Smart Card Key Storage Provider” is used. It is a key-related event alongside key file operation 5058.
How it is triggered
- Key backup/migration, moving a key to another machine/container.
Security review points
- Key migration (especially export) is an operation that takes a private key elsewhere and can relate to stealing a key for impersonation. Note migrations by unexpected subjects or of unexpected keys.
- Together with key file operation 5058, track access to and exfiltration of key material.
Notes for log review
- It also occurs in legitimate key management/migration operations. Match the target key, acting subject, and destination against normal patterns.
- Confirm migration of high-value keys (CA, code signing, DPAPI-related, etc.) at high priority.
MITRE ATT&CK mapping
| Technique | Tactic | What this event shows |
|---|---|---|
| T1552.004 Private Keys | Credential Access | Migrations (exports) that move private keys elsewhere |
| T1649 Steal or Forge Authentication Certificates | Credential Access | Stealing a certificate’s private key for impersonation |
Mapping as of ATT&CK v19.2. To search by technique, see the ATT&CK reverse lookup.
Detection rules
Microsoft Sentinel has 1 public detection rule that uses this event ID as a condition.
| Rule | Type | Severity |
|---|---|---|
| Certified Pre-Owned - backup of CA private key - rule 2 | Sentinel analytics rule | Medium |
Rules are collected from SigmaHQ r2026-07-01 and from Azure-Sentinel as of 2026-10-09, limited to those whose conditions include this event ID. Sentinel rules are limited to those that query the SecurityEvent or WindowsEvent table. “Threat-specific” rules target a particular threat group or malware, and “needs setup” rules require values for your environment. Severity is the value each rule’s author assigned.
Key fields
| Field | Meaning |
|---|---|
Key Name | The migrated key |
Operation | The migration type |
Subject\Account Name | The acting account |