Integer overflow in WebML (CVE-2026-5859)
The WebNN TFLite XNNPACK backend fails to bound the product of attacker-supplied Pool2d window dimensions, so a 64-bit size calculation overflows and a smaller-than-needed indirection buffer is allocated. A later initialisation loop still uses the original kernel dimensions and writes pointers past the end of that buffer, giving a heap out-of-bounds write in the GPU process.
- Fix shipped in 20 days
VULNERABILITY DETAILS
An integer overflow vulnerability exists in the WebNN TFLite XNNPACK backend when processing Pool2d operations, leading to heap out-of-bounds write.
The root cause resides in the WebNN frontend graph validation ValidatePool2dAndInferOutput. It reads windowDimensions into uint32_t window_height and window_width without restricting their maximum product [0].
uint32_t window_height = input_height;
uint32_t window_width = input_width;
if (attributes.window_dimensions) {
if (attributes.window_dimensions->height == 0 ||
attributes.window_dimensions->width == 0) {
return base::unexpected(ErrorWithLabel(
label, "All window dimensions should be greater than 0."));
}
window_height = attributes.window_dimensions->height;
window_width = attributes.window_dimensions->width; // [0]
These unchecked values flow down to the XNNPACK engine where they are used to compute pooling_size [1]. By supplying large windowDimensions (e.g. 1000092567 and 1152814792), the 64-bit unsigned product pooling_size can overflow the 2^60 boundary.
Later, XNNPACK calculates step_height [2] and subsequently indirection_buffer_size [3]. Crucially, indirection_buffer_size multiplies (pooling_size - 1) + ... by sizeof(void*) (8 bytes). This multiplication by 8 overflows the 64-bit size_t variable, causing the resulting allocation size to wrap around to a small number.
As a result, xnn_reallocate_memory allocates a smaller buffer than required [4].
const size_t pooling_height = max_pooling_op->convolution_op->kernel_height;
const size_t pooling_width = max_pooling_op->convolution_op->kernel_width;
const size_t pooling_size = pooling_height * pooling_width; // [1]
const size_t output_height = max_pooling_op->convolution_op->output_height;
const size_t output_width = max_pooling_op->convolution_op->output_width;
const size_t step_width =
max_pooling_op->convolution_op->dilation_width > 1 ? pooling_width : min(max_pooling_op->convolution_op->stride_width, pooling_width);
const size_t step_height = pooling_size + (output_width - 1) * step_width * pooling_height; // [2]
if (input_height != max_pooling_op->convolution_op->last_input_height ||
input_width != max_pooling_op->convolution_op->last_input_width ||
channels != max_pooling_op->convolution_op->last_input_channels)
{
const size_t indirection_buffer_size = sizeof(void*) * ((pooling_size - 1) + output_height * step_height); // [3]
const void** indirection_buffer =
(const void**) xnn_reallocate_memory(max_pooling_op->convolution_op->indirection_buffer, indirection_buffer_size); // [4]
However, the memory initialization loop logic relies on the original kernel_height and kernel_width [5], causing the loop to iterate and write out-of-bounds pointers into the indirection_buffer [6].
for (size_t output_x = 0; output_x < output_width; output_x++) {
for (size_t pooling_x = 0; pooling_x < kernel_width; pooling_x++) { // [5]
const size_t input_x = min(doz(output_x * stride_width + pooling_x * dilation_width, input_padding_left), input_x_max);
const size_t index = output_y * step_height + output_x * step_width * kernel_height + pooling_x * kernel_height + pooling_y;
indirection_buffer[index] = (const void*) ((uintptr_t) input + (input_y * input_width + input_x) * input_pixel_stride); // [6]
}
}
BISECTION
Introduced by XNNPACK upstream commit https://github.com/google/XNNPACK/commit/fae4eb257a2cf76c243d7a0cd123303f0e27ad2c (Rewrite maxpool kernels) which replaced the bounded tile constant with the attacker-controlled pooling size when calculating the indirection buffer size.
This regression was rolled into Chromium in commit https://chromium.googlesource.com/chromium/src/+/85fc641cf32e5687c9384f35053e1d3d3f4eea5a (Roll TFLite to Next Green Version).
VERSION
Chrome Version: HEAD
Operating System: Linux
REPRODUCTION CASE
- Build Chromium with Asan.
- Host the
poc.htmlon an HTTP server. - Run Chrome against the PoC.
$ python3 -m http.server
$ ./out/asan/chrome --enable-features=WebMachineLearningNeuralNetwork "http://localhost:8000/poc.html"
CRASH INFORMATION
Type of crash: GPU process
Crash log: see the attached asan.txt ASan trace.
SUGGESTED FIX
Add a base::CheckedNumeric<uint32_t> multiplication check to ValidatePool2dAndInferOutput.
See fix.patch for details.
CREDIT INFORMATION
Reporter credit: Anonymous
Context
This report describes an integer overflow in the WebNN TFLite XNNPACK backend of Google Chrome, tracked as CVE-2026-5859. The affected component is WebML, specifically the WebNN path that validates Pool2d operations and then hands them to the XNNPACK engine. The weakness class is integer overflow, and the report rates it critical. The platform records a bounty of 43,000 USD, the researcher as Anonymous, and disclosure on 2026-04-07. The report itself does not describe the bounty, the disclosure process or the researcher beyond the credit line "Reporter credit: Anonymous".
WebNN is the browser API that lets a web page describe neural network graphs and have the browser execute them, here through a TFLite and XNNPACK backend. A Pool2d operation is a pooling layer: it slides a window of a given height and width over an input tensor and reduces each window to a single value. The window dimensions come from the page as windowDimensions, so they are attacker-controlled input that must be validated before any backend uses them for arithmetic or allocation.
The report does not include any images or videos.
Setup
The report gives few environmental details. The stated version is:
Chrome Version: HEAD
Operating System: Linux
The reproduction requires a Chromium build with AddressSanitizer (ASan), a local HTTP server, and a PoC file named poc.html. The report does not give the contents of poc.html, the contents of asan.txt, or the contents of fix.patch; it only refers to them as attachments. The report also does not state which accounts, roles or permissions are needed, beyond the page being served over HTTP and loaded in Chrome with the WebNN feature enabled.
Finding it
The researcher traced the path of the windowDimensions attribute from the WebNN frontend into XNNPACK. In the frontend, ValidatePool2dAndInferOutput reads the height and width into uint32_t variables window_height and window_width. The validation rejects zero dimensions but does not restrict the maximum product of the two values. The report marks the assignment of window_width with reference [0]:
uint32_t window_height = input_height;
uint32_t window_width = input_width;
if (attributes.window_dimensions) {
if (attributes.window_dimensions->height == 0 ||
attributes.window_dimensions->width == 0) {
return base::unexpected(ErrorWithLabel(
label, "All window dimensions should be greater than 0."));
}
window_height = attributes.window_dimensions->height;
window_width = attributes.window_dimensions->width; // [0]
Those unchecked values flow into the XNNPACK engine, where they are multiplied to compute pooling_size [1]. The researcher observed that supplying large windowDimensions, for example 1000092567 and 1152814792, makes the 64-bit unsigned product pooling_size overflow the 2^60 boundary. From there, XNNPACK computes step_height [2] and then indirection_buffer_size [3]. The key observation is that indirection_buffer_size multiplies (pooling_size - 1) + ... by sizeof(void*), which is 8 bytes. That multiplication by 8 overflows the 64-bit size_t, so the allocation size wraps around to a small number. The allocation therefore reserves a buffer far smaller than the code later assumes.
Exploitation
Step 1: Build Chromium with ASan
The report instructs the reader to build Chromium with AddressSanitizer. The report does not give build flags or commands for this step.
Step 2: Host the PoC
The poc.html file is served from a local HTTP server.
Step 3: Run Chrome against the PoC
The exact commands given are:
$ python3 -m http.server
$ ./out/asan/chrome --enable-features=WebMachineLearningNeuralNetwork "http://localhost:8000/poc.html"
The first command starts a static HTTP server in the current directory, which serves poc.html on port 8000. The second command launches the ASan build of Chrome with the WebMachineLearningNeuralNetwork feature enabled and loads the PoC from http://localhost:8000/poc.html.
Step 4: The overflow chain inside XNNPACK
The report walks through the arithmetic in the XNNPACK max pooling code. The pooling dimensions are taken from the operation's kernel, and their product is pooling_size [1]:
const size_t pooling_height = max_pooling_op->convolution_op->kernel_height;
const size_t pooling_width = max_pooling_op->convolution_op->kernel_width;
const size_t pooling_size = pooling_height * pooling_width; // [1]
const size_t output_height = max_pooling_op->convolution_op->output_height;
const size_t output_width = max_pooling_op->convolution_op->output_width;
const size_t step_width =
max_pooling_op->convolution_op->dilation_width > 1 ? pooling_width : min(max_pooling_op->convolution_op->stride_width, pooling_width);
const size_t step_height = pooling_size + (output_width - 1) * step_width * pooling_height; // [2]
if (input_height != max_pooling_op->convolution_op->last_input_height ||
input_width != max_pooling_op->convolution_op->last_input_width ||
channels != max_pooling_op->convolution_op->last_input_channels)
{
const size_t indirection_buffer_size = sizeof(void*) * ((pooling_size - 1) + output_height * step_height); // [3]
const void** indirection_buffer =
(const void**) xnn_reallocate_memory(max_pooling_op->convolution_op->indirection_buffer, indirection_buffer_size); // [4]
With the large window dimensions, pooling_size overflows past 2^60. step_height [2] is derived from pooling_size, and indirection_buffer_size [3] then multiplies a value derived from pooling_size by sizeof(void*), that is, by 8. This multiplication overflows the 64-bit size_t, so indirection_buffer_size wraps to a small number. xnn_reallocate_memory [4] therefore allocates a buffer smaller than the code believes it needs.
Step 5: Out-of-bounds writes during initialisation
The memory initialisation loop does not use the wrapped size. It iterates using the original kernel_height and kernel_width [5], so it writes more pointers than the small buffer can hold, producing heap out-of-bounds writes [6]:
for (size_t output_x = 0; output_x < output_width; output_x++) {
for (size_t pooling_x = 0; pooling_x < kernel_width; pooling_x++) { // [5]
const size_t input_x = min(doz(output_x * stride_width + pooling_x * dilation_width, input_padding_left), input_x_max);
const size_t index = output_y * step_height + output_x * step_width * kernel_height + pooling_x * kernel_height + pooling_y;
indirection_buffer[index] = (const void*) ((uintptr_t) input + (input_y * input_width + input_x) * input_pixel_stride); // [6]
}
}
The loop bounds come from kernel_width and the output dimensions, while the buffer was sized from the wrapped indirection_buffer_size. The index calculation uses step_height and step_width, so the writes land at offsets the undersized allocation does not cover.
Step 6: Observe the crash
The report states the crash type as "GPU process" and refers to the attached asan.txt ASan trace for the crash log. The report does not reproduce the trace text.
Root cause
The mistake is a missing bound on the product of the two window dimensions in the WebNN frontend. ValidatePool2dAndInferOutput checks only that each dimension is greater than zero, then stores the values in uint32_t variables without a checked multiplication. The unchecked values reach XNNPACK, where pooling_size is computed as a 64-bit product and can overflow past 2^60. The subsequent multiplication by sizeof(void*) in indirection_buffer_size overflows size_t, so the allocation wraps to a small size while the initialisation loop still uses the original kernel dimensions. The result is a heap out-of-bounds write.
The report's bisection attributes the regression to the XNNPACK upstream commit [redacted] ("Rewrite maxpool kernels"), which replaced a bounded tile constant with the attacker-controlled pooling size when calculating the indirection buffer size. That change was rolled into Chromium in commit [redacted] ("Roll TFLite to Next Green Version").
Impact
The report describes a heap out-of-bounds write in the GPU process, reached by a web page that supplies large windowDimensions to a Pool2d operation through WebNN. The conditions are that the page can run WebNN with the TFLite XNNPACK backend and that the feature is enabled, as in the reproduction command. The report does not analyse what an attacker could achieve beyond the out-of-bounds write and the GPU process crash; it does not claim code execution, sandbox escape or any specific post-exploitation step. The severity recorded by the platform is critical, but the report text itself does not elaborate on exploitability.
Fix
The suggested fix is to add a base::CheckedNumeric<uint32_t> multiplication check to ValidatePool2dAndInferOutput. The report refers to fix.patch for details but does not include the patch contents.
Variants to test
- Other WebNN operations that take attacker-controlled window or kernel dimensions and forward them to XNNPACK, such as other pooling or convolution shapes. A positive result is a checked multiplication missing in frontend validation and a wrapped allocation size in the backend.
- Other backends behind WebNN that compute buffer sizes from user-supplied dimensions. A positive result is an allocation size that wraps while a later loop still uses the original dimensions.
- The same
Pool2dpath with dimensions chosen so the product overflows at different bit boundaries, for example just past 2^60 or near 2^64. A positive result is an ASan report of a heap out-of-bounds write in the indirection buffer initialisation. - Re-testing the bisected XNNPACK commit range in other consumers of XNNPACK that embed the same max pooling code. A positive result is the same
indirection_buffer_sizeoverflow in a different product. - Checking whether the frontend validation rejects zero dimensions but accepts very large ones on other attributes with similar semantics. A positive result is a validation function that checks only for zero and not for an upper bound on the product.
What happened, in plain words
A security researcher found a bug in Google Chrome. The bug is a heap out-of-bounds write in the GPU process, reached by a web page that supplies large window dimensions. That kind of mistake is called a heap out-of-bounds write. The platform that tracks these bugs gave it the identifier CVE-2026-5859, rated it critical, and recorded a bounty of 43,000 USD. The researcher is listed as Anonymous, and the report was disclosed on 2026-04-07. The report itself says nothing about the bounty, the disclosure process or the researcher beyond the line "Reporter credit: Anonymous".
To understand the bug you need three ideas.
- A browser API is a set of features the browser offers to web pages, with rules for how a page may use them. Think of a restaurant menu: the page can order only what is on the menu, and the kitchen decides how each dish is made.
- A neural network is a program that learns patterns from examples, for instance recognising what is in a picture. Running one means doing a very large number of small arithmetic steps.
- An integer overflow happens when a fixed-size box for a number is too small to hold the result of a calculation, so the value wraps around, like a car odometer rolling from 999999 back to 000000. A program that trusts the wrapped number can then reserve far less memory than it later uses.
Chrome has a feature called WebNN. It is the browser API that lets a web page describe a neural network and ask the browser to run it. Chrome does not run these networks itself from scratch; it hands the work to a separate engine. In this report the engine is XNNPACK, reached through TFLite, and the work happens in a separate part of Chrome called the GPU process. A process is an isolated running program; Chrome splits its work into several so that a problem in one is contained.
The operation at the centre of the bug is Pool2d, a pooling layer. Picture a magnifying glass of a certain height and width that you slide across a grid of numbers, and for each position you keep only one value, such as the largest. The height and width of that glass are the window dimensions. The web page supplies them as an attribute called windowDimensions. Because the page supplies them, they are attacker-controlled: the browser must check them before using them for arithmetic or for reserving memory.
The report does not include any images or videos.
Context
This report describes an integer overflow in the WebNN TFLite XNNPACK backend of Google Chrome, tracked as CVE-2026-5859. The affected component is WebML, specifically the WebNN path that validates Pool2d operations and then hands them to the XNNPACK engine. The weakness class is integer overflow, and the report rates it critical. The platform records a bounty of 43,000 USD, the researcher as Anonymous, and disclosure on 2026-04-07. The report itself does not describe the bounty, the disclosure process or the researcher beyond the credit line "Reporter credit: Anonymous".
WebNN is the browser API that lets a web page describe neural network graphs and have the browser execute them, here through a TFLite and XNNPACK backend. A Pool2d operation is a pooling layer: it slides a window of a given height and width over an input tensor and reduces each window to a single value. A tensor is simply a grid of numbers with one or more dimensions; a black-and-white image is a two-dimensional tensor, a colour image is three-dimensional. The window dimensions come from the page as windowDimensions, so they are attacker-controlled input that must be validated before any backend uses them for arithmetic or allocation. Validation means checking that a value is sensible before trusting it, like a bouncer checking that a guest is on the list before letting them in.
Setup
A reproduction is a set of steps that makes the bug happen again on another machine, so that others can confirm it. The report gives few environmental details. The stated version is:
Chrome Version: HEAD
Operating System: Linux
Line by line: Chrome Version: HEAD means the researcher tested the newest development code rather than a numbered release; in version-control systems, HEAD is the latest commit, that is, the most recent saved change. Operating System: Linux means the tests ran on Linux, a family of open-source operating systems.
The reproduction requires a Chromium build with AddressSanitizer (ASan), a local HTTP server, and a PoC file named poc.html. Chromium is the open-source project that Chrome is built from. AddressSanitizer, or ASan, is a tool added when compiling a program; it watches memory use while the program runs and reports when code reads or writes outside the memory it was given. A local HTTP server is a small program on your own computer that hands files to a browser over the same protocol websites use. A PoC, short for proof of concept, is a minimal file or program that demonstrates the bug.
The report does not give the contents of poc.html, the contents of asan.txt, or the contents of fix.patch; it only refers to them as attachments. The report also does not state which accounts, roles or permissions are needed, beyond the page being served over HTTP and loaded in Chrome with the WebNN feature enabled.
Finding it
The researcher traced the path of the windowDimensions attribute from the WebNN frontend into XNNPACK. The frontend here is the part of Chrome that receives the page's request and checks it; the backend is the engine that does the heavy computation. In the frontend, ValidatePool2dAndInferOutput reads the height and width into uint32_t variables window_height and window_width. A variable is a named box in a program that holds a value. uint32_t is a box that holds a whole number from 0 up to about 4.29 billion and cannot hold negatives; the 32 means 32 bits, and each extra bit doubles the range.
The validation rejects zero dimensions but does not restrict the maximum product of the two values. The report marks the assignment of window_width with reference [0]:
uint32_t window_height = input_height;
uint32_t window_width = input_width;
if (attributes.window_dimensions) {
if (attributes.window_dimensions->height == 0 ||
attributes.window_dimensions->width == 0) {
return base::unexpected(ErrorWithLabel(
label, "All window dimensions should be greater than 0."));
}
window_height = attributes.window_dimensions->height;
window_width = attributes.window_dimensions->width; // [0]
Line by line:
uint32_t window_height = input_height;creates the height box and fills it with a default taken from the input.uint32_t window_width = input_width;does the same for the width.if (attributes.window_dimensions) {asks whether the page actually supplied window dimensions. If it did not, the defaults stay.if (attributes.window_dimensions->height == 0 ||andattributes.window_dimensions->width == 0) {check whether either dimension is zero. The||means "or".return base::unexpected(ErrorWithLabel(andlabel, "All window dimensions should be greater than 0."));reject the request with an error message. So zero is refused.window_height = attributes.window_dimensions->height;copies the page's height into the box.window_width = attributes.window_dimensions->width; // [0]copies the page's width into the box. The marker [0] points to the source line the report cites for this step.
The important gap: nothing here checks how large the two numbers are, or how large their product is. A value of four billion is accepted just as readily as a value of three.
Those unchecked values flow into the XNNPACK engine, where they are multiplied to compute pooling_size [1]. The researcher observed that supplying large windowDimensions, for example 1000092567 and 1152814792, makes the 64-bit unsigned product pooling_size overflow the 2^60 boundary. 64-bit unsigned means a box of 64 bits that holds only non-negative numbers, up to about 18.4 quintillion. 2^60 is two raised to the power sixty, a specific large threshold the report uses to describe where the product goes wrong. From there, XNNPACK computes step_height [2] and then indirection_buffer_size [3].
The key observation is that indirection_buffer_size multiplies (pooling_size - 1) + ... by sizeof(void*), which is 8 bytes. sizeof(void*) is the size in memory of a pointer, that is, of a value that says where something else lives in memory; on a 64-bit system that size is 8 bytes. That multiplication by 8 overflows the 64-bit size_t, so the allocation size wraps around to a small number. size_t is the standard box type used for sizes and counts. Allocation means asking the operating system for a block of memory. The allocation therefore reserves a buffer far smaller than the code later assumes.
Exploitation
Step 1: Build Chromium with ASan
The report instructs the reader to build Chromium with AddressSanitizer. Building means compiling the source code into a runnable program; adding ASan means compiling it with the memory-watching tool switched on. The report does not give build flags or commands for this step.
Step 2: Host the PoC
The poc.html file is served from a local HTTP server. Serving means making the file available at a web address so the browser can fetch it.
Step 3: Run Chrome against the PoC
The exact commands given are:
$ python3 -m http.server
$ ./out/asan/chrome --enable-features=WebMachineLearningNeuralNetwork "http://localhost:8000/poc.html"
Line by line:
$ python3 -m http.serverstarts a simple web server using Python 3. The$is the shell prompt, not part of the command. It serves the files in the current folder on port 8000. A port is a numbered doorway on a computer, so several services can listen at once.$ ./out/asan/chromeruns the Chrome program that was built with ASan;./out/asan/is the folder where that build put its output.--enable-features=WebMachineLearningNeuralNetworkswitches on the WebNN feature, which may not be on by default in a development build."http://localhost:8000/poc.html"is the address to open. localhost means this same computer, and 8000 is the port from the first command.
The first command starts a static HTTP server in the current directory, which serves poc.html on port 8000. The second command launches the ASan build of Chrome with the WebMachineLearningNeuralNetwork feature enabled and loads the PoC from http://localhost:8000/poc.html. JavaScript is the programming language web pages use to run code in the browser.
Step 4: The overflow chain inside XNNPACK
The report walks through the arithmetic in the XNNPACK max pooling code. Max pooling is the version of pooling that keeps the largest value in each window. The pooling dimensions are taken from the operation's kernel, and their product is pooling_size [1]. The kernel is the window itself, described by its height and width.
const size_t pooling_height = max_pooling_op->convolution_op->kernel_height;
const size_t pooling_width = max_pooling_op->convolution_op->kernel_width;
const size_t pooling_size = pooling_height * pooling_width; // [1]
const size_t output_height = max_pooling_op->convolution_op->output_height;
const size_t output_width = max_pooling_op->convolution_op->output_width;
const size_t step_width =
max_pooling_op->convolution_op->dilation_width > 1 ? pooling_width : min(max_pooling_op->convolution_op->stride_width, pooling_width);
const size_t step_height = pooling_size + (output_width - 1) * step_width * pooling_height; // [2]
if (input_height != max_pooling_op->convolution_op->last_input_height ||
input_width != max_pooling_op->convolution_op->last_input_width ||
channels != max_pooling_op->convolution_op->last_input_channels)
{
const size_t indirection_buffer_size = sizeof(void*) * ((pooling_size - 1) + output_height * step_height); // [3]
const void** indirection_buffer =
(const void**) xnn_reallocate_memory(max_pooling_op->convolution_op->indirection_buffer, indirection_buffer_size); // [4]
Line by line:
const size_t pooling_height = ...->kernel_height;copies the window height into a size box.constmeans the value will not change afterwards.const size_t pooling_width = ...->kernel_width;does the same for the width.const size_t pooling_size = pooling_height * pooling_width; // [1]multiplies them. This is where the huge page-supplied numbers meet.const size_t output_height = ...->output_height;andconst size_t output_width = ...->output_width;read how many windows fit across the output.const size_t step_width =begins a calculation of how far the window moves horizontally. The next line uses a ternary, writtencondition ? a : b, which means "if the condition holds use a, otherwise use b". If dilation, a spacing factor, is greater than 1, the step is the pooling width; otherwise it is the smaller of the stride and the pooling width. Stride is the step size between window positions.const size_t step_height = pooling_size + (output_width - 1) * step_width * pooling_height; // [2]computes the vertical step, built on top of the already hugepooling_size.if (input_height != ...->last_input_height ||and the two following lines check whether the input shape changed since last time. If nothing changed, the buffer is reused and the code below is skipped. The!=means "is not equal to".const size_t indirection_buffer_size = sizeof(void*) * ((pooling_size - 1) + output_height * step_height); // [3]computes how many bytes the buffer needs. This is the critical line: a value derived frompooling_sizeis multiplied by 8.const void** indirection_buffer =declares a variable for the buffer. A buffer is a reserved block of memory. The**means a pointer to a pointer, because the buffer stores addresses of other places in memory.(const void**) xnn_reallocate_memory(...->indirection_buffer, indirection_buffer_size); // [4]asks XNNPACK to resize the buffer to that many bytes. Reallocate means free the old block and reserve a new one of the requested size.
With the large window dimensions, pooling_size overflows past 2^60. step_height [2] is derived from pooling_size, and indirection_buffer_size [3] then multiplies a value derived from pooling_size by sizeof(void*), that is, by 8. This multiplication overflows the 64-bit size_t, so indirection_buffer_size wraps to a small number. xnn_reallocate_memory [4] therefore allocates a buffer smaller than the code believes it needs. The everyday comparison: you order a box big enough for a thousand books, the order form wraps around and the warehouse ships a shoebox, but the packing list still says a thousand.
Step 5: Out-of-bounds writes during initialisation
Initialisation here means filling the buffer with the addresses it will use. The memory initialisation loop does not use the wrapped size. It iterates using the original kernel_height and kernel_width [5], so it writes more pointers than the small buffer can hold, producing heap out-of-bounds writes [6]. The heap is the general-purpose memory area a program uses for blocks it reserves at run time.
for (size_t output_x = 0; output_x < output_width; output_x++) {
for (size_t pooling_x = 0; pooling_x < kernel_width; pooling_x++) { // [5]
const size_t input_x = min(doz(output_x * stride_width + pooling_x * dilation_width, input_padding_left), input_x_max);
const size_t index = output_y * step_height + output_x * step_width * kernel_height + pooling_x * kernel_height + pooling_y;
indirection_buffer[index] = (const void*) ((uintptr_t) input + (input_y * input_width + input_x) * input_pixel_stride); // [6]
}
}
Line by line:
for (size_t output_x = 0; output_x < output_width; output_x++) {is a loop that counts across the output columns, from zero up tooutput_width.for (size_t pooling_x = 0; pooling_x < kernel_width; pooling_x++) { // [5]is a nested loop that counts across the window columns, up to the originalkernel_width. This is the bound the report highlights: it uses the original kernel_width rather than the wrapped buffer size.const size_t input_x = min(doz(...), input_x_max);works out which input column to read.mintakes the smaller of two values.dozis a helper that subtracts but never goes below zero, short for difference or zero.const size_t index = output_y * step_height + output_x * step_width * kernel_height + pooling_x * kernel_height + pooling_y;computes where in the buffer to write. It usesstep_heightandstep_width, which were derived from the huge numbers.indirection_buffer[index] = (const void*) ((uintptr_t) input + ...); // [6]writes a pointer into the buffer at that position.uintptr_tis an integer type wide enough to hold a pointer, so arithmetic can be done on an address. The write is the out-of-bounds write:indexcan point past the end of the small allocation.
The loop bounds come from kernel_width and the output dimensions, while the buffer was sized from the wrapped indirection_buffer_size. The index calculation uses step_height and step_width, so the writes land at offsets the undersized allocation does not cover. An offset is a distance from the start of a block.
Step 6: Observe the crash
The report states the crash type as "GPU process" and refers to the attached asan.txt ASan trace for the crash log. A crash log is the record a program or tool leaves behind when something goes wrong. The report does not reproduce the trace text.
Root cause
The mistake is a missing bound on the product of the two window dimensions in the WebNN frontend. ValidatePool2dAndInferOutput checks only that each dimension is greater than zero, then stores the values in uint32_t variables without a checked multiplication. A checked multiplication is one that detects overflow and reports it instead of silently wrapping. The unchecked values reach XNNPACK, where pooling_size is computed as a 64-bit product and can overflow past 2^60. The subsequent multiplication by sizeof(void*) in indirection_buffer_size overflows size_t, so the allocation wraps to a small size while the initialisation loop still uses the original kernel dimensions. The result is a heap out-of-bounds write.
The report's bisection attributes the regression to the XNNPACK upstream commit [redacted] ("Rewrite maxpool kernels"), which replaced a bounded tile constant with the attacker-controlled pooling size when calculating the indirection buffer size. Bisection means narrowing down which change introduced a bug, often by testing versions between a known-good and a known-bad point. A commit is a saved change in a version-control system, identified by a long hash. Upstream means the original project that other projects copy code from. That change was rolled into Chromium in commit [redacted] ("Roll TFLite to Next Green Version"). A roll is the routine act of updating a bundled third-party library to a newer version.
Impact
The report describes a heap out-of-bounds write in the GPU process, reached by a web page that supplies large windowDimensions to a Pool2d operation through WebNN. The conditions are that the page can run WebNN with the TFLite XNNPACK backend and that the feature is enabled, as in the reproduction command. The report does not analyse what an attacker could achieve beyond the out-of-bounds write and the GPU process crash; it does not claim code execution, sandbox escape or any specific post-exploitation step. Code execution means making the computer run an attacker's instructions; a sandbox escape means getting out of the restricted environment Chrome puts each process in. The severity recorded by the platform is critical, but the report text itself does not elaborate on exploitability.
Fix
The suggested fix is to add a base::CheckedNumeric<uint32_t> multiplication check to ValidatePool2dAndInferOutput. base::CheckedNumeric is a Chromium helper type that performs arithmetic and flags overflow rather than letting it wrap. The report refers to fix.patch for details but does not include the patch contents. A patch is a file describing changes to source code.
Variants to test
These are follow-up ideas: other places where the same kind of mistake might exist. A variant is a related version of the same bug.
- Other WebNN operations that take attacker-controlled window or kernel dimensions and forward them to XNNPACK, such as other pooling or convolution shapes. A positive result is a checked multiplication missing in frontend validation and a wrapped allocation size in the backend.
- Other backends behind WebNN that compute buffer sizes from user-supplied dimensions. A positive result is an allocation size that wraps while a later loop still uses the original dimensions.
- The same
Pool2dpath with dimensions chosen so the product overflows at different bit boundaries, for example just past 2^60 or near 2^64. A positive result is an ASan report of a heap out-of-bounds write in the indirection buffer initialisation. - Re-testing the bisected XNNPACK commit range in other consumers of XNNPACK that embed the same max pooling code. A consumer here is another program that includes XNNPACK. A positive result is the same
indirection_buffer_sizeoverflow in a different product. - Checking whether the frontend validation rejects zero dimensions but accepts very large ones on other attributes with similar semantics. A positive result is a validation function that checks only for zero and not for an upper bound on the product.
Glossary
- AddressSanitizer (ASan): a tool added at compile time that watches memory use and reports reads or writes outside the memory a program was given.
- Allocation: asking the operating system for a block of memory.
- API: a set of features a program offers to other programs, with rules for how they may be used.
- Attacker-controlled: a value that a web page or user can choose, so it must be checked before being trusted.
- Backend: the engine that performs the heavy computation behind a simpler interface.
- Bisection: narrowing down which change introduced a bug by testing versions between a known-good and a known-bad point.
- Buffer: a reserved block of memory.
- Checked multiplication: a multiplication that detects overflow and reports it instead of silently wrapping.
- Chromium: the open-source project that Google Chrome is built from.
- Code execution: making a computer run an attacker's instructions.
- Commit: a saved change in a version-control system, identified by a long hash.
- Consumer (of a library): another program that includes and uses that library.
- Crash log: the record a program or tool leaves behind when something goes wrong.
- CVE: a public identifier for a known security vulnerability.
- Dilation: a spacing factor that spreads out the points a window covers.
- Frontend: the part of a program that receives a request and checks it before passing it on.
- GPU process: a separate Chrome process that handles graphics and, here, neural network work.
- Heap: the general-purpose memory area a program uses for blocks it reserves at run time.
- Heap out-of-bounds write: writing data past the end of a block of heap memory that was reserved.
- HTTP server: a program that hands files to a browser over the web protocol.
- Indirection buffer: a buffer that stores addresses of other places in memory rather than the data itself.
- Initialisation: filling a structure with its starting values.
- Integer overflow: a calculation whose result is too large for the fixed-size box holding it, so the value wraps around.
- JavaScript: the programming language web pages use to run code in the browser.
- Kernel (in pooling): the window, described by its height and width, that slides over the input.
- localhost: the name a computer uses to refer to itself.
- Max pooling: pooling that keeps the largest value in each window.
- Neural network: a program that learns patterns from examples and runs many small arithmetic steps.
- Offset: a distance from the start of a block of memory.
- Patch: a file describing changes to source code.
- Pointer: a value that says where something else lives in memory.
- Pool2d: a two-dimensional pooling layer that slides a window over a grid and reduces each window to one value.
- Port: a numbered doorway on a computer through which a service listens.
- Process: an isolated running program.
- Reallocate: free an existing memory block and reserve a new one of a requested size.
- Reproduction: a set of steps that makes a bug happen again so others can confirm it.
- Roll: the routine act of updating a bundled third-party library to a newer version.
- Sandbox escape: getting out of the restricted environment a browser puts each process in.
size_t: the standard integer type used for sizes and counts.sizeof(void*): the size in memory of a pointer, 8 bytes on a 64-bit system.- Stride: the step size between window positions.
- Tensor: a grid of numbers with one or more dimensions.
- Ternary: an expression of the form
condition ? a : b, meaning use a if the condition holds, otherwise b. - TFLite: a lightweight runtime for running neural networks, used by Chrome as part of the WebNN path.
uint32_t: an integer type holding whole numbers from 0 to about 4.29 billion.uintptr_t: an integer type wide enough to hold a pointer, so arithmetic can be done on an address.- Upstream: the original project that other projects copy code from.
- Validation: checking that a value is sensible before trusting it.
- Variable: a named box in a program that holds a value.
- Variant: a related version of the same bug in another place.
- WebML: the umbrella name for the web machine learning features, including WebNN.
- WebNN: the browser API that lets a web page describe a neural network and have the browser run it.
- XNNPACK: the engine that performs the neural network arithmetic in this path.