Skip to content
Race condition Advisory Advanced CVE-2025-0437

Out of bounds read in Metrics (CVE-2025-0437)

A time-of-check to time-of-use (TOCTOU) race condition in Chrome's persistent histogram allocator allows a child process to modify a shared memory size field between two checks, causing an out-of-bounds read in the broker process. This can crash the browser.

Xiantong Hou Follow

Originally disclosed on Chrome VRP

Bounty$2,000 High View original
  • Fix shipped in 2 months

Steps to reproduce the problem

  1. Apply the patch_renderer.diff with --ignore-whitespace argument.
  2. Build the release version of Chrome and start it.
  3. Open a new tab and visit any URL.
  4. Close the tab. If the issue does not trigger, repeat the process of opening a new tab, visiting a URL, and closing the tab.
  5. Since ASAN on Windows cannot detect this vulnerability, You can use WinDbg to attach to the broker process and then perform the above operations to capture the exception.

Problem Description

This vulnerability can be triggered through process such as render, GPU, and utility to cause a crash in the broker processes. The current demonstration shows that in the render process, it requires opening a new page to visit a website and then closing the page to have a chance of triggering it, as this is a TOCTOU bug.

base/metrics/persistent_histogram_allocator.cc

std::unique_ptr<HistogramBase> PersistentHistogramAllocator::GetHistogram(
    Reference ref) {
  PersistentHistogramData* data =
      memory_allocator_->GetAsObject<PersistentHistogramData>(ref);[1]
  const size_t length = memory_allocator_->GetAllocSize(ref);[2]

  if (!data || data->name[0] == '\0' ||
      reinterpret_cast<char*>(data)[length - 1] != '\0' ||
      data->samples_metadata.id == 0 || data->logged_metadata.id == 0 ||
      (data->logged_metadata.id != data->samples_metadata.id &&
       data->logged_metadata.id != data->samples_metadata.id + 1) ||
      [3]HashMetricName(data->name) != data->samples_metadata.id) {
    return nullptr;
  }
  return CreateHistogram(data);
}

When the function reaches point [1], the subsequently called function checks whether block->size is greater than or equal to 0x68.If it is, it will return data, which is a pointer to shared memory. The value of data is shared_memory_base + [shared_memory_base + 0x3c] + 0x10. This shared memory is also mapped in other processes, and is categorized based on metrics and types, such as render, GPU, utility, etc.

However, at point [2], when actually obtaining length, it only checks whether block->size is greater than 0x10.

Since this operation involves shared memory, there exists a TOCTOU (Time-of-Check to Time-of-Use) bug here.

If a child process modifies the value of size between points [1] and [2], it can bypass the subsequent check reinterpret_cast<char*>(data)[length - 1] != '\0'. This check is used to ensure that data->name is a null-terminated string.

Before entering function [3], the code calls strlen to get the length of data->name. If data->name is very long and reaches the end of the shared memory, the strlen function will read out-of-bounds into the next heap block to check for a null terminator.

There are three possible scenarios:

  1. The beginning of the next memory region happens to be 0. In this case, the out-of-bounds access does not have much impact.
  2. The next memory region is not yet allocated. An out-of-bounds access by strlen will cause an exception.
  3. The beginning of the next memory region is not 0. In this case, strlen will return a value larger than the actual length of data->name.

In the third scenario, at point [3], the code will call OPENSSL_memcpy(data + n, in, len), which will lead to an out-of-bounds read.

HashMetricName(std::string_view name) --> MD5Sum(as_byte_span(name), &digest) --> MD5(data.data(), data.size(), digest->a.data()) --> MD5_Update --> crypto_md32_update

For this vulnerability patch, I recommend checking if the length is larger 0x68 after obtaining it. The code is as follows:

