T1552.004 IBM QRadar · QRadar

Detect Private Keys in IBM QRadar

Adversaries may search for private key and certificate files on compromised systems. Private keys (.key, .pem, .pfx, .p12, .ppk, .pgp, .gpg, .asc) are used for authentication, encryption, and digital signatures. SSH private keys enable key-based lateral movement. TLS/SSL private keys enable HTTPS interception. Code signing certificates enable payload signing for defense evasion. PGP keys decrypt archived data. Adversaries including Machete, Kinsing, Hildegard, Mafalda, and various APT groups actively harvest private keys. Mimikatz's CRYPTO::Extract module extracts keys via Windows CNG API. On network devices, 'crypto pki export' extracts PKI credentials.

MITRE ATT&CK

Tactic
Credential Access
Technique
T1552 Unsecured Credentials
Sub-technique
T1552.004 Private Keys
Canonical reference
https://attack.mitre.org/techniques/T1552/004/

QRadar Detection Query

IBM QRadar (QRadar)
sql
SELECT
  DATEFORMAT(starttime, 'yyyy-MM-dd HH:mm:ss') AS event_time,
  logsourcename(logsourceid) AS log_source,
  sourceip,
  username,
  QIDNAME(qid) AS event_name,
  "processname",
  "filename",
  "command"
FROM events
WHERE
  LOGSOURCETYPEID(logsourceid) IN (12, 13, 52, 71, 232, 377)
  AND starttime > NOW() - 86400000
  AND (
    (
      LOWER("filename") LIKE '%.pem'
      OR LOWER("filename") LIKE '%.pfx'
      OR LOWER("filename") LIKE '%.p12'
      OR LOWER("filename") LIKE '%.ppk'
      OR LOWER("filename") LIKE '%.pgp'
      OR LOWER("filename") LIKE '%.gpg'
      OR LOWER("filename") LIKE '%.asc'
      OR LOWER("filename") LIKE '%.key'
      OR LOWER("filename") IN ('id_rsa', 'id_ecdsa', 'id_ed25519', 'id_dsa')
    )
    AND LOWER("processname") NOT IN ('ssh', 'scp', 'sftp', 'openssl', 'gpg', 'curl', 'nginx', 'apache2', 'httpd', 'certbot')
  )
  OR (
    (
      LOWER("command") LIKE '%.pem%'
      OR LOWER("command") LIKE '%.pfx%'
      OR LOWER("command") LIKE '%.p12%'
      OR LOWER("command") LIKE '%.ppk%'
      OR LOWER("command") LIKE '%id_rsa%'
      OR LOWER("command") LIKE '%id_ecdsa%'
    )
    AND (
      LOWER("command") LIKE '%find %'
      OR LOWER("command") LIKE '%locate %'
      OR LOWER("command") LIKE '%get-childitem%'
      OR LOWER("command") LIKE '%dir /s%'
      OR LOWER("command") LIKE '%mimikatz%'
      OR LOWER("processname") LIKE '%certutil%'
    )
  )
ORDER BY starttime DESC
LAST 1 DAYS
high severity medium confidence

Detects private key file access and search activity across Windows and Linux endpoints via QRadar AQL. Queries Sysmon and auditd log sources for file open/read events targeting certificate and private key extensions, as well as process execution of search utilities scanning for key material.

Data Sources

Microsoft Windows SysmonLinux auditdMicrosoft Windows Security Event Log

Required Tables

events

False Positives & Tuning

  • Scheduled PKI management jobs that rotate and audit TLS certificates across servers
  • SSH key management platforms (HashiCorp Vault SSH, Teleport) that regularly read and distribute SSH private keys
  • Security scanners (Tenable, Qualys) performing certificate inventory checks across the environment
Download portable Sigma rule (.yml)

Other platforms for T1552.004


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.

  1. Test 1Find SSH Private Keys on Linux

    Expected signal: Linux auditd EXECVE records for find with id_rsa and .pem patterns. Multiple OPEN syscalls for each found key file. Process chain visible in auditd.

  2. Test 2Copy SSH Private Key for Exfiltration

    Expected signal: Linux auditd: OPEN for ~/.ssh/id_rsa (read) and /tmp/stolen_key (write). EXECVE for cp and cat commands. File creation event for /tmp/stolen_key.

  3. Test 3Export Windows Certificate with Private Key via certutil

    Expected signal: Sysmon Event ID 1: certutil.exe with -exportPFX, -p (password), and output file path. Sysmon Event ID 11: .pfx file created in C:\Windows\Temp. Windows Security Event 4657 if certificate store auditing enabled.

  4. Test 4Search for Private Keys with PowerShell

    Expected signal: Sysmon Event ID 1: powershell.exe with Get-ChildItem, *.pem, *.pfx, *.ppk patterns. PowerShell ScriptBlock Log Event ID 4104. Multiple file access events for any found key files.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections