Currently viewing ATT&CK v7.2 which was live between July 8, 2020 and October 26, 2020. Learn more about the versioning system or see the live site.
Register to stream the next session of ATT&CKcon Power Hour November 12

Unsecured Credentials: Private Keys

Adversaries may search for private key certificate files on compromised systems for insecurely stored credentials. Private cryptographic keys and certificates are used for authentication, encryption/decryption, and digital signatures.[1] Common key and certificate file extensions include: .key, .pgp, .gpg, .ppk., .p12, .pem, .pfx, .cer, .p7b, .asc.

Adversaries may also look in common key directories, such as ~/.ssh for SSH keys on * nix-based systems or C:\Users\(username)\.ssh\ on Windows. These private keys can be used to authenticate to Remote Services like SSH or for use in decrypting other collected files such as email.

Adversary tools have been discovered that search compromised systems for file extensions relating to cryptographic keys and certificates.[2][3]

Some private keys require a password or passphrase for operation, so an adversary may also use Input Capture for keylogging or attempt to Brute Force the passphrase off-line.

ID: T1552.004
Sub-technique of:  T1552
Tactic: Credential Access
Platforms: Linux, Windows, macOS
Permissions Required: User
Data Sources: File monitoring
Contributors: Itzik Kotler, SafeBreach
Version: 1.0
Created: 04 February 2020
Last Modified: 29 March 2020

Procedure Examples

Name Description
Ebury

Ebury has intercepted unencrypted private keys as well as private key pass-phrases.[6]

Empire

Empire can use modules like Invoke-SessionGopher to extract private key and session information.[5]

jRAT

jRAT can steal keys for VPNs and cryptocurrency wallets.[7]

Machete

Machete has scanned and looked for cryptographic keys and certificate file extensions.[8]

Mimikatz

Mimikatz's CRYPTO::Extract module can extract keys by interacting with Windows cryptographic application programming interface (API) functions.[4]

Rocke

Rocke has used SSH private keys on the infected machine to spread its coinminer throughout a network.[9]

Mitigations

Mitigation Description
Audit

Ensure only authorized keys are allowed access to critical resources and audit access lists regularly.

Encrypt Sensitive Information

When possible, store keys on separate cryptographic hardware instead of on the local system.

Password Policies

Use strong passphrases for private keys to make cracking difficult.

Restrict File and Directory Permissions

Ensure permissions are properly set on folders containing sensitive private keys to prevent unintended access.

Detection

Monitor access to files and directories related to cryptographic keys and certificates as a means for potentially detecting access patterns that may indicate collection and exfiltration activity. Collect authentication logs and look for potentially abnormal activity that may indicate improper use of keys or certificates for remote authentication.

References