--- a/base/metrics/persistent_histogram_allocator.cc
+++ b/base/metrics/persistent_histogram_allocator.cc
@@ -328,7 +328,7 @@ std::unique_ptr<HistogramBase> PersistentHistogramAllocator::GetHistogram(
   // Check that metadata is reasonable: name is null-terminated and non-empty,
   // ID fields have been loaded with a hash of the name (0 is considered
   // unset/invalid).
-  if (!data || data->name[0] == '\0' ||
+  if (length < 0x58 || !data || data->name[0] == '\0' ||
       reinterpret_cast<char*>(data)[length - 1] != '\0' ||
       data->samples_metadata.id == 0 || data->logged_metadata.id == 0 ||
       // Note: Sparse histograms use |id + 1| in |logged_metadata|.

Additional Comments

Chrome Version: Version 131.0.6778.20 (Developer Build) (64-bit) commit 5b1aa5623a75aec826e1c812228173345a5065c3 (HEAD -> beta, origin/branch-heads/6778) Operating System: windows10

Summary

TOCTOU in PersistentHistogramAllocator::GetHistogram

Custom Questions

Type of crash:

browser

Crash state:

0:010> p
chrome!std::__Cr::__constexpr_strlen [inlined in chrome!base::PersistentHistogramAllocator::GetHistogram+0xad]:
00007ffc`1e43fc3d e8aebb3b09      call    chrome!strlen (00007ffc`277fb7f0)
0:010> db 000001B1AD9300C0
000001b1`ad9300c0  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad9300d0  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad9300e0  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad9300f0  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad930100  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad930110  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad930120  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad930130  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
0:010> p
(3300.167c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
chrome!strlen+0x31:
00007ffc`277fb821 488b10          mov     rdx,qword ptr [rax] ds:000001b1`adb30000=????????????????
0:010> db 000001B1ADB30000
000001b1`adb30000  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30010  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30020  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30030  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30040  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30050  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30060  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30070  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
0:010> k
 # Child-SP          RetAddr               Call Site
00 00000036`d25fd0b8 00007ffc`1e43fc42     chrome!strlen+0x31 [C:\chromium\src\out\release\minkernel\crts\ucrt\src\appcrt\string\amd64\strlen.asm @ 70] 
01 (Inline Function) --------`--------     chrome!std::__Cr::__constexpr_strlen+0x5 [C:\chromium\src\third_party\libc++\src\include\__string\constexpr_c_functions.h @ 66] 
02 (Inline Function) --------`--------     chrome!std::__Cr::char_traits<char>::length+0x5 [C:\chromium\src\third_party\libc++\src\include\__string\char_traits.h @ 130] 
03 (Inline Function) --------`--------     chrome!std::__Cr::__char_traits_length_checked+0x5 [C:\chromium\src\third_party\libc++\src\include\string_view @ 269] 
04 (Inline Function) --------`--------     chrome!std::__Cr::basic_string_view<char,std::__Cr::char_traits<char> >::basic_string_view+0xa [C:\chromium\src\third_party\libc++\src\include\string_view @ 347] 
05 00000036`d25fd0c0 00007ffc`1e43fb3d     chrome!base::PersistentHistogramAllocator::GetHistogram+0xb2 [C:\chromium\src\base\metrics\persistent_histogram_allocator.cc @ 340] 
06 00000036`d25fd120 00007ffc`2052ed7b     chrome!base::PersistentHistogramAllocator::Iterator::GetNextWithIgnore+0xed [C:\chromium\src\base\metrics\persistent_histogram_allocator.cc @ 314] 
07 (Inline Function) --------`--------     chrome!base::PersistentHistogramAllocator::Iterator::GetNext+0xb [C:\chromium\src\base\metrics\persistent_histogram_allocator.h @ 198] 
08 00000036`d25fd2c0 00007ffc`16da3e98     chrome!metrics::SubprocessMetricsProvider::MergeHistogramDeltasFromAllocator+0x7b [C:\chromium\src\components\metrics\content\subprocess_metrics_provider.cc @ 268] 
09 00000036`d25fd4d0 00007ffc`1e3dfe32     chrome!base::OnceCallback<void ()>::Run+0x58 [C:\chromium\src\base\functional\callback.h @ 156] 
0a 00000036`d25fd550 00007ffc`1e3e0006     chrome!base::internal::PostTaskAndReplyRelay::RunTaskAndPostReply+0x32 [C:\chromium\src\base\threading\post_task_and_reply_impl.h @ 49] 
0b (Inline Function) --------`--------     chrome!base::internal::DecayedFunctorTraits<void (*)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay &&>::Invoke+0x21 [C:\chromium\src\base\functional\bind_internal.h @ 671] 
0c (Inline Function) --------`--------     chrome!base::internal::InvokeHelper<0,base::internal::FunctorTraits<void (*&&)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay &&>,void,0>::MakeItSo+0x21 [C:\chromium\src\base\functional\bind_internal.h @ 930] 
0d (Inline Function) --------`--------     chrome!base::internal::Invoker<base::internal::FunctorTraits<void (*&&)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay &&>,base::internal::BindState<0,1,0,void (*)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay>,void ()>::RunImpl+0x21 [C:\chromium\src\base\functional\bind_internal.h @ 1067] 
0e 00000036`d25fd5e0 00007ffc`16da3e98     chrome!base::internal::Invoker<base::internal::FunctorTraits<void (*&&)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay &&>,base::internal::BindState<0,1,0,void (*)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay>,void ()>::RunOnce+0x36 [C:\chromium\src\base\functional\bind_internal.h @ 980] 
0f 00000036`d25fd660 00007ffc`1e3f7194     chrome!base::OnceCallback<void ()>::Run+0x58 [C:\chromium\src\base\functional\callback.h @ 156] 
10 00000036`d25fd6e0 00007ffc`224e2173     chrome!base::TaskAnnotator::RunTaskImpl+0x154 [C:\chromium\src\base\task\common\task_annotator.cc @ 203] 
11 (Inline Function) --------`--------     chrome!base::TaskAnnotator::RunTask+0x54 [C:\chromium\src\base\task\common\task_annotator.h @ 98] 
12 (Inline Function) --------`--------     chrome!base::internal::TaskTracker::RunTaskImpl+0x78 [C:\chromium\src\base\task\thread_pool\task_tracker.cc @ 677] 
13 00000036`d25fd780 00007ffc`224e14b6     chrome!base::internal::TaskTracker::RunBlockShutdown+0xc3 [C:\chromium\src\base\task\thread_pool\task_tracker.cc @ 670] 
14 (Inline Function) --------`--------     chrome!base::internal::TaskTracker::RunTaskWithShutdownBehavior+0x5b [C:\chromium\src\base\task\thread_pool\task_tracker.cc @ 695] 
15 00000036`d25fd840 00007ffc`224e0c91     chrome!base::internal::TaskTracker::RunTask+0x426 [C:\chromium\src\base\task\thread_pool\task_tracker.cc @ 524] 
16 00000036`d25ff1e0 00007ffc`243741cc     chrome!base::internal::TaskTracker::RunAndPopNextTask+0x2d1 [C:\chromium\src\base\task\thread_pool\task_tracker.cc @ 417] 
17 00000036`d25ff490 00007ffc`24373a28     chrome!base::internal::WorkerThread::RunWorker+0x49c [C:\chromium\src\base\task\thread_pool\worker_thread.cc @ 493] 
18 00000036`d25ff730 00007ffc`1e3864a4     chrome!base::internal::WorkerThread::RunBackgroundPooledWorker+0x18 [C:\chromium\src\base\task\thread_pool\worker_thread.cc @ 385] 
19 00000036`d25ff770 00007ffc`8a387374     chrome!base::`anonymous namespace'::ThreadFunc+0x164 [C:\chromium\src\base\threading\platform_thread_win.cc @ 124] 
1a 00000036`d25ff940 00007ffc`8acbcc91     KERNEL32!BaseThreadInitThunk+0x14
1b 00000036`d25ff970 00000000`00000000     ntdll!RtlUserThreadStart+0x21

Reporter credit:

Xiantong Hou and Pisanbao of Wuheng Lab

Additional Data

Category: Security
Chrome Channel: Dev
Regression: N/A

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

Context

Chrome collects metrics from its child processes (renderer, GPU, utility) through shared memory. Each process writes histograms into a persistent memory allocator, and the browser process later reads them back through base::PersistentHistogramAllocator. The function at the centre of this report, PersistentHistogramAllocator::GetHistogram, takes a reference into that shared memory, validates the histogram metadata, and returns a histogram object.

The bug is a time-of-check to time-of-use (TOCTOU) issue in that validation. Because the memory is shared with a child process, the child can change the size field between the check and the use, and the browser process then reads out of bounds. The report was filed against Chrome and tracked as CVE-2025-0437, an out of bounds read in Metrics.

Setup

  • Chrome version: Version 131.0.6778.20 (Developer Build) (64-bit), commit [redacted] (HEAD -> beta, origin/branch-heads/6778).
  • Operating system: Windows 10.
  • A patched build is required: apply patch_renderer.diff with the --ignore-whitespace argument, then build the release version of Chrome.
  • ASAN on Windows cannot detect this vulnerability, so the report uses WinDbg attached to the broker process to capture the exception.

The report does not include the contents of patch_renderer.diff.

Finding it

The researcher looked at GetHistogram in base/metrics/persistent_histogram_allocator.cc:

Text
std::unique_ptr<HistogramBase> PersistentHistogramAllocator::GetHistogram(
    Reference ref) {
  PersistentHistogramData* data =
      memory_allocator_->GetAsObject<PersistentHistogramData>(ref);[1]
  const size_t length = memory_allocator_->GetAllocSize(ref);[2]

  if (!data || data->name[0] == '\0' ||
      reinterpret_cast<char*>(data)[length - 1] != '\0' ||
      data->samples_metadata.id == 0 || data->logged_metadata.id == 0 ||
      (data->logged_metadata.id != data->samples_metadata.id &&
       data->logged_metadata.id != data->samples_metadata.id + 1) ||
      [3]HashMetricName(data->name) != data->samples_metadata.id) {
    return nullptr;
  }
  return CreateHistogram(data);
}

At point [1], the function called by GetAsObject checks whether block->size is greater than or equal to 0x68. If it is, it returns data, a pointer into shared memory. The value of data is shared_memory_base + [shared_memory_base + 0x3c] + 0x10. That shared memory is also mapped in other processes and is categorised by metrics and type, such as render, GPU and utility.

At point [2], when length is obtained, the allocator only checks whether block->size is greater than 0x10. The two checks use different thresholds on the same shared field, and that gap is the bug: a child process can change size between the two points.

If the child modifies size between [1] and [2], it can bypass the later check reinterpret_cast<char*>(data)[length - 1] != '\0', which exists to ensure data->name is a null-terminated string. Before point [3], the code calls strlen to get the length of data->name. If data->name is very long and reaches the end of the shared memory, strlen reads out of bounds into the next heap block looking for a null terminator.

The report describes three possible outcomes:

  1. The beginning of the next memory region happens to be 0. The out of bounds access then has little impact.
  2. The next memory region is not yet allocated. The out of bounds access by strlen causes an exception.
  3. The beginning of the next memory region is not 0. strlen then returns a value larger than the actual length of data->name.

In the third case, at point [3] the code calls OPENSSL_memcpy(data + n, in, len), which leads to an out of bounds read. The call chain from HashMetricName down to the copy is:

Text
HashMetricName(std::string_view name) --> MD5Sum(as_byte_span(name), &digest) --> MD5(data.data(), data.size(), digest->a.data()) --> MD5_Update -->  [crypto_md32_update]

The report links crypto_md32_update to third_party/boringssl/src/crypto/fipsmodule/digest/md32_common.h at line 127.

Exploitation

Step 1: apply the patch and build

Apply patch_renderer.diff with --ignore-whitespace and build the release version of Chrome. The patch contents are not shown in the report.

Step 2: start Chrome and open a tab

Start the built Chrome, open a new tab and visit any URL.

Step 3: close the tab

Close the tab. If the issue does not trigger, repeat the cycle of opening a new tab, visiting a URL and closing the tab. The trigger is a TOCTOU race, so it is probabilistic: the report says closing the page gives a chance of triggering it, not a guarantee.

Step 4: capture the exception

ASAN on Windows cannot detect this vulnerability. Attach WinDbg to the broker process and perform the steps above to capture the exception. The report notes that the vulnerability can be triggered through processes such as render, GPU and utility to cause a crash in the broker process; the demonstration uses the renderer.

The captured crash state shows strlen called from GetHistogram:

Text
0:010> p
chrome!std::__Cr::__constexpr_strlen [inlined in chrome!base::PersistentHistogramAllocator::GetHistogram+0xad]:
00007ffc`1e43fc3d e8aebb3b09      call    chrome!strlen (00007ffc`277fb7f0)
0:010> db 000001B1AD9300C0
000001b1`ad9300c0  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad9300d0  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad9300e0  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad9300f0  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad930100  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad930110  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad930120  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad930130  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
0:010> p
(3300.167c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
chrome!strlen+0x31:
00007ffc`277fb821 488b10          mov     rdx,qword ptr [rax] ds:000001b1`adb30000=????????????????
0:010> db 000001B1ADB30000
000001b1`adb30000  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30010  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30020  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30030  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30040  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30050  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30060  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30070  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
0:010> k
 # Child-SP          RetAddr               Call Site
00 00000036`d25fd0b8 00007ffc`1e43fc42     chrome!strlen+0x31 [C:\chromium\src\out\release\minkernel\crts\ucrt\src\appcrt\string\amd64\strlen.asm @ 70]
01 (Inline Function) --------`--------     chrome!std::__Cr::__constexpr_strlen+0x5 [C:\chromium\src\third_party\libc++\src\include\__string\constexpr_c_functions.h @ 66]
02 (Inline Function) --------`--------     chrome!std::__Cr::char_traits<char>::length+0x5 [C:\chromium\src\third_party\libc++\src\include\__string\char_traits.h @ 130]
03 (Inline Function) --------`--------     chrome!std::__Cr::__char_traits_length_checked+0x5 [C:\chromium\src\third_party\libc++\src\include\string_view @ 269]
04 (Inline Function) --------`--------     chrome!std::__Cr::basic_string_view<char,std::__Cr::char_traits<char> >::basic_string_view+0xa [C:\chromium\src\third_party\libc++\src\include\string_view @ 347]
05 00000036`d25fd0c0 00007ffc`1e43fb3d     chrome!base::PersistentHistogramAllocator::GetHistogram+0xb2 [C:\chromium\src\base\metrics\persistent_histogram_allocator.cc @ 340]
06 00000036`d25fd120 00007ffc`2052ed7b     chrome!base::PersistentHistogramAllocator::Iterator::GetNextWithIgnore+0xed [C:\chromium\src\base\metrics\persistent_histogram_allocator.cc @ 314]
07 (Inline Function) --------`--------     chrome!base::PersistentHistogramAllocator::Iterator::GetNext+0xb [C:\chromium\src\base\metrics\persistent_histogram_allocator.h @ 198]
08 00000036`d25fd2c0 00007ffc`16da3e98     chrome!metrics::SubprocessMetricsProvider::MergeHistogramDeltasFromAllocator+0x7b [C:\chromium\src\components\metrics\content\subprocess_metrics_provider.cc @ 268]
09 00000036`d25fd4d0 00007ffc`1e3dfe32     chrome!base::OnceCallback<void ()>::Run+0x58 [C:\chromium\src\base\functional\callback.h @ 156]
0a 00000036`d25fd550 00007ffc`1e3e0006     chrome!base::internal::PostTaskAndReplyRelay::RunTaskAndPostReply+0x32 [C:\chromium\src\base\threading\post_task_and_reply_impl.h @ 49]
0b (Inline Function) --------`--------     chrome!base::internal::DecayedFunctorTraits<void (*)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay &&>::Invoke+0x21 [C:\chromium\src\base\functional\bind_internal.h @ 671]
0c (Inline Function) --------`--------     chrome!base::internal::InvokeHelper<0,base::internal::FunctorTraits<void (*&&)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay &&>,void,0>::MakeItSo+0x21 [C:\chromium\src\base\functional\bind_internal.h @ 930]
0d (Inline Function) --------`--------     chrome!base::internal::Invoker<base::internal::FunctorTraits<void (*&&)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay &&>,base::internal::BindState<0,1,0,void (*)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay>,void ()>::RunImpl+0x21 [C:\chromium\src\base\functional\bind_internal.h @ 1067]
0e 00000036`d25fd5e0 00007ffc`16da3e98     chrome!base::internal::Invoker<base::internal::FunctorTraits<void (*&&)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay &&>,base::internal::BindState<0,1,0,void (*)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay>,void ()>::RunOnce+0x36 [C:\chromium\src\base\functional\bind_internal.h @ 980]
0f 00000036`d25fd660 00007ffc`1e3f7194     chrome!base::OnceCallback<void ()>::Run+0x58 [C:\chromium\src\base\functional\callback.h @ 156]
10 00000036`d25fd6e0 00007ffc`224e2173     chrome!base::TaskAnnotator::RunTaskImpl+0x154 [C:\chromium\src\base\task\common\task_annotator.cc @ 203]
11 (Inline Function) --------`--------     chrome!base::TaskAnnotator::RunTask+0x54 [C:\chromium\src\base\task\common\task_annotator.h @ 98]
12 (Inline Function) --------`--------     chrome!base::internal::TaskTracker::RunTaskImpl+0x78 [C:\chromium\src\base\task\thread_pool\task_tracker.cc @ 677]
13 00000036`d25fd780 00007ffc`224e14b6     chrome!base::internal::TaskTracker::RunBlockShutdown+0xc3 [C:\chromium\src\base\task\thread_pool\task_tracker.cc @ 670]
14 (Inline Fu

The dump at 000001b1ad9300c0is the histogram name, a run of0x61 bytes (a), with no terminator inside the region shown. Stepping again faults inside strlenatchrome!strlen+0x31, reading qword ptr [rax]from000001b1adb30000, which the dump shows as unreadable (??). The stack shows the path from SubprocessMetricsProvider::MergeHistogramDeltasFromAllocator through PersistentHistogramAllocator::Iterator::GetNextWithIgnore into GetHistogram at persistent_histogram_allocator.cc line 340, with strlen reached through the std::string_view construction for data->name.

Root cause

GetAsObject accepts a block when block->size >= 0x68, but GetAllocSize only requires block->size > 0x10. Both read the same size field in shared memory, which a child process can modify. A child that changes size between the two calls can make length small enough that the data[length - 1] != '\0' check passes while the name itself is not terminated within the block. strlen then walks past the end of the block.

The null-terminator check fails because it trusts a length that can change after the object was validated. The report does not describe any other mitigation that was in place.

Impact

The report describes an out of bounds read in the browser (broker) process, reachable from render, GPU and utility processes, and demonstrated from the renderer. The immediate observable effect is a crash of the broker process. In the third scenario, where the next region is readable and not zero, strlen returns an inflated length and OPENSSL_memcpy reads further out of bounds; the report does not claim any specific data disclosure beyond that read.

Triggering requires a child process able to modify the shared metrics memory; the demonstration uses a patched renderer build. and the race is probabilistic, so repeated tab open, visit and close cycles may be needed.

Fix

The report recommends checking that length is larger than 0x68 after obtaining it, and supplies this patch:

Text
--- a/base/metrics/persistent_histogram_allocator.cc
+++ b/base/metrics/persistent_histogram_allocator.cc
@@ -328,7 +328,7 @@ std::unique_ptr<HistogramBase> PersistentHistogramAllocator::GetHistogram(
   // Check that metadata is reasonable: name is null-terminated and non-empty,
   // ID fields have been loaded with a hash of the name (0 is considered
   // unset/invalid).
-  if (!data || data->name[0] == '\0' ||
+  if (length < 0x58 || !data || data->name[0] == '\0' ||
       reinterpret_cast<char*>(data)[length - 1] != '\0' ||
       data->samples_metadata.id == 0 || data->logged_metadata.id == 0 ||
       // Note: Sparse histograms use |id + 1| in |logged_metadata|.

Note that the recommended threshold in the patch (0x58) differs from the 0x68 used by GetAsObject and mentioned in the surrounding text. The report does not explain the difference.

Variants to test

  • Other consumers of the same persistent memory allocator: look for functions that call GetAsObject and then a separate size lookup, and check whether the two use the same threshold. A positive result is a size field that can be changed between the calls and a later length-based read or copy.
  • Other shared-memory structures written by child processes and parsed by the browser: any field used both for validation and for a later length or offset. A positive result is a validation that passes with one value and a use that reads with another.
  • Null-terminated string handling on shared buffers: check whether strlen or string_view construction happens before the terminator is verified within the block. A positive result is a name that runs to the end of the mapping and a fault or inflated length in the reader.
  • Race windows around GetAllocSize in other allocator users: repeat open, visit and close cycles under a debugger attached to the broker process, since the trigger is timing dependent and may need many attempts.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 18 min read.

What happened, in plain words

Chrome is not one program. It is a small team of programs working together. One program, the browser process (also called the broker), runs the windows, the tabs and the menus. Other programs, called child processes, do the heavy and risky work: drawing pages (renderer), talking to the graphics card (GPU), and running background jobs (utility). Keeping them apart is a safety measure: if a page crashes its renderer, the rest of Chrome keeps running.

These programs need to share information. Chrome keeps metrics, which are simple counters and measurements such as "how long did this page take to load". The child processes write their metrics into a piece of memory that several programs can see at once, called shared memory. Later the browser process reads those metrics back.

The bug in this report is in the reading-back step. The browser process checks a value in that shared memory, then uses it a moment later. Because a child process can also write to the same memory, it can change the value in the gap between the check and the use. Security people call this a time-of-check to time-of-use bug, or TOCTOU. The result here is that the browser process reads past the end of a buffer, an out of bounds read, and can crash. The issue was tracked as CVE-2025-0437.

A useful everyday comparison: a bouncer checks your ticket at the door, then you walk to the bar. If someone can swap your ticket for a different one while you walk, the check at the door no longer describes what you carry when you order. The check happened, but it happened too early.

Context

Chrome collects metrics from its child processes (renderer, GPU, utility) through shared memory. Each process writes histograms into a persistent memory allocator. A histogram is a table that counts how often each value occurred, for example how many pages loaded in under a second. The browser process later reads them back through base::PersistentHistogramAllocator, a piece of Chrome code whose job is to manage that shared metrics memory.

The function at the centre of this report, PersistentHistogramAllocator::GetHistogram, takes a reference into that shared memory, validates the histogram metadata, and returns a histogram object. A reference here is a small handle that says where in the shared memory a particular histogram lives, rather like a locker number rather than the locker key.

The bug is a TOCTOU issue in that validation. Because the memory is shared with a child process, the child can change the size field between the check and the use, and the browser process then reads out of bounds. The report was filed against Chrome and tracked as CVE-2025-0437, an out of bounds read in Metrics.

Setup

  • Chrome version: Version 131.0.6778.20 (Developer Build) (64-bit), commit [redacted] (HEAD -> beta, origin/branch-heads/6778).
  • Operating system: Windows 10.
  • A patched build is required: apply patch_renderer.diff with the --ignore-whitespace argument, then build the release version of Chrome.
  • ASAN on Windows cannot detect this vulnerability, so the report uses WinDbg attached to the broker process to capture the exception.

A few words on that list. A commit is a saved snapshot of a code project, identified by a long string of letters and numbers; the one above names the exact state of the Chrome source that was tested. A patch is a small file describing edits to source code, and patch_renderer.diff is the one used here to make the renderer behave in the way needed to reach the bug. The --ignore-whitespace argument tells the patching tool not to worry about differences in spaces and tabs. A release build is a version compiled for normal use, as opposed to a debug build full of extra checks.

ASAN (AddressSanitizer) is a tool built into some builds that watches memory accesses and shouts when a program reads or writes outside a buffer. On Windows it cannot detect this particular vulnerability, which is why the researcher used WinDbg instead. WinDbg is Microsoft's debugger: a program that can pause another program, inspect its memory and show where it crashed. The broker process is the browser process described above.

The report does not include the contents of patch_renderer.diff.

Finding it

The researcher looked at GetHistogram in base/metrics/persistent_histogram_allocator.cc:

Text
std::unique_ptr<HistogramBase> PersistentHistogramAllocator::GetHistogram(
    Reference ref) {
  PersistentHistogramData* data =
      memory_allocator_->GetAsObject<PersistentHistogramData>(ref);[1]
  const size_t length = memory_allocator_->GetAllocSize(ref);[2]

  if (!data || data->name[0] == '\0' ||
      reinterpret_cast<char*>(data)[length - 1] != '\0' ||
      data->samples_metadata.id == 0 || data->logged_metadata.id == 0 ||
      (data->logged_metadata.id != data->samples_metadata.id &&
       data->logged_metadata.id != data->samples_metadata.id + 1) ||
      [3]HashMetricName(data->name) != data->samples_metadata.id) {
    return nullptr;
  }
  return CreateHistogram(data);
}

Line by line, in plain words:

  1. std::unique_ptr<HistogramBase> PersistentHistogramAllocator::GetHistogram(Reference ref) { declares a function called GetHistogram that takes a reference and returns a histogram object. std::unique_ptr is a C++ wrapper that automatically frees the object when nobody needs it any more, like a library book that returns itself.
  2. PersistentHistogramData* data = memory_allocator_->GetAsObject<PersistentHistogramData>(ref);[1] asks the memory allocator to turn the reference into a pointer to the histogram data. A pointer is a memory address, the numeric location of a byte in memory. The [1] is a marker the researcher added so the text can refer back to this spot.
  3. const size_t length = memory_allocator_->GetAllocSize(ref);[2] asks how big the allocated block is and stores it in length. size_t is an unsigned whole number type used for sizes. The [2] marks the second point of interest.
  4. The if (...) block is a series of sanity checks. If any of them fails, the function returns nullptr, meaning "nothing", and the caller skips this histogram.
  5. !data means the pointer is empty, so there is nothing to read.
  6. data->name[0] == '\0' means the name starts with a null byte, so the name is empty. A null byte (written \0) is a byte with value zero; C and C++ use it to mark the end of a text string.
  7. reinterpret_cast<char*>(data)[length - 1] != '\0' looks at the last byte of the block and complains if it is not a null byte. This is the check meant to guarantee the name ends inside the block.
  8. The samples_metadata.id and logged_metadata.id comparisons check that the two stored identifiers are present and consistent with each other.
  9. [3]HashMetricName(data->name) != data->samples_metadata.id recomputes a hash of the name and compares it with the stored identifier. A hash is a short fingerprint computed from data; the same input always gives the same fingerprint, and a different input almost always gives a different one. The [3] marks the third point of interest.
  10. return CreateHistogram(data); builds and returns the histogram object when every check passed.

At point [1], the function called by GetAsObject checks whether block->size is greater than or equal to 0x68. If it is, it returns data, a pointer into shared memory. The value of data is shared_memory_base + [shared_memory_base + 0x3c] + 0x10. That shared memory is also mapped in other processes and is categorised by metrics and type, such as render, GPU and utility.

Unpacking that: 0x68 and 0x3c and 0x10 are hexadecimal numbers, a base-16 way of writing numbers that programmers use because it lines up neatly with bytes. 0x68 is 104 in ordinary decimal, 0x3c is 60 and 0x10 is 16. block->size is a size field stored inside the shared memory block itself. "Mapped" means the same physical memory appears at an address in more than one process, so a write by one process is visible to the others.

At point [2], when length is obtained, the allocator only checks whether block->size is greater than 0x10. The two checks use different thresholds on the same shared field, and that gap is the bug: a child process can change size between the two points.

If the child modifies size between [1] and [2], it can bypass the later check reinterpret_cast<char*>(data)[length - 1] != '\0', which exists to ensure data->name is a null-terminated string. A null-terminated string is text stored as bytes followed by a zero byte, so the reader knows where it stops. If the child changes size after the first check, the terminator check can be bypassed even though the real name keeps going past the block.

Before point [3], the code calls strlen to get the length of data->name. strlen is a standard C function that counts bytes until it finds a zero byte. If data->name is very long and reaches the end of the shared memory, strlen reads out of bounds into the next heap block looking for a null terminator. A heap is the general-purpose pool of memory a program uses for objects created while it runs; blocks sit next to each other, so reading past one block lands in whatever comes next.

The report describes three possible outcomes:

  1. The beginning of the next memory region happens to be 0. The out of bounds access then has little impact.
  2. The next memory region is not yet allocated. The out of bounds access by strlen causes an exception.
  3. The beginning of the next memory region is not 0. strlen then returns a value larger than the actual length of data->name.

An exception here means the processor refuses the access and the program is interrupted, which in practice is a crash. In the third case, at point [3] the code calls OPENSSL_memcpy(data + n, in, len), which leads to an out of bounds read. memcpy copies a given number of bytes from one place to another; if the number is too large, it reads past the end of the source. The call chain from HashMetricName down to the copy is:

Text
HashMetricName(std::string_view name) --> MD5Sum(as_byte_span(name), &digest) --> MD5(data.data(), data.size(), digest->a.data()) --> MD5_Update -->  [crypto_md32_update]

Read left to right, each arrow means "calls". HashMetricName receives the name as a std::string_view, which is a lightweight view of a string that does not copy it. It calls MD5Sum, which calls MD5, which calls MD5_Update, which reaches crypto_md32_update. MD5 is a well-known hash function, the same family of idea as the fingerprint mentioned earlier. The report links crypto_md32_update to third_party/boringssl/src/crypto/fipsmodule/digest/md32_common.h at line 127. BoringSSL is the cryptography library Chrome uses.

Exploitation

Step 1: apply the patch and build

Apply patch_renderer.diff with --ignore-whitespace and build the release version of Chrome. The patch contents are not shown in the report.

Step 2: start Chrome and open a tab

Start the built Chrome, open a new tab and visit any URL.

Step 3: close the tab

Close the tab. If the issue does not trigger, repeat the cycle of opening a new tab, visiting a URL and closing the tab. The trigger is a TOCTOU race, so it is probabilistic: the report says closing the page gives a chance of triggering it, not a guarantee.

A race here means the outcome depends on exact timing: the child has to change the size field in the tiny window between the two checks.

Step 4: capture the exception

ASAN on Windows cannot detect this vulnerability. Attach WinDbg to the broker process and perform the steps above to capture the exception. The report notes that the vulnerability can be triggered through processes such as render, GPU and utility to cause a crash in the broker process; the demonstration uses the renderer.

The captured crash state shows strlen called from GetHistogram:

Text
0:010> p
chrome!std::__Cr::__constexpr_strlen [inlined in chrome!base::PersistentHistogramAllocator::GetHistogram+0xad]:
00007ffc`1e43fc3d e8aebb3b09      call    chrome!strlen (00007ffc`277fb7f0)
0:010> db 000001B1AD9300C0
000001b1`ad9300c0  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad9300d0  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad9300e0  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad9300f0  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad930100  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad930110  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad930120  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
000001b1`ad930130  61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61  aaaaaaaaaaaaaaaa
0:010> p
(3300.167c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
chrome!strlen+0x31:
00007ffc`277fb821 488b10          mov     rdx,qword ptr [rax] ds:000001b1`adb30000=????????????????
0:010> db 000001B1ADB30000
000001b1`adb30000  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30010  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30020  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30030  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30040  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30050  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30060  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
000001b1`adb30070  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
0:010> k
 # Child-SP          RetAddr               Call Site
00 00000036`d25fd0b8 00007ffc`1e43fc42     chrome!strlen+0x31 [C:\chromium\src\out\release\minkernel\crts\ucrt\src\appcrt\string\amd64\strlen.asm @ 70]
01 (Inline Function) --------`--------     chrome!std::__Cr::__constexpr_strlen+0x5 [C:\chromium\src\third_party\libc++\src\include\__string\constexpr_c_functions.h @ 66]
02 (Inline Function) --------`--------     chrome!std::__Cr::char_traits<char>::length+0x5 [C:\chromium\src\third_party\libc++\src\include\__string\char_traits.h @ 130]
03 (Inline Function) --------`--------     chrome!std::__Cr::__char_traits_length_checked+0x5 [C:\chromium\src\third_party\libc++\src\include\string_view @ 269]
04 (Inline Function) --------`--------     chrome!std::__Cr::basic_string_view<char,std::__Cr::char_traits<char> >::basic_string_view+0xa [C:\chromium\src\third_party\libc++\src\include\string_view @ 347]
05 00000036`d25fd0c0 00007ffc`1e43fb3d     chrome!base::PersistentHistogramAllocator::GetHistogram+0xb2 [C:\chromium\src\base\metrics\persistent_histogram_allocator.cc @ 340]
06 00000036`d25fd120 00007ffc`2052ed7b     chrome!base::PersistentHistogramAllocator::Iterator::GetNextWithIgnore+0xed [C:\chromium\src\base\metrics\persistent_histogram_allocator.cc @ 314]
07 (Inline Function) --------`--------     chrome!base::PersistentHistogramAllocator::Iterator::GetNext+0xb [C:\chromium\src\base\metrics\persistent_histogram_allocator.h @ 198]
08 00000036`d25fd2c0 00007ffc`16da3e98     chrome!metrics::SubprocessMetricsProvider::MergeHistogramDeltasFromAllocator+0x7b [C:\chromium\src\components\metrics\content\subprocess_metrics_provider.cc @ 268]
09 00000036`d25fd4d0 00007ffc`1e3dfe32     chrome!base::OnceCallback<void ()>::Run+0x58 [C:\chromium\src\base\functional\callback.h @ 156]
0a 00000036`d25fd550 00007ffc`1e3e0006     chrome!base::internal::PostTaskAndReplyRelay::RunTaskAndPostReply+0x32 [C:\chromium\src\base\threading\post_task_and_reply_impl.h @ 49]
0b (Inline Function) --------`--------     chrome!base::internal::DecayedFunctorTraits<void (*)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay &&>::Invoke+0x21 [C:\chromium\src\base\functional\bind_internal.h @ 671]
0c (Inline Function) --------`--------     chrome!base::internal::InvokeHelper<0,base::internal::FunctorTraits<void (*&&)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay &&>,void,0>::MakeItSo+0x21 [C:\chromium\src\base\functional\bind_internal.h @ 930]
0d (Inline Function) --------`--------     chrome!base::internal::Invoker<base::internal::FunctorTraits<void (*&&)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay &&>,base::internal::BindState<0,1,0,void (*)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay>,void ()>::RunImpl+0x21 [C:\chromium\src\base\functional\bind_internal.h @ 1067]
0e 00000036`d25fd5e0 00007ffc`16da3e98     chrome!base::internal::Invoker<base::internal::FunctorTraits<void (*&&)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay &&>,base::internal::BindState<0,1,0,void (*)(base::internal::PostTaskAndReplyRelay),base::internal::PostTaskAndReplyRelay>,void ()>::RunOnce+0x36 [C:\chromium\src\base\functional\bind_internal.h @ 980]
0f 00000036`d25fd660 00007ffc`1e3f7194     chrome!base::OnceCallback<void ()>::Run+0x58 [C:\chromium\src\base\functional\callback.h @ 156]
10 00000036`d25fd6e0 00007ffc`224e2173     chrome!base::TaskAnnotator::RunTaskImpl+0x154 [C:\chromium\src\base\task\common\task_annotator.cc @ 203]
11 (Inline Function) --------`--------     chrome!base::TaskAnnotator::RunTask+0x54 [C:\chromium\src\base\task\common\task_annotator.h @ 98]
12 (Inline Function) --------`--------     chrome!base::internal::TaskTracker::RunTaskImpl+0x78 [C:\chromium\src\base\task\thread_pool\task_tracker.cc @ 677]
13 00000036`d25fd780 00007ffc`224e14b6     chrome!base::internal::TaskTracker::RunBlockShutdown+0xc3 [C:\chromium\src\base\task\thread_pool\task_tracker.cc @ 670]
14 (Inline Fu

This is a WinDbg session. The 0:010> prompt means the debugger is waiting for a command. p means "step one instruction and show where we are". db means "display bytes" at the address given. k means "show the call stack", the list of functions that led to the current point, newest at the top.

The first p stops just before a call to strlen, inside GetHistogram. The db at 000001b1ad9300c0shows the histogram name: a run of0x61bytes, which is the lettera`, with no terminator inside the region shown. That is the hostile name that runs to the end of its block.

Stepping again faults inside strlen at chrome!strlen+0x31, reading qword ptr [rax] from 000001b1adb30000, which the dump shows as unreadable (??). qword ptr [rax]means "an eight-byte value at the address held in the registerrax". The Access violation - code c0000005` line is Windows saying the program touched memory it is not allowed to touch.

The stack shows the path from SubprocessMetricsProvider::MergeHistogramDeltasFromAllocator through PersistentHistogramAllocator::Iterator::GetNextWithIgnore into GetHistogram at persistent_histogram_allocator.cc line 340, with strlen reached through the std::string_view construction for data->name. In plain words: a background task asked the metrics provider to merge the child's numbers, the provider walked the list of histograms, reached this one, and the name-length calculation ran off the end.

Root cause

GetAsObject accepts a block when block->size >= 0x68, but GetAllocSize only requires block->size > 0x10. Both read the same size field in shared memory, which a child process can modify. A child that changes size between the two calls can make length small enough that the data[length - 1] != '\0' check passes while the name itself is not terminated within the block. strlen then walks past the end of the block.

The null-terminator check fails because it trusts a length that can change after the object was validated. The report does not describe any other mitigation that was in place.

Impact

The report describes an out of bounds read in the browser (broker) process, reachable from render, GPU and utility processes, and demonstrated from the renderer. The immediate observable effect is a crash of the broker process. In the third scenario, where the next region is readable and not zero, strlen returns an inflated length and OPENSSL_memcpy reads further out of bounds; the report does not claim any specific data disclosure beyond that read.

Triggering requires a child process able to modify the shared metrics memory; the demonstration uses a patched renderer build. and the race is probabilistic, so repeated tab open, visit and close cycles may be needed.

Fix

The report recommends checking that length is larger than 0x68 after obtaining it, and supplies this patch:

Text
--- a/base/metrics/persistent_histogram_allocator.cc
+++ b/base/metrics/persistent_histogram_allocator.cc
@@ -328,7 +328,7 @@ std::unique_ptr<HistogramBase> PersistentHistogramAllocator::GetHistogram(
   // Check that metadata is reasonable: name is null-terminated and non-empty,
   // ID fields have been loaded with a hash of the name (0 is considered
   // unset/invalid).
-  if (!data || data->name[0] == '\0' ||
+  if (length < 0x58 || !data || data->name[0] == '\0' ||
       reinterpret_cast<char*>(data)[length - 1] != '\0' ||
       data->samples_metadata.id == 0 || data->logged_metadata.id == 0 ||
       // Note: Sparse histograms use |id + 1| in |logged_metadata|.

This is a diff, the standard format for showing changes to a file. The lines starting with --- and +++ name the old and new file. The @@ line says which lines are affected. A line starting with - is removed and a line starting with + is added; the rest is unchanged context. The change adds one condition at the front of the if: length < 0x58 ||. In plain words, if the block is smaller than 0x58 bytes, reject the histogram before doing anything else. Because length is now checked against a minimum, a child that shrinks the size field cannot make the later terminator check pass on a block that is too small to hold a real name.

Note that the recommended threshold in the patch (0x58) differs from the 0x68 used by GetAsObject and mentioned in the surrounding text. The report does not explain the difference.

Variants to test

These are ideas for finding similar bugs elsewhere, written for someone learning how researchers generalise from one finding.

  • Other consumers of the same persistent memory allocator: look for functions that call GetAsObject and then a separate size lookup, and check whether the two use the same threshold. A positive result is a size field that can be changed between the calls and a later length-based read or copy.
  • Other shared-memory structures written by child processes and parsed by the browser: any field used both for validation and for a later length or offset. A positive result is a validation that passes with one value and a use that reads with another.
  • Null-terminated string handling on shared buffers: check whether strlen or string_view construction happens before the terminator is verified within the block. A positive result is a name that runs to the end of the mapping and a fault or inflated length in the reader.
  • Race windows around GetAllocSize in other allocator users: repeat open, visit and close cycles under a debugger attached to the broker process, since the trigger is timing dependent and may need many attempts.

Glossary

  • ASAN (AddressSanitizer): a tool built into some program builds that detects reads and writes outside allocated memory.
  • BoringSSL: the cryptography library used by Chrome.
  • Broker process: another name for the Chrome browser process, the one that coordinates tabs and child processes.
  • Browser process: the main Chrome program that runs the interface and manages child processes.
  • Child process: a separate program started by Chrome to do work such as rendering pages, talking to the GPU or running background jobs.
  • Commit: a saved snapshot of a code project, identified by a long string.
  • CVE: a public identifier for a known security vulnerability.
  • Denial of service: a failure that stops a program or service from working for its users.
  • Diff: a text format showing lines added to and removed from a file.
  • Exception: an interruption raised when a program does something invalid, such as touching memory it may not touch; often results in a crash.
  • GPU process: the Chrome child process that handles graphics work.
  • Hash: a short fingerprint computed from data, used to identify or compare it.
  • Heap: the pool of memory a program uses for objects created while it runs.
  • Hexadecimal: a base-16 way of writing numbers, common in programming; 0x68 is 104 in decimal.
  • Histogram: a table counting how often each value occurred.
  • MD5: a well-known hash function.
  • Metrics: measurements and counters a program records about its own behaviour.
  • Mapped memory: memory made visible at an address in more than one process at once.
  • Null byte: a byte with value zero, written \0, used to mark the end of a text string.
  • Null-terminated string: text stored as bytes followed by a zero byte so the reader knows where it ends.
  • Out of bounds read: reading memory outside the buffer the program intended to read.
  • Patch: a file describing edits to source code.
  • Pointer: a numeric memory address identifying where a value is stored.
  • Race: a situation where the outcome depends on exact timing between two actors.
  • Reference: a small handle identifying where an object lives, rather than the object itself.
  • Release build: a version of a program compiled for normal use, without debug-only checks.
  • Renderer: the Chrome child process that turns a web page into what you see.
  • Shared memory: a region of memory visible to more than one process at the same time.
  • strlen: a standard C function that counts bytes until it finds a zero byte.
  • TOCTOU (time-of-check to time-of-use): a bug where a value is checked and then used later, and can change in between.
  • Utility process: a Chrome child process that runs background jobs.
  • WinDbg: Microsoft's debugger for pausing programs, inspecting memory and showing crashes.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.