Skip to content
Memory corruption Disclosed report Advanced CVE-2026-8959

Heap-Buffer-Overflow on Parent Process (Drag and Drop feature)

An integer overflow in the parent process's drag-and-drop data handling lets a compromised content process cause a heap buffer overflow. An attacker controlling the renderer could crash the parent process, and potentially corrupt memory, by sending a drag session with enough items.

Ameen Basha M K Follow

Originally disclosed on Mozilla

  • Fixed in 7 days
  • Paid in 19 days
  • Disclosed after 7 days

Created attachment 9573403 patch_renderer_prealloc.patch

nsDataObjCollection::GetText() in widget/windows/nsDataObjCollection.cpp accumulates buffersize as a uint32_t without overflow checks. When enough drag items are processed (controlled by a compromised content process via IPC), buffersize + alloclen wraps past UINT32_MAX. GlobalReAlloc receives the wrapped (small) value, but then the code computes a buffer pointer at the old (pre-wrap) offset and calls memcpy, causing a heap buffer overflow / access violation.

NOte: Tested on windows 11 and Nightly 152.0a1 (2026-04-24) (64-bit)

Vulnerability Details

Vulnerable Code (nsDataObjCollection.cpp:155-192)

C++
uint32_t buffersize = sizeof(DROPFILES) + sizeof(char16_t);  // ~22 bytes
uint32_t alloclen = 0;

for (uint32_t i = 0; i < mDataObjects.Length(); ++i) {
    // ... get filename from each nsDataObj ...
    alloclen = (filename.Length() + 1) * sizeof(char16_t);
    hGlobalMemory = ::GlobalReAlloc(hGlobalMemory, buffersize + alloclen, GHND);
    //                               ^^^^^^^^^^^^^^^^^^^^^^^^^
    //                  uint32_t addition wraps when buffersize > UINT32_MAX - alloclen
    realbuffer = (char16_t*)((char*)GlobalLock(hGlobalMemory) + buffersize);
    memcpy(realbuffer, filename.get(), alloclen);
    buffersize += alloclen;  // accumulates without overflow check
}

Overflow Mechanics

  1. Content process sends IPCTransferableData[] via PBrowser::InvokeDragSession
  2. No server-side validation of array length exists
  3. Parent process creates one nsDataObj per item, adds to nsDataObjCollection
  4. External drop target (Explorer) calls IDataObject::GetData(CF_HDROP)
  5. GetFile() iterates all items, accumulating buffersize
  6. When buffersize + alloclen > UINT32_MAX:
    • GlobalReAlloc receives wrapped (small) value
    • Buffer is shrunk or allocated too small
    • memcpy(realbuffer, filename.get(), alloclen) overflows the buffer

Attack Surface

Web Content (dragstart event)
  -> Content Process: nsDragSessionProxy::InvokeDragSessionImpl()
  -> IPC: PBrowser::SendInvokeDragSession(IPCTransferableData[])
  -> Parent Process: BrowserParent::RecvInvokeDragSession()
  -> RemoteDragStartData::AddInitialDnDDataTo()
  -> nsDragSession::InvokeDragSessionImpl()
  -> nsDataObjCollection created with N items
  -> ::DoDragDrop() (Win32 OLE)
  -> External target calls GetData(CF_HDROP)
  -> nsDataObjCollection::GetFile() - OVERFLOW HERE

Patch Required: The patch modifies only widget/nsDragServiceProxy.cpp (content process) tosimulate a compromised renderer. The parent process is UNPATCHED — the overflow in nsDataObjCollection::GetText() is the real vulnerability.

Steps to reproduce:

  1. Apply the patch, rebuild
  2. open the poc file on patched firefox, in side open notepad also (just for drop)
  3. Drag 1: First drag the area, hold a seconds and drop it on notepad
  4. Drag 2: Do the same
  5. Parent Process Crash (Heap-Buffer-Overflow)

I have newly moved to asan windows so it was facing difficulties to capture the parent prcoess crash details

I have the Access Violation crash info from windows event viewer:

Faulting application name: firefox.exe, version: 152.0.0.384, time stamp: 0x69ead392
Faulting module name: ucrtbase.dll, version: 10.0.26100.7623, time stamp: 0x53a0792e
Exception code: 0xc0000005
Fault offset: 0x00000000000ede13
Faulting process id: 0x50A0
Faulting application start time: 0x1DCD3B983002367
Faulting application path: D:\mozilla-source\build\obj-x86_64-pc-windows-msvc\dist\bin\firefox.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report Id: 173aedbf-cac2-4cec-8365-045925171175
Faulting package full name: 
Faulting package-relative application ID: 

The original report as published on Mozilla's Bugzilla, by Ameen Basha M K. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the size accumulator is a 32-bit unsigned integer and the addition of the new allocation length is performed without an overflow check before being passed to GlobalReAlloc.

Impact

A compromised content process could crash the parent process and may achieve memory corruption, though the reporter could not capture full sanitizer details on Windows.

What the attacker needed

Compromised content process; user drags items to an external target; Windows host

The fix

The size accumulation should be checked for overflow (or use a wider type) before calling GlobalReAlloc; the text does not state that a fix was applied.

How it was found

  1. Apply the provided patch and rebuild Firefox.
  2. Open the proof-of-concept file in the patched Firefox and open Notepad alongside it as a drop target.
  3. Perform the first drag: drag the area, hold briefly, and drop it on Notepad.
  4. Perform the second drag in the same way.
  5. The parent process crashes with a heap buffer overflow.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you drag files, Firefox packs their names into one block of memory. The code adds up the sizes in a fixed-width number that can wrap around to a small value if the total gets too big. The program then writes past the end of the too-small block, which can crash the browser or corrupt memory.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Ameen Basha M K

View all

23 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.