CVE-2022-30211: Windows L2TP VPN Memory Leak and Use after Free Vulnerability
A reference count increment bug in the Windows L2TP VPN driver allows a malicious client to repeatedly send StartControlConnectionRequests to increment the count indefinitely, leading to memory exhaustion (denial of service) or, via a signed integer overflow, a use-after-free that could potentially enable remote code execution.
Published on labs.nettitude.com
LRQA discovered a Memory Leak turned Use after Free (UaF) bug in the Microsoft implementation of the L2TP VPN protocol. The vulnerability affects most server and desktop versions of Windows, dating back to Windows Server 2008 and Windows 7 respectively.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The reference count for a tunnel context structure is incremented without a matching decrement, and a signed integer overflow in the dereference function allows the count to become negative, causing the structure to be freed while still referenced in a global linked list.
Impact
This could result in a Denial of Service (DoS) condition or could potentially be exploited to achieve Remote Code Execution (RCE), though the report notes that exploitation for RCE would take a very long time and is unlikely to be viable.
What the attacker needed
Windows Server with L2TP enabled; IPSEC tunnelling disabled or bypassed; Ability to send UDP packets to the server
The fix
The vulnerability was fixed by Microsoft in a patch released on 12 July 2022.
How it was found
- Disable IPSEC tunnelling on the Windows Server by setting the ProhibitIpSec registry key to 1.
- Send an L2TP StartControlConnectionRequest with a tunnel ID that has been used before from the same source IP and port.
- Repeat the request many times to increment the reference count indefinitely.
- Continue sending requests until the reference count overflows to a negative value, triggering a use-after-free.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This report describes a flaw in how Windows handles a type of VPN connection called L2TP. The software keeps a count of how many times a connection is used, but it never decreases that count properly. An attacker can send many requests to make the count grow until the server runs out of memory, or even cause the system to use memory after it has been freed, which can crash the system or potentially let an attacker run their own code.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.