Windows Remote Desktop Services Remote Code Execution Vulnerability (CVE-2025-29831)
A use-after-free flaw exists in the Windows Remote Desktop Gateway Service. An unauthenticated attacker could trigger a race condition over the network and potentially execute arbitrary code, though an administrator must restart the service for exploitation to succeed.
Description
Use after free in Remote Desktop Gateway Service allows an unauthorized attacker to execute code over a network.
FAQ
How could an attacker exploit this vulnerability? An attacker could successfully exploit this vulnerability by attempting to connect to a system with the Remote Desktop Gateway role, triggering the race condition to create a use-after-free scenario, and then leveraging this to execute arbitrary code.
FAQ
According to the CVSS metric, user interaction is required (UI:R). What interaction would the user have to do? Exploitation of the vulnerability requires an admin user to stop or restart the service.
Remote Desktop Gateway Service
Remote Desktop Gateway Service
Microsoft
Microsoft
Customer Action Required
Yes
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a race condition in the Remote Desktop Gateway Service leads to a use-after-free memory error.
Impact
An unauthenticated attacker could potentially execute arbitrary code on the system, but only if an administrator restarts the service.
What the attacker needed
Network access to RD Gateway; admin restarts the service
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 report has not been written yet. The Original tab links to the source.
A use-after-free is a memory bug where a program keeps using a piece of memory after it has been freed, which can let an attacker control what happens next. Here, the Remote Desktop Gateway service has this flaw, and an attacker who can reach it over the network might be able to run their own code. However, the attack only works if an administrator stops or restarts the service, which makes it harder to pull off.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.