Skip to main content
Mallory
HighExploited in the wildCISA KEVPublic exploitVulnerability

CVE-2021-40449: Win32k NtGdiResetDC Use-After-Free Privilege Escalation

Published Oct 13, 2021 · Updated 1 month ago
Trending this weekNot trendingOutside this week’s top 100
Mention activity · 30 daysNo mention activity in the last 30 days.
CVSS7.8High · v3.1
EPSS81.9%100th percentile
CISA KEVYesAdded Nov 17, 2021
In the wildActivePer CISA KEV
Vendor
Microsoft Corporation
IdentifiersCVE-2021-40449CWE-416 · Use After Free

CVE-2021-40449 is a use-after-free vulnerability in the Windows Win32k NtGdiResetDC API that permits local privilege escalation. Exploitation requires local access with low privileges and no user interaction. The public CallbackHell exploit has been used to elevate privileges, write to kernel memory, and bypass endpoint security monitoring. The vulnerability was exploited as a zero-day in activity associated with MysterySnail and subsequently used in MATA campaigns. Microsoft released a fix in October 2021.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Analyst brief

Impact, mitigation & remediation

What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

Successful exploitation allows a low-privileged local attacker to elevate privileges and write to kernel memory. Observed exploitation has enabled interference with kernel callback monitoring used by endpoint security products. The vulnerability can also disclose kernel module addresses.

Mitigation

If you can’t patch tonight, do this now.

If immediate patching is not possible, reduce exposure by limiting execution of untrusted code on endpoints, restricting local user ability to run arbitrary binaries, and tightening application control policies. Monitor for abnormal privilege-escalation behavior involving Win32k and suspicious attempts to tamper with kernel callback-based security telemetry. Harden endpoints with least-privilege controls, EDR tamper protection, and detection rules for known public exploit tradecraft associated with this flaw. These measures only reduce risk and do not eliminate the vulnerability; patching is the definitive fix.

Remediation

Patch, then assume compromise.

Apply the Microsoft Windows security updates released in October 2021 that address CVE-2021-40449, or applicable superseding updates. Specific affected Windows versions and update identifiers are not available in the supplied information.

Public exploits

Exploits

7 exploits validated by Mallory's analysis.

