
Windows LPE exploit for CVE-2021-40449, a use-after-free in win32kfull!GreResetDCInternal, leveraging token leaking, kernel gadget abuse, and shellcode injection to achieve SYSTEM privileges.
My exploit for CVE-2021-40449, a Windows LPE via a UAF in win32kfull!GreResetDCInternal.
along with the UAF vulnerabilty other primitives are being used to make this exploit possible:
access token address in ring0 via NtQuerySystemInformation() function with the SystemHandleInformation parameter.rtlSetAllBits() as a gadget to overwrite the exploit's access_token.privileges with 0xFFs.rtlSetAllBits() address on ring0 by leaking the base address of ntoskrnl.exe module via EnumDeviceDrivers() function.BitMapHeader in such a way that will allow us to overwrite the access_token.privileges of the exploit.BitMapHeader via NtSetInformationThread() primitive and leaking the allocation address in the big pool via NtQuerySystemInformation() function with SystemBigPoolInformation parameter.EnumPrinters() load the driver of one of them one of them then hook the calls to the usermode callback function DrvEnablePDEV().DrvEnablePDEV() function, do the exploit stuff then return whats returned from the proxied call to the GDI.ResetDC() in the hooked DrvEnablePDEV().PDC object via spraying a crafted object of the same size using the CreatePalette() primitive.SeDebugPrivilege privilege to get NT AUTHORITY\SYSTEM via injecting shellcode to winlogon.exe process.More information can be found on this article by Kaspersky.
tested on Win10 Redstone (build 14393).