Skip to content
Memory corruption Advisory Advanced CVE-2024-5844

Heap buffer overflow in Tab Strip (CVE-2024-5844)

The TabGroupModel::GetTabGroup function lacks proper validation of the TabGroupId, leading to a heap buffer overflow read when an invalid ID is used. An attacker could potentially exploit this to crash the browser or leak memory.

Sri Follow

Originally disclosed on Chrome VRP

  • Fix shipped in 2 months

VULNERABILITY DETAILS

The TabGroupModel::GetTabGroup() is responsible for retrieving a TabGroup object from the groups_ map based on the provided TabGroupId. The function contains a DCHECK statement that asserts the presence of the id in the groups_ map using the ContainsTabGroup function. However, when the g2 ID is invalid or does not correspond to an existing TabGroup in the groups_ map, accessing it through GetTabGroup will lead to out-of-bound access i.e, heap-buffer-overflow of READ primitive in this case. [1]

The crash occurs when calling group_model->GetTabGroup(g2)->ListTabs() [2], indicating that the g2 ID is being used to access a TabGroup object.

C++
TabGroup* TabGroupModel::GetTabGroup(const tab_groups::TabGroupId& id) const {
  DCHECK(ContainsTabGroup(id));
  return groups_.find(id)->second.get(); //[1]
}

VERSION Chrome Version: 125.0.6368.2 Operating System: Ubuntu 22.04

REPRODUCTION CASE

  • Run the following browser test with --ozone-platform=wayland
C++

// poc

IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, WaylandDragUAF) {
  ASSERT_TRUE(browser()->tab_strip_model()->SupportsTabGroups());

  TabStrip* tab_strip = GetTabStripForBrowser(browser());
  TabStripModel* model = browser()->tab_strip_model();
  TabGroupModel* group_model = model->group_model();

  AddTabsAndResetBrowser(browser(), 3);
  tab_groups::TabGroupId g1 = model->AddToNewGroup({2, 3});
  tab_groups::TabGroupId g2 = model->AddToNewGroup({1});
  StopAnimating(tab_strip);

  PressInput(GetCenterInScreenCoordinates(tab_strip->tab_at(1)));
  DragInputTo(GetCenterInScreenCoordinates(tab_strip->tab_at(2)));
  group_model->GetTabGroup(g1)->ListTabs();
  ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE, false,
                                              false, false, false));
  group_model->GetTabGroup(g2)->ListTabs(); // [2]
}

PATCH RECOMMENDATION

  • Modify the GetTabGroup() to include proper validation of the id parameter before accessing the groups_ map.
  • Replace the DCHECK with a null check or error handling mechanism to gracefully handle cases where the id is not found in the groups_ map.
  • Return a null pointer or throw an exception when the id is invalid to prevent accessing non-existent TabGroup objects.

FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION Type of crash: browser Crash State: asan_1.log, asan_2.log, asan_3.log, asan_4.log

CREDIT INFORMATION Externally reported security bugs may appear in Chrome release notes. If this bug is included, how would you like to be credited? Reporter credit: Sri

The original report as published on the Chromium issue tracker, by Sri. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 GetTabGroup function uses a DCHECK (debug-only assertion) to verify the ID exists, but in release builds this check is removed, allowing an out-of-bounds read when the ID is not found.

Impact

A heap buffer overflow read could crash the browser and potentially leak sensitive information from memory.

What the attacker needed

Chrome version 125.0.6368.2; Wayland display server; Ability to trigger drag-and-drop actions

The fix

The GetTabGroup function should validate the ID parameter and return null or handle the error gracefully instead of using a DCHECK.

How it was found

  1. Run the browser test with --ozone-platform=wayland
  2. Add three tabs and create two tab groups: one with tabs 2 and 3, another with tab 1
  3. Simulate a drag from tab 1 to tab 2
  4. Press Escape to cancel the drag
  5. Call GetTabGroup with the second group's ID and list its tabs, triggering the crash

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 function that looks up a tab group by its ID does not check if the ID actually exists before using it. If an invalid ID is given, the program reads memory it shouldn't, which can crash the browser or leak data. This is called a heap buffer overflow.

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 Sri

View all

6 more disclosed reports, best first.

More from Google Chrome

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.