0x01利用漏洞拿到Meterpreter。

将存放在桌面上的exploit文件复制到metasploit系统指定的exploits存储路径中,并将exploit的属性设置为644.
cp ~/Desktop/ms14_064_ole_exploit.rb /usr/share/metasploit-framework/modules/exploits/windows/browser/
chmod 644 ms14_064_ole_exploit.rb
metasploit后渗透入门--meterpreter
在启动的metasploit中使用reload_all加载刚刚添加的exploit,加载完成后发现exploit从1347增加到1348。搜索得到ms14_064 exploit的路径。
reload_all
search ms14_064
metasploit后渗透入门--meterpreter
并进行利用
metasploit后渗透入门--meterpreter
Win8机器上访问相关uri会显示如下页面
metasploit后渗透入门--meterpreter
同时linux下会显示
metasploit后渗透入门--meterpreter
出现上图则说明我们拿到了meterpreter。
大部分同学使用metasploit到这儿就停止了,其实接下来可以做的工作还有好多呢。

0x2利用meterpreter进行进一步深入地信息搜集

使用env模块:收集并显示靶机系统上的操作系统环境变量
metasploit后渗透入门--meterpreter
Checkvm模块:检查靶机是否为虚拟机。此模块支持Hyper-V、VMware、VirtualCenter、Xen和QEMU虚拟机。
metasploit后渗透入门--meterpreter
credential_collector模块:获取受感染主机上的密码哈希和令牌token。
metasploit后渗透入门--meterpreter
enum_Applications模块:枚举列出安装在靶机上的应用程序
metasploit后渗透入门--meterpreter
Enum_logged_on_users模块:返回当前和最近登录的用户的列表
metasploit后渗透入门--meterpreter
Usb_history模块:列出在靶机系统上usb驱动的历史
metasploit后渗透入门--meterpreter
enum_Applications模块:枚举安装在靶机上的应用程序。
metasploit后渗透入门--meterpreter
Enum_drives: 查看分区情况
metasploit后渗透入门--meterpretermetasploit后渗透入门--meterpreter

0x2迁移会话,后台运行会话以及针对靶机的操作后台运行及返回会话:

Ctrl+z(也可直接使用background命令):将meterpreter终端隐藏在后台运行

metasploit后渗透入门--meterpreter
metasploit后渗透入门--meterpreter

迁移会话:
Migrate模块:迁移到指定的进程,如果没有指定的进程,将自动生成一个新进程并迁移到它
(应用场景:如果反弹的meterpreter会话是对方打开了一个你预置特殊代码的word文档(比如最近几个月的office的CVE)而产生的,那么对方一旦关闭掉word文档,我们获取到的meterpreter会话就会随之关闭,所以把会话进程注入到其他常见的系统进程如explorer.exe是一个好方法)
下图展示的是自动生成新进程并进行迁移
metasploit后渗透入门--meterpreter
迁移进程后,可以试试dumplinks模块:获得目标主机最近进行的系统操作,访问文件和office文档操作记录
metasploit后渗透入门--meterpreter
因为在试验环境下,所以查找不到相关记录

delete_user模块:从受感染的系统中删除指定的用户帐户。
首先切换回win8环境
创建新用户
metasploit后渗透入门--meterpreter
接下来运行模块
metasploit后渗透入门--meterpreter
再回到windows可以看到创建的用户被删除了
metasploit后渗透入门--meterpreter

multi_meterpreter_inject模块:注入一个给定的有效载荷到靶机的进程中。如果没有指定PID值,将创建一个新进程并注入有效负载。
metasploit后渗透入门--meterpreter

接下里按照前面实验的操作,同样先隐藏会话
然后使用connect执行靶机ip,端口进行连接
metasploit后渗透入门--meterpreter
这样就弹回了cmd
metasploit后渗透入门--meterpreter

键盘记录器在当年盗号横行的年代可谓非常火爆,其实meterpreter中也有相关的后渗透模块:
Keylog_recorder:记录靶机键盘输入
metasploit后渗透入门--meterpreter
指定会话进行键盘输入的记录
metasploit后渗透入门--meterpreter
在靶机上我们随意输入:
metasploit后渗透入门--meterpreter
输入完毕后按ctrl+c停止记录。此时靶机上的键盘输入已经被保存在相关路径了。我们可以使用cat看看
metasploit后渗透入门--meterpreter
可以看到确实被记录了

内网扫描以及远程控制

autoroute模块:通过Meterpreter会话创建一个新的路由,从而能够更深入地进入目标网络。(此处假设C段为192.168.218.0~255)
metasploit后渗透入门--meterpreter
Ctrl+z隐藏会话
metasploit后渗透入门--meterpreter
设置好新路由后进行扫描
metasploit后渗透入门--meterpreter

植入后门实施远程控制:
通过在meterpreter会话中运行persistence后渗透攻击模块,在目标主机的注册表值 HKLM\Software\Microsoft\Windows\Currentversion\Run中添加键值,达到自启动的目的,-X参数指定启动的方式为开机自启动,-i的参数指定反向连接的时间间隔。然后遍历meterpreter客户端,在指定回连的443端口进行监听,等待后门重新连接
metasploit后渗透入门--meterpreter
可以在win8下看到成功植入后门
metasploit后渗透入门--meterpreter

相关文章:

  • 2021-07-08
  • 2021-08-04
  • 2021-04-18
  • 2021-08-25
  • 2022-12-23
  • 2021-09-02
猜你喜欢
  • 2022-01-07
  • 2021-10-29
  • 2021-10-19
  • 2021-10-09
相关资源
相似解决方案