Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-50679 — Write-up and exploit for a Windows Search heap buffer overflow (CVE-2026-50679) achieving local privilege escalation via CVIQuery vtable hijack and DLL loading. | Kitploit
Tools/GitHubGitHub/h4urek/cve-2026-50679
Privilege EscalationMemory ForensicsVulnerability AnalysisExploitationReverse EngineeringBinary Exploitation
GitHubh4urek/cve-2026-50679

CVE-2026-50679

Write-up and exploit for a Windows Search heap buffer overflow (CVE-2026-50679) achieving local privilege escalation via CVIQuery vtable hijack and DLL loading.

View Repository
162413 days agoNot yet reviewed
Share

CVE-2026-50679

In June this year I found this heap overflow in Windows Search, and I realized it was exploitable. I spent a few days working on it and managed to achieve LPE. When I submitted it, I was told that it was a duplicate :(. It was fixed in the July Patch Tuesday and tracked by Microsoft as CVE-2026-50679. Either way, the exploitation process was a lot of fun.

Root Cause

CPMExternalSearchResultIn (message 245) feeds an external search result into an existing query. Its body is three DWORDs followed by three UTF-16 strings, and each string is described by a length embedded in the body:

WSP_MESSAGE_HEADER          16 bytes
queryNameLength              4 bytes
currentRowsetIndex           4 bytes
remainingRowsetCount         4 bytes
queryName                    queryNameLength UTF-16 chars, null-terminated
rowset metadata              rowsetMetadata, rowsetNameLength, sourceNameLength (12 bytes)
rowsetName                   rowsetNameLength UTF-16 chars, null-terminated
sourceName                   sourceNameLength UTF-16 chars, null-terminated

All three lengths come from the client. The transport knows how many bytes arrived, but nothing in the message format ties the declared lengths to that number.

Before a message reaches a handler, tquery!CProxyMessage::ValidateInputHeader checks the header. It verifies the message id, the reserved fields, the checksum, and the minimum message size for that id. But it does not check whether the strings lengths declared in the message exceed the size of the message buffer.

The message is then dispatched to tquery!CRequestServer::DoSetExternalRowset. The handler allocates a destination buffer from the outer message length and decodes the inline buffer into it:

__int64 __fastcall CRequestServer::DoSetExternalRowset(CRequestServer *this, unsigned int msgSize)
{
    /* ... */
    BYTE *buffer = (BYTE *)operator new[](https://github.com/h4urek/cve-2026-50679/blob/main/msgSize);          /* outer message length */
    CPMExternalSearchResultIn *decoded =
        CPMExternalSearchResultIn::CPMExternalSearchResultIn(buffer, this + 0x270);
                                                             /* src = inline request buffer */
    /* ... */
}

The constructor is where the embedded lengths are used:

CPMExternalSearchResultIn::CPMExternalSearchResultIn(BYTE *dst, BYTE *src)
{
    /* dst: buffer sized by the outer message length */
    /* src: per-connection inline request buffer */
    /* ... */
    DWORD queryNameLength = *(DWORD *)(src + 0x10);
    *(DWORD *)(dst + 0x10) = queryNameLength;
    *(DWORD *)(dst + 0x14) = *(DWORD *)(src + 0x14);
    *(DWORD *)(dst + 0x18) = *(DWORD *)(src + 0x18);

    memcpy(dst + 0x1c, src + 0x1c, 2 * (queryNameLength + 1));

    DWORD rowsetNameLength = *(DWORD *)(src + 2 * queryNameLength + 0x22);
    memcpy(dst + 2 * queryNameLength + 0x2a,
           src + 2 * queryNameLength + 0x2a,
           2 * (rowsetNameLength + 1));

    DWORD sourceNameLength = *(DWORD *)(src + 2 * queryNameLength + 0x26);
    memcpy(dst + 2 * queryNameLength + 2 * rowsetNameLength + 0x2c,
           src + 2 * queryNameLength + 2 * rowsetNameLength + 0x2c,
           2 * (sourceNameLength + 1));
    /* ... */
}

The first copy is the obvious one. dst was allocated from the outer message length; the copy length comes from queryNameLength; nothing compares the two. The copy can be far larger than the allocation, and because its source is the inline buffer, it also runs past the bytes that actually arrived. The rest of the source is whatever the connection buffer held from earlier traffic.

The two later strings are worse. rowsetNameLength is read from src + 2 * queryNameLength + 0x22, an offset computed from the attacker-controlled queryNameLength, and sourceNameLength is read from a nearby offset. Both are outside the fixed part of the message, so the decoder reads whatever is there, treats it as a length, and copies again. One small message therefore produces several out-of-bounds reads and writes, and none of the lengths is ever compared with the destination allocation.

Exploit

Exploiting this bug came down to a few questions: which object to corrupt and hijack the control flow, where to redirect that control flow, and how to get around the LFH heap.

After some reversing I found a suitable object to hijack: CVIQuery. CVIQuery is the server-side object behind an open query. When the client sends a query request, the server creates a corresponding CVIQuery object, and its first field is the object's vtable, so corrupting this object gives a vtable hijack.

The heap was the next obstacle. CVIQuery is allocated from the LFH heap, so I wanted to overcome LFH randomization by spraying a large number of these objects. The good part is that every query request creates one CVIQuery, which gives a convenient heap spray primitive. However, wsearch limits the maximum number of open requests to 4096, so the spray count is limited, but that was enough; it just takes a bit of luck :).

Finally I needed to decide where to redirect control flow. I did some searching but did not find a suitable technique, so I decided to find one myself. I soon found a DLL loaded by the wsearch service: dxcore.dll, and its DXCoreDriver::LoadDriverModule function looked very interesting:

DXCoreDriver::LoadDriverModule decompilation

This function dereferences this + 0x30 as a DLL path string and calls LoadLibraryW to load that DLL. So it is enough to overflow the CVIQuery and hijack its vtable, then keep overflowing to write the DLL path at CVIQuery + 0x30, and arbitrary DLL loading follows.

A very handy trick. By the way, when I built the exploit this function only existed in Insider builds, but I have noticed that it has recently appeared in release builds as well.

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    867
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    544
  • 3

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    385
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    360
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    302
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    279

Explore all tools

Browse our collection of tools

View all tools →