View more in app →
cve_2021_40449.rbThis repository contains a single Metasploit module implementing a local privilege escalation exploit for CVE-2021-40449, a use-after-free vulnerability in the Win32k NtGdiResetDC function on Windows. The exploit targets Windows 10 x64 (RS1, RS5, and likely other builds), Windows 11, and Windows Server 2022, allowing an attacker with a Meterpreter session to elevate privileges to SYSTEM. The module checks the target's Windows build and revision to determine vulnerability, and uses reflective DLL injection to execute a custom payload as SYSTEM. The payload is typically a Meterpreter shell, but can be customized. The exploit is weaponized, as it is part of the Metasploit framework and supports arbitrary payloads. The only file present is the Metasploit Ruby module, which orchestrates the exploit and payload delivery.Disclosed Oct 12, 2021 · Framework: metasploit · ruby · localWeaponizedCallbackHellThis repository contains a functional local privilege escalation exploit for CVE-2021-40449, a use-after-free vulnerability in the Windows Win32k subsystem. The exploit is implemented in C++ (CallbackHell/CallbackHell.cpp) and targets a range of Windows versions, including Windows Vista through Windows 10 and corresponding server editions. The exploit works by hooking a user-mode callback in a printer driver, triggering a use-after-free in the kernel via ResetDC, and manipulating kernel memory to enable all privileges on the current process token. After privilege escalation, the exploit injects shellcode (which launches cmd.exe) into the winlogon.exe process, resulting in SYSTEM-level code execution. The repository includes Visual Studio project files and a detailed README.md explaining the vulnerability, exploitation technique, and supported/targeted Windows versions. The main entry point is CallbackHell.cpp, which contains all exploit logic and the embedded shellcode payload.ly4k · Disclosed Oct 16, 2021 · cpp · localOperationalCVE-2021-40449This repository contains a functional local privilege escalation exploit for CVE-2021-40449, a use-after-free (UAF) vulnerability in the Windows kernel component win32kfull!GreResetDCInternal. The exploit is implemented in C++ and consists of a Visual Studio solution with the main logic in 'exploit.cpp' and supporting definitions in 'defines.h'. The exploit works by leaking the current process's access token address, crafting a fake BitMapHeader structure, and using a kernel gadget (RtlSetAllBits) to overwrite the access token's privileges. It interacts with the Windows GDI subsystem, hooks printer driver callbacks, and triggers the UAF via ResetDC calls. After successful exploitation, it injects shellcode into the winlogon.exe process to spawn a SYSTEM shell. The exploit targets Windows 10 Redstone (build 14393) and requires local access. The repository is well-structured for building with Visual Studio and includes a detailed README explaining the exploitation steps and primitives used.hakivvi · Disclosed Oct 25, 2021 · cpp · c · localOperationalCVE-2021-40449_pocThis repository is a functional local privilege escalation exploit for CVE-2021-40449, a use-after-free vulnerability in the Windows win32k.sys kernel driver. The exploit is implemented in C with supporting assembly shellcode and is structured as a Visual Studio project. The main exploit logic is in 'CVE-2021-40449_poc.c', which sets up a heap spray and hooks the DrvEnablePDEV function in the XPS printer driver using the MinHook library. The exploit crafts a ROP chain and stack pivot to execute custom shellcode in kernel mode. The shellcode, defined in 'shellcode.c' and 'shellcode_iret_mystery_snail_1709.asm', locates the SYSTEM process and steals its token, granting SYSTEM privileges to the exploit process. The exploit is hardcoded for Windows 10 build 16299 (1709) and requires adaptation for other builds. The repository includes all necessary project and configuration files, as well as a README with compilation and adaptation instructions. No network endpoints are present; all exploitation is local and targets the Windows kernel via printer driver interfaces.Kristal-g · Disclosed Nov 7, 2021 · c · assembly · localOperationalCVE-2021-40449-NtGdiResetDC-UAFThis repository is a proof-of-concept (POC) exploit for CVE-2021-40449, a use-after-free vulnerability in the Windows GDI (NtGdiResetDC) subsystem. The exploit targets Windows 10 version 1809 x64 and leverages user-space memory allocation to trigger the vulnerability. The main exploit logic is implemented in 'Source/main.cpp', which orchestrates the following steps: retrieves a printer name, prepares the environment, creates a printer device context, hooks a driver function, and triggers the vulnerability via ResetDC. Upon successful exploitation, the code injects shellcode into the winlogon.exe process using VirtualAllocEx, WriteProcessMemory, and CreateRemoteThread, resulting in a SYSTEM-level command shell (cmd.exe). The repository also includes 'Source/detours.h', a third-party header for function detouring, but the exploit logic is self-contained in the main.cpp file. The attack vector is local privilege escalation, requiring the attacker to execute code on the target system. The exploit is operational, with a hardcoded payload and specific targeting of Windows 10 1809 x64.BL0odz · Disclosed Feb 20, 2022 · cpp · c · localOperationalCVE-2021-40449-ExploitThis repository contains a working local privilege escalation exploit for CVE-2021-40449, a Windows kernel vulnerability in the Win32k driver. The main exploit logic is implemented in 'CVE-2021-40449-x64.cpp', which is a C++ file targeting Windows 10 x64 versions 14393 and 17763. The exploit abuses a use-after-free (UAF) condition in the Win32k subsystem by manipulating printer device contexts and palettes, then leverages kernel memory corruption to escalate privileges. The exploit ultimately injects shellcode into the winlogon.exe process using standard Windows API calls (VirtualAllocEx, WriteProcessMemory, CreateRemoteThread), resulting in code execution as SYSTEM. The repository includes Visual Studio project files for building the exploit, and a README describing the affected Windows versions and a brief exploitation technique overview. No network or remote attack vectors are present; the exploit is purely local and requires code execution on the target machine.KaLendsi · Disclosed Oct 20, 2021 · c++ · localPoCvoidmapThis repository is a C-based proof-of-concept exploit for CVE-2021-40449, a Use-After-Free vulnerability in the Windows Win32k kernel component. The exploit is implemented as a Visual Studio project and consists of several C source and header files. The main entry point is 'main.c', which orchestrates the exploit steps: reading a user-supplied driver file, resolving kernel addresses, disabling SMEP, executing a kernel callback to map the driver, and restoring SMEP. The exploit works by hijacking a printer driver callback, triggering the UAF, and achieving arbitrary kernel function execution. The code is modular, with separate files for console output, utility functions, kernel mapping logic, and the exploit trigger. The exploit is local-only and requires access to a vulnerable Windows 10 system with a printer installed. No network endpoints are involved; the main fingerprintable artifacts are the use of 'ntoskrnl.exe' and the user-supplied driver file. The exploit is a POC and does not include weaponized or automated payload delivery, but it demonstrates reliable kernel code execution and driver mapping.SamuelTulach · Disclosed Mar 4, 2022 · c · localPoC
Exposure surface

Affected products & vendors

Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.

VendorProductType
Microsoft CorporationWindows 10 1507operating_system
Microsoft CorporationWindows 10 1607operating_system
Microsoft CorporationWindows 10 1809operating_system
Microsoft CorporationWindows 10 1909operating_system
Microsoft CorporationWindows 10 2004operating_system
Microsoft CorporationWindows 10 20h2operating_system
Microsoft CorporationWindows 10 21h1operating_system
Microsoft CorporationWindows 11operating_system
Microsoft CorporationWindows 11 21h2operating_system
Microsoft CorporationWindows 7operating_system
Microsoft CorporationWindows 8.1operating_system
Microsoft CorporationWindows Rt 8.1operating_system
Microsoft CorporationWindows Server 2004operating_system
Microsoft CorporationWindows Server 2008operating_system
Microsoft CorporationWindows Server 2008 R2operating_system
Microsoft CorporationWindows Server 2008 Sp2operating_system
Microsoft CorporationWindows Server 2012operating_system
Microsoft CorporationWindows Server 2012 R2operating_system
Microsoft CorporationWindows Server 2016operating_system
Microsoft CorporationWindows Server 2019operating_system
Microsoft CorporationWindows Server 2022operating_system
Microsoft CorporationWindows Server 20h2operating_system
FAQ

Frequently asked questions

Is CVE-2021-40449 exploited in the wild?
Yes. As of Oct 16, 2026, Mallory has reports of exploitation in the wild, and CISA added it to KEV on Nov 17, 2021.
Is there a public exploit for CVE-2021-40449?
Yes. Mallory tracks 7 public exploits or proofs of concept for CVE-2021-40449, the earliest disclosed Oct 12, 2021.
Is there a patch for CVE-2021-40449?
Apply the Microsoft Windows security updates released in October 2021 that address CVE-2021-40449, or applicable superseding updates. Specific affected Windows versions and update identifiers are not available in the supplied information.
What products are affected by CVE-2021-40449?
Microsoft Corporation Windows 10 1507, Microsoft Corporation Windows 10 1607, Microsoft Corporation Windows 10 1809, Microsoft Corporation Windows 10 1909, Microsoft Corporation Windows 10 2004, and at least 17 more.
How severe is CVE-2021-40449?
CVE-2021-40449 has a CVSS v3.1 score of 7.8 (High) and an EPSS score of 81.9% (100th percentile) as of Oct 16, 2026.
Activity feed

Recent activity

8 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.

View more in app →
+4 more in the timeline. Sign up to see them
Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Mallory platform

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, and which detections to deploy tonight.
Exposure mappingQuery your assets running an affected version, and investigate the blast radius.
Threat actor evidence2Every report linking this CVE to a named adversary.
Associated malware6Malware families linked to this CVE, with evidence and IOCs.
Detection signatures2YARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Vendor-by-vendor mappingCross-references every affected SKU, including bundled OEM variants.
Social activityCommunity discussion across Reddit, Mastodon, and other social sources.