Blogs & Stories

SpiderLabs Blog

Attracting more than a half-million annual readers, this is the security community's go-to destination for technical breakdowns of the latest threats, critical vulnerability disclosures and cutting-edge research.

Bad Neighbors Can Break Windows (CVE-2020-16898)

On October 13th, 2020, Microsoft released a patch for a critical vulnerability (CVE-2020-16898) in the IPv6 stack, capable of causing BSOD (Blue Screen of Death). The vulnerability, codenamed “Bad Neighbor”, is a bug in the IPv6 Neighbor Discovery Protocol, particularly it’s improper handling of ICMPv6 Router Advertisement Packets. While publicly available proof of concept (PoC) code results in a denial of service, attackers can exploit this bug to perform remote code execution (RCE). This combined with ease of exploitation has earned this vulnerability a CVSS v3 score of 8.8.

Vulnerability Details and Analysis

This vulnerability results from improper handling of ICMPv6 Router Advertisements with Recursive DNS Server options (RDNSS) and an even length field value. According to RFC 8106 the length option for RDNSS is in units of 8 octets with a minimum value of 3 for one IPv6 address and every additional RDNSS address increases the length by 2. This field is used to determine the number of IPv6 addresses in the option (See Figure 1 below). The addresses field is a variable field that determines the number addresses which is equal to (Length-1)/2. Each IPv6 address is 16 bytes in length and each requires the length field to be greater than 3 and an odd number.

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     |     Type      |     Length    |           Reserved            |
     |                           Lifetime                            |
     |                                                               |
     :            Addresses of IPv6 Recursive DNS Servers            :
     |                                                               |

Figure 1: RDNSS Option Format


The Exploit

By Sending an RDNSS option with an even length, we send an IPv6 address value which is 8 bytes short of the required 16 bytes leading the TCP/IP stack to believe it is the start of a second option leading to buffer overflow or a potential RCE. The Windows driver tcpip.sys fails to parse this type of request with an even option resulting in a denial of service or a BSOD. Tcpip.sys is a windows driver that is used to communicate amongst devices by setting the properties of TCP/IP.

McAfee Labs has a great write up explaining the vulnerability, which we recommend reading. This link also has a detailed explanation of how the exploit works as well as a proof of concept that we used for showing exploitation in the video below.

As we know Bad Neighbor lets the last 8 bytes of the RDNSS option to be interpreted as the first bytes of a new option. The PoC makes use of this misinterpretation and includes Routing Information Option (type = 24) with max length as the new option. As these 8 bytes are initially subjected to be part of the IPv6 address of the RDNSS option it does not undergo validation that includes a size of length check. Finally, the packet is fragmented (See Figure 2 below) to make sure NdisGetDataBuffer will write everything into the storage buffer. The storage buffer is a static buffer of 0x20 bytes is unable to handle all the packets causing buffer overflow leading to BSOD.

Figure 2: Exploit Packet Fragmentation


This vulnerability cannot be exploited over the Internet and the /GS(Buffer Security Check) Buffer security exploit mitigation makes it extremely hard to perform code execution on modern Windows operating systems. Weaponizing this to make it wormable will not be trivial. However, it is still potent for denial of service.


The best way to protect your system currently is by applying Microsoft’s October Patch Tuesday updates. If you are unable to patch you should disable ICMPV6 RDNSS with the following Powershell command.

netsh int ipv6 set int *INTERFACENUMBER* rabaseddnsconfig=disable

This workaround is only available for Windows 1709 and above and does not require a reboot. It should be noted that this disables RA-based DNS configuration. Please refer to Microsoft Security Advisory for more details.

Detection guidance

Trustwave Security Testing Services customers can detect if this vulnerability is patched via authenticated scans. Additionally, Trustwave IDPS customers are also covered with new alert signatures for this exploit.

To identify potential exploit attempts, look out for Router Advertisement (RA) packets (type =134) with the RDNSS option (option type = 25) (See Figure 3 below). Flag those that have an even value in its length field. Also, make sure the length is at least 3. In cases that try to exploit the buffer overflow watch out for fragmented IPv6 packets followed by the Router Advertisement (See Figure 2 above). Additionally, a payload size greater than 100 bytes can be a good indication of exploitation. A Windows loader shellcode can be quite small but will most likely push the payload past 100 bytes. As always, monitor your own networks to baseline what is normal to best implement this sort of detection.

Image003Figure 3: Bad Neighbor exploit packet