githubEdit

Pass the Certificate

Pass the Certificate

Tools: gettgtpkinit.py , Rubeus , certipy

Pass the Certificate in order to get a TGT, this technique is used in "UnPAC the Hash" and "Shadow Credential"

PKINIT

1) Rubeus

Rubeus.exe asktgt /user:"USERNAME" /certificate:"PFX_FILE" [/password:"CERTIFICATE_PASSWORD] /domain:"FQDN_DOMAIN" /dc:"DC" /show

2) certipy

certipy auth -pfx CRT_FILE -dc-ip DC_IP

3) gettgtpkinit.py

gettgtpkinit.py -cert-pfx "PFX_FILE" [cert-pfx-pass "CERT_PASSWORD"] "FQDN_DOMAIN/USER "TGT_CCACHE_FILE"

These 3 techniques can be performed for a Pass-the-Ticket attack

Schannel (Secure Channel)

1) certipy

2) PassTheCert.py https://github.com/AlmondOffSec/PassTheCert.git

Extract the .key and .crt files from the .pfx file (Extract the .key file. Leave import password blank and put something like 1234 for PEM pass.)

Extract the .crt file

Authenticate against LDAPS using Schannel. In this example, we give the computer account we control RBCD, AKA delegation rights over the DC. Enter the PEM phrase we used when extracting the .key file earlier

With this technique, we can now perform an RBCD attack

Pass-the-Certificate

Windows

1) Information about a cert file

2) From a base64 PFX

3) Grant DCSync rights to a user

4) To restore

PEM certificates can be exported to a PFX format with openssl. Rubeus doesn't handle PEM certificates.

Certipy uses DER encryption. To generate a PFX for Rubeus, openssl can be used.

Linux

1) Base64-encoded PFX certificate (string) (password can be set)

2) PEM certificate (file) + PEM private key (file)

3) PFX certificate (file) + password (string, optionnal)

4) Using Certipy

The ticket obtained can then be used to

1) Authenticate with pass-the-cache

2) Conduct an UnPAC-the-hash attack. This can be done with getnthash.py from PKINITtools.

3) Obtain access to the account's SPN with an S4U2Self. This can be done with gets4uticket.py from PKINITtools.

Alternate Method: PassTheCert https://github.com/AlmondOffSec/PassTheCert/blob/main/Python/passthecert.py

1) Extract key and cert from the pfx

2) Elevate a user for DCSync with passthecert.py

Last updated