Skip to content

Windows Event ID 5058: Key file operation

Written when an operation (read, write, delete, etc.) is performed on a cryptographic key file. It captures access to private keys and certificate-associated keys, usable to detect credential theft.

Overview

The subcategory is Audit Other System Events. It is generated when an operation such as read, write, or delete is performed, through a Key Storage Provider (KSP), on a file that holds a KSP key (such as a certificate’s private key). It applies only when the “Microsoft Software Key Storage Provider” or the “Microsoft Smart Card Key Storage Provider” is used, and appears for example during certificate renewal or export. It includes the operation type, provider, target key, key file path, and the acting account (not the process).

How it is triggered

  • Access to a key container/key file (using a certificate, exporting a private key, deleting a key, and so on).
  • The operation type (read/write/delete/export, etc.) is recorded.

Security review points

  • Exporting or reading a private key can relate to stealing a certificate’s private key for impersonation. Note key-file operations (especially export) by unexpected accounts.
  • Together with DPAPI events 4692/4693 and certificate-services events, track access to credentials and key material.

Notes for log review

  • It also occurs with legitimate apps and certificate use. Match the operation type (especially export/delete), target key, and account against normal patterns.
  • Confirm key-file operations by unfamiliar accounts, or by accounts that do not normally handle keys, at high priority.

MITRE ATT&CK mapping

TechniqueTacticWhat this event shows
T1552.004 Private KeysCredential AccessPrivate key files read or exported by an unexpected account
T1649 Steal or Forge Authentication CertificatesCredential AccessStealing 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.

RuleTypeSeverity
Certified Pre-Owned - backup of CA private key - rule 1Sentinel analytics ruleMedium

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

FieldMeaning
Key Name / Key TypeThe target key
OperationThe operation type (read/export/delete, etc.)
Subject\Account NameThe acting account
Provider Name / Key File PathThe KSP used and the key file path

Glossary

  • Key file — a file managed by a KSP that stores a certificate’s private key and the like. If stolen, it is abused for impersonation or decrypting protected data.

References