An Update on CVE-2022-26809 - MSRPC Vulnerabliity - PATCH NOW
Last Updated: 2022-04-14 13:39:35 UTC
by Johannes Ullrich (Version: 1)
[If your main concern is that you do not have time to apply the April update, stop wasting more time reading this (or anything else about CVE-2022-26809) and start patching]
The stand-out vulnerability for this month's Microsoft Patch Tuesday was CVE-2022-26809 [msft]. An integer overflow in MSRPC that, if exploited, allows for arbitrary code execution over the network without requiring authentication or user interaction. There is no doubt that the vulnerability is critical, and the patch must be applied quickly. But how big of an issue is it? How soon should we expect an exploit? And what other mitigation techniques may be helpful? Let me summarize what we know so far:
1 - What is RPC
For the most popular network services (SMTP, DNS, HTTP...), we use specifically assigned ports managed by IANA [iana]. But there are many less common services specific to certain operating systems that do not have ports assigned by IANA. For these services, the "Remote Procedure Call" (RPC) mechanism may be used to standardize communication. Both Windows and Unix implement their own version of this basic idea. In Unix, it is typically called "SUN RPC" (RFC 1057). In Windows, we do have MSRPC.
MSRPC allows for messages to be transmitted in several different ways:
- SMB (Port 445 TCP, or port 139) is probably the most common mechanism. The commands over SMB are sent as named pipe writes that are then passed to the respective service.
- Via TCP (Port 135 TCP and high port): This mechanism is similar to SUN RPC. The client will first connect to an endpoint mapper (Port 135 for MSRPC, Port 111 for SUN RPC). The endpoint mapper will return the port number the service uses. You will see a second TCP connection to the high port transmitting the RPC message.
- via HTTP (default port 593). This is in particular useful if RPC is exposed over the internet. TLS can be used for encryption, and HTTP may provide additional authentication options. Port 80/443 may be used as well.
The number of hosts exposed on the different ports (based on Shodan.io):
|Port||Hosts Total||Hosts os:Windows|
Note that Shodan does not show any Windows hosts listening on ports other than 445. Also, Shodan is usually underestimating the number of exposed hosts. There is a simple Nmap script to enumerate RPC services that may help identify exposed systems:
nmap <target> --script=msrpc-enum [nmap]
2 - The Vulnerability
Several researchers have been using the patch to find the vulnerability. Akamai published a blog with some details, showing how the patch fixes an integer overflow condition [akamia]. This, in turn, leads to a heap buffer overflow. But nobody has made public means to trigger the vulnerability.
The vulnerability was reported to Microsoft by CyberKunLun [kunlun]. CyberKunLun is affiliated with Team Pangu, one of China's leading security research groups and a discoverer of many past vulnerabilities. CyberKunLun reported several different vulnerabilities (30?) fixed by Microsoft in April. CyberKunLun maintains a page with short write-ups and PoC code for vulnerabilities they discovered in the past. Nothing has been added yet about CVE-2022-26809.
3 - Impact and Mitigation
If you made it this far, you probably already subscribed to the idea of closing ports 135/139/445 on your firewall. In general, you should only allow ports open that are in use vs. blocking specific "dangerous" ports (expectations are ISPs and likely some Universities). But blocking SMB traffic internally is more tricky. Recent SMB exploits (e.g., remember WannaCry taking advantage of the EternalBlue vulnerability) showed how effective these exploits could be moving lateral inside networks. Microsoft's guidance to secure SMB traffic (linked to by its security advisory) also focuses heavily on firewall rules.
Patching is your only REAL fix for this vulnerability. Don't delay it. Patch now and apply the entire April update. It fixes several other critical flaws that may have a similar impact inside your network (e.g., the NFS flaw). You can't "turn off" RPC on Windows if you are wonderings. It will break stuff. RPC does more than SMB. For example, you can't move icons on the desktop if you disable RPC (according to a Microsoft help page).
4 - Detection
Do not expect too much from IDS/IPS rules. Too little is known to create a good IDS rule, and RPC vulnerabilities are notoriously hard to detect on the network. Host-based detection techniques may be more successful—dust off your WannaCry playbook. While WannaCry was an SMB exploit, not an RPC exploit, the behavior will likely be similar.
5 - Final Words
Don't Panic - Patch. I do not see any working exploits (April 14th, 9 am EST). I see some Rick Rolling, and you will likely see fake exploits soon. I have no idea when we will see a working exploit, but I hope we will have until next week.
Johannes B. Ullrich, Ph.D. , Dean of Research, SANS.edu
Apr 15th 2022
1 year ago
SMB Version: 1
OS: Windows 6.1
Software: Samba 4.9.5-Debian
So I tried it the other way round and went for "!samba !darwin" to weed out the IP addresses that definitely do not run the Microsoft RPC stack.
But as always: Shodan results are ballpark numbers, and not exact science. And yes: definitely patch ASAP. My take on this is here (in German): https://cert.at/de/aktuelles/2022/4/2022-04-windows-patchday
Apr 15th 2022
1 year ago