Skip to content
Memory corruption Advisory Advanced CVE-2026-7896

Integer overflow in Blink (CVE-2026-7896)

An integer overflow in XNNPack's tensor size calculation, reachable via WebNN's TFLite backend when handling maxPool2d with explicit padding, causes a heap buffer overflow write in the GPU process. An attacker could potentially crash the GPU process or corrupt memory by crafting a malicious web page.

c6eed09fc8b174b0f3eebedcceb1e792 Follow

Originally disclosed on Chrome VRP

Bounty$43,000 Critical View original
  • Fix shipped in 49 days

Integer overflow in XNNPack tensor size computation leads to heap OOB write in the GPU process via WebNN pool2d

Summary

When the WebNN TFLite backend translates a maxPool2d (or averagePool2d) operation with explicit padding, it inserts an internal PAD node whose output tensor dimensions are not checked against the byte-size limit. XNNPack's get_tensor_size function then computes the tensor's byte size by multiplying the element count by the datatype width in a uint64_t, which silently wraps around for sufficiently large shapes. The memory planner allocates a workspace based on the wrapped value while the PAD kernel writes according to the true dimensions, producing an immediate heap buffer overflow in the GPU process. Affected platforms: all platforms where the TFLite WebNN backend is active (Linux, macOS, Windows, ChromeOS).

Bisect

XNNPack upstream — xnn_shape_multiply_all_dims never overflow-checked

  • Commit: 0630d2941ca4b96b5f318ac3d03893922d55c3fa
  • Date: 2021-09-28
  • Author: Marat Dukhan ([email protected])
  • Subject: Refactor creation and setup of Operators from Nodes
  • PiperOrigin-RevId: 399455001

This function is a simple batch_size *= shape->dim[i] loop with no overflow check, and has never had one. get_tensor_size multiplies the result by xnn_datatype_size_bits in uint64_t, which wraps for sufficiently large shapes, causing workspace underallocation.

Became web-reachable — InsertPadOperation introduced with unchecked SerializeTemporaryTensor

This commit introduced InsertPadOperation using SerializeTemporaryTensor() (no byte-size check) to create internal PAD output tensors. The function validates individual dimensions fit in int32_t but never checks the total byte size against tensor_byte_length_limit. The pool2d path was added subsequently and reuses the same function.

Checked variant introduced but InsertPadOperation NOT updated

This commit introduced SerializeTemporaryTensorWithByteSizeCheck() and updated one call site (float16-to-float32 cast dequantize path), but InsertPadOperation and other callers of SerializeTemporaryTensor were not updated.

Root Cause

The vulnerability spans two components: the Chromium WebNN translation layer and XNNPack's tensor size arithmetic.

When maxPool2d or averagePool2d receives explicit padding that cannot be expressed as TFLite SAME or VALID, SerializePool2d calls InsertPadOperation to emit a separate PAD node ahead of the pool. This function computes the padded output dimensions with checked arithmetic, verifying each individual dimension fits in int32_t, then creates the tensor:

C
// services/webnn/tflite/graph_builder_tflite.cc:3563-3565
const TensorIndex output_tensor_index =
    SerializeTemporaryTensor(output_shape, input_tensor_info.data_type,
                             input_tensor_info.quantize_params);

SerializeTemporaryTensor accepts any dimensions without validating total byte size:

C
// services/webnn/tflite/graph_builder_tflite.cc:3063-3074
TensorIndex GraphBuilderTflite::SerializeTemporaryTensor(
    base::span<const int32_t> dimensions,
    ::tflite::TensorType tensor_type,
    QuantizateParametersOffset quantize_params) {
  const TensorIndex temporary_tensor_index =
      base::checked_cast<TensorIndex>(tensors_.size());
  tensors_.emplace_back(::tflite::CreateTensor(
      builder_, builder_.CreateVector<int32_t>(dimensions), tensor_type,
      /*buffer=*/0, /*name=*/0, quantize_params));
  return temporary_tensor_index;
}

The codebase already provides a safe alternative, SerializeTemporaryTensorWithByteSizeCheck, which validates byte length against context_properties_.tensor_byte_length_limit before creation. InsertPadOperation does not use it.

XNNPack delegates the resulting PAD node and computes workspace requirements in get_tensor_size:

C
// third_party/xnnpack/src/src/tensor.c:779-781
uint64_t size_bits = xnn_datatype_size_bits(datatype);
size_bits *= xnn_shape_multiply_all_dims(shape);
return (size_bits + 7) >> 3;

xnn_shape_multiply_all_dims returns a size_t product of all dimensions:

C
// third_party/xnnpack/src/src/tensor.c:636-644
size_t xnn_shape_multiply_all_dims(const struct xnn_shape* shape) {
  size_t batch_size = 1;
  for (size_t i = 0; i < shape->num_dims; i++) {
    batch_size *= shape->dim[i];
  }
  return batch_size;
}

Neither multiplication is overflow-checked. For a padded tensor shape [1, 32768, 32770, 536838146], the element count is 576,460,752,303,516,672. Multiplying by 32 bits yields 18,446,744,073,712,533,504, which exceeds UINT64_MAX by exactly 4,194,304. The wrapped size_bits value is 4,194,304, producing a workspace allocation of 524,288 bytes (512 KB).

The PAD operator's SSE2 fill kernel then writes zero-padding into this workspace following the true 4D strides. After approximately 131,072 float writes the kernel crosses the 512 KB boundary and corrupts adjacent heap memory, which ASAN detects as a heap-buffer-overflow WRITE.

The PoC constructs this condition through maxPool2d with the following parameters: input [1, 1, 1, 536838146], window [32768, 32770], strides [32768, 32770], and padding [32767, 0, 32769, 0]. The pool's output shape is [1, 1, 1, 536838146], which passes all WebNN validation, while the internal padded shape overflows XNNPack's size computation. Using strides equal to the window dimensions keeps the max-pooling indirection buffer at approximately 24 GB, which is large but within the reach of servers and workstations.

Reproduce

Tested at commit 7c89d33808e55 on Linux x64.

ASAN build configuration (out/asan-release/args.gn):

is_asan = true
is_debug = false
dcheck_always_on = false
target_cpu = "x64"
is_component_build = true

Serve the PoC and launch:

python3 -m http.server 8888 --directory issue_tflite005_xnnpack_pad_oob --bind 127.0.0.1 &
ASAN_OPTIONS=detect_odr_violation=0 out/asan-release/chrome \
  --no-sandbox \
  --enable-features=WebMachineLearningNeuralNetwork \
  --user-data-dir=/tmp/poc-$(date +%s) \
  http://127.0.0.1:8888/poc.html

Graph construction takes approximately 60 to 90 seconds (the max-pooling indirection buffer is around 24 GB). After dispatch, the GPU process crashes immediately with an ASAN heap-buffer-overflow WRITE:

==PID==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7b7439c02820
WRITE of size 16 at 0x7b7439c02820 thread T79 (ThreadPoolForeg)
    #0 xnn_xx_fill_ukernel__sse2_u64 xx-fill-sse2-u64.c:32
    ...
    #9 xnn_run_operator_with_index operator-run.c:2147
    #10 xnn_invoke_runtime runtime.c:1143
    #11 tflite::xnnpack::SubgraphInvoke(...) xnnpack_delegate.cc:1429
    ...
    #15 webnn::tflite::GraphImplTflite::ComputeResources::DoDispatch(...) graph_impl_tflite.cc:328

0x7b7439c02820 is located 0 bytes after 524320-byte region [0x7b7439b82800,0x7b7439c02820)
allocated by thread T79 (ThreadPoolForeg) here:
    #1 xnn_aligned_allocate allocator.c:46
    #2 xnn_plan_memory allocator.h:60
    #3 tflite::xnnpack::SubgraphPrepare(...) xnnpack_delegate.cc:1266

SUMMARY: AddressSanitizer: heap-buffer-overflow xx-fill-sse2-u64.c:32 in xnn_xx_fill_ukernel__sse2_u64

The complete ASAN log is in asan.log.

Credit

Please use c6eed09fc8b174b0f3eebedcceb1e792 as the credit for this vulnerability. Thank you.

The original report as published on the Chromium issue tracker, by c6eed09fc8b174b0f3eebedcceb1e792. 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

The report describes an integer overflow in the Chromium WebNN TFLite backend, combined with unchecked size arithmetic in XNNPack, that leads to a heap out-of-bounds write in the GPU process. The platform facts list the title as "Integer overflow in Blink (CVE-2026-7896)", the program as Google Chrome (Chrome VRP), the weakness as integer overflow, the asset as Blink, severity critical, and a bounty of 43,000.00 USD, disclosed 2026-05-05. The original report itself, however, is written about the WebNN TFLite backend and XNNPack, not about Blink directly, and it does not mention a CVE number, a severity rating or a bounty.

WebNN is the web API through which a page can build and run neural network graphs. In Chrome, one of the backends translates the WebNN graph into a TFLite model and delegates execution to XNNPack. The report concerns two pooling operations, maxPool2d and averagePool2d, when they are given explicit padding that cannot be expressed as TFLite SAME or VALID padding. In that case the translator inserts an internal PAD node ahead of the pool. The output tensor of that internal PAD node is created without a check on its total byte size, and XNNPack's tensor size computation can then wrap around in uint64_t arithmetic. The memory planner allocates a workspace based on the wrapped value, while the PAD kernel writes according to the true dimensions, producing an immediate heap buffer overflow in the GPU process.

The report states that all platforms where the TFLite WebNN backend is active are affected: Linux, macOS, Windows and ChromeOS.

Setup

The researcher tested at commit 7c89d33808e55 on Linux x64, using an ASAN build. The build configuration is given as out/asan-release/args.gn:

Text
is_asan = true
is_debug = false
dcheck_always_on = false
target_cpu = "x64"
is_component_build = true

The proof of concept is served locally over HTTP and loaded in a Chrome build with the WebNN feature flag enabled. The preconditions implied by the reproduction are a Chrome build with the TFLite WebNN backend active, the WebMachineLearningNeuralNetwork feature enabled, and enough memory for a large max-pooling indirection buffer (the report puts it at approximately 24 GB, which it says is large but within reach of servers and workstations).

Finding it

The researcher traced the problem through three commits, which the report presents as a bisect.

  1. XNNPack upstream, xnn_shape_multiply_all_dims never overflow-checked. Commit [redacted], dated 2021-09-28, author Marat Dukhan, subject "Refactor creation and setup of Operators from Nodes", PiperOrigin-RevId 399455001. The report says this function is a simple batch_size *= shape->dim[i] loop with no overflow check and has never had one. get_tensor_size multiplies the result by xnn_datatype_size_bits in uint64_t, which wraps for sufficiently large shapes, causing workspace underallocation.
  2. Became web-reachable, InsertPadOperation introduced with unchecked SerializeTemporaryTensor. Commit [redacted], dated 2024-03-12, author Junwei Fu, subject "webnn: Support Conv2d in TFLite converter", review at https://chromium-review.googlesource.com/c/chromium/src/+/5337479. This commit introduced InsertPadOperation using SerializeTemporaryTensor() (no byte-size check) to create internal PAD output tensors. The function validates that individual dimensions fit in int32_t but never checks the total byte size against tensor_byte_length_limit. The pool2d path was added subsequently and reuses the same function.
  3. Checked variant introduced but InsertPadOperation not updated. Commit [redacted], dated 2025-10-31, author Lynne Jiang, subject "webnn: Enable temp tensor byte size check.", review at https://chromium-review.googlesource.com/c/chromium/src/+/7092679. This commit introduced SerializeTemporaryTensorWithByteSizeCheck() and updated one call site (the float16-to-float32 cast dequantize path), but InsertPadOperation and other callers of SerializeTemporaryTensor were not updated.

What made it look wrong is the combination: a temporary tensor is created with dimensions that pass per-dimension int32_t validation but whose product, multiplied by the datatype width, exceeds UINT64_MAX. The safe helper already existed in the codebase but was not used on this path.

Exploitation

Step 1: understand the translation path

When maxPool2d or averagePool2d receives explicit padding that cannot be expressed as TFLite SAME or VALID, SerializePool2d calls InsertPadOperation to emit a separate PAD node ahead of the pool. InsertPadOperation computes the padded output dimensions with checked arithmetic, verifying that each individual dimension fits in int32_t, then creates the tensor:

C
// services/webnn/tflite/graph_builder_tflite.cc:3563-3565
const TensorIndex output_tensor_index =
    SerializeTemporaryTensor(output_shape, input_tensor_info.data_type,
                             input_tensor_info.quantize_params);

SerializeTemporaryTensor accepts any dimensions without validating total byte size:

C
// services/webnn/tflite/graph_builder_tflite.cc:3063-3074
TensorIndex GraphBuilderTflite::SerializeTemporaryTensor(
    base::span<const int32_t> dimensions,
    ::tflite::TensorType tensor_type,
    QuantizateParametersOffset quantize_params) {
  const TensorIndex temporary_tensor_index =
      base::checked_cast<TensorIndex>(tensors_.size());
  tensors_.emplace_back(::tflite::CreateTensor(
      builder_, builder_.CreateVector<int32_t>(dimensions), tensor_type,
      /*buffer=*/0, /*name=*/0, quantize_params));
  return temporary_tensor_index;
}

The codebase already provides a safe alternative, SerializeTemporaryTensorWithByteSizeCheck, which validates byte length against context_properties_.tensor_byte_length_limit before creation. InsertPadOperation does not use it.

Step 2: understand the size arithmetic in XNNPack

XNNPack delegates the resulting PAD node and computes workspace requirements in get_tensor_size:

C
// third_party/xnnpack/src/src/tensor.c:779-781
uint64_t size_bits = xnn_datatype_size_bits(datatype);
size_bits *= xnn_shape_multiply_all_dims(shape);
return (size_bits + 7) >> 3;

xnn_shape_multiply_all_dims returns a size_t product of all dimensions:

C
// third_party/xnnpack/src/src/tensor.c:636-644
size_t xnn_shape_multiply_all_dims(const struct xnn_shape* shape) {
  size_t batch_size = 1;
  for (size_t i = 0; i < shape->num_dims; i++) {
    batch_size *= shape->dim[i];
  }
  return batch_size;
}

Neither multiplication is overflow-checked. For a padded tensor shape [1, 32768, 32770, 536838146], the element count is 576,460,752,303,516,672. Multiplying by 32 bits yields 18,446,744,073,712,533,504, which exceeds UINT64_MAX by exactly 4,194,304. The wrapped size_bits value is 4,194,304, producing a workspace allocation of 524,288 bytes (512 KB).

Step 3: choose pool parameters that produce the padded shape

The PoC constructs this condition through maxPool2d with the following parameters: input [1, 1, 1, 536838146], window [32768, 32770], strides [32768, 32770], and padding [32767, 0, 32769, 0]. The pool's output shape is [1, 1, 1, 536838146], which passes all WebNN validation, while the internal padded shape overflows XNNPack's size computation. Using strides equal to the window dimensions keeps the max-pooling indirection buffer at approximately 24 GB, which the report describes as large but within the reach of servers and workstations.

Step 4: build and serve the PoC

Serve the PoC and launch Chrome with the ASAN build:

The first command serves the directory issue_tflite005_xnnpack_pad_oob on port 8888 bound to loopback. The second launches the ASAN Chrome binary with detect_odr_violation=0, --no-sandbox, the WebNN feature flag, a fresh temporary user data directory, and the PoC page. The report does not include the contents of poc.html.

Step 5: observe the crash

Graph construction takes approximately 60 to 90 seconds because of the roughly 24 GB max-pooling indirection buffer. After dispatch, the GPU process crashes immediately with an ASAN heap-buffer-overflow WRITE:

Text
==PID==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7b7439c02820
WRITE of size 16 at 0x7b7439c02820 thread T79 (ThreadPoolForeg)
    #0 xnn_xx_fill_ukernel__sse2_u64 xx-fill-sse2-u64.c:32
    ...
    #9 xnn_run_operator_with_index operator-run.c:2147
    #10 xnn_invoke_runtime runtime.c:1143
    #11 tflite::xnnpack::SubgraphInvoke(...) xnnpack_delegate.cc:1429
    ...
    #15 webnn::tflite::GraphImplTflite::ComputeResources::DoDispatch(...) graph_impl_tflite.cc:328

0x7b7439c02820 is located 0 bytes after 524320-byte region [0x7b7439b82800,0x7b7439c02820)
allocated by thread T79 (ThreadPoolForeg) here:
    #1 xnn_aligned_allocate allocator.c:46
    #2 xnn_plan_memory allocator.h:60
    #3 tflite::xnnpack::SubgraphPrepare(...) xnnpack_delegate.cc:1266

SUMMARY: AddressSanitizer: heap-buffer-overflow xx-fill-sse2-u64.c:32 in xnn_xx_fill_ukernel__sse2_u64

The PAD operator's SSE2 fill kernel writes zero-padding into the workspace following the true 4D strides. After approximately 131,072 float writes the kernel crosses the 512 KB boundary and corrupts adjacent heap memory, which ASAN detects as a heap-buffer-overflow WRITE. The report says the complete ASAN log is in asan.log, which is not reproduced in the text.

Root cause

The vulnerability spans two components: the Chromium WebNN translation layer and XNNPack's tensor size arithmetic.

In Chromium, InsertPadOperation creates an internal PAD output tensor through SerializeTemporaryTensor, which checks that each dimension fits in int32_t but not that the total byte size is within tensor_byte_length_limit. A safe helper, SerializeTemporaryTensorWithByteSizeCheck, exists and is used on at least one other path (the float16-to-float32 cast dequantize path), but not here. The pool2d path was added later and reused the unchecked function.

In XNNPack, xnn_shape_multiply_all_dims multiplies dimensions in size_t without an overflow check, and get_tensor_size multiplies the result by the datatype width in uint64_t without an overflow check. For the chosen shape the second multiplication wraps, so the memory planner allocates a 512 KB workspace while the kernel writes according to the true dimensions.

Why the existing defences did not stop it: WebNN validation accepts the pool output shape, and the per-dimension int32_t check in the translator passes. The byte-size limit check that would have caught the temporary tensor is implemented in a helper that this call site does not use. The report does not describe any other mitigation that was in place.

Impact

The report describes an immediate heap buffer overflow write in the GPU process, triggered by a web page that builds a WebNN graph with the described pool parameters. The write is performed by the PAD fill kernel after it crosses the underallocated workspace boundary. The conditions are a Chrome build with the TFLite WebNN backend active, the WebNN feature enabled, and sufficient memory for the large indirection buffer. The report lists Linux, macOS, Windows and ChromeOS as affected platforms where the backend is active.

Fix

The original report does not state which change fixed the issue. It identifies the missing check in InsertPadOperation and the unchecked multiplications in XNNPack, and it notes that SerializeTemporaryTensorWithByteSizeCheck already exists and validates byte length against context_properties_.tensor_byte_length_limit. On the evidence in the report, the fix would be to route InsertPadOperation (and the other remaining callers of SerializeTemporaryTensor) through the byte-size-checked helper, and to add overflow checks to the XNNPack size arithmetic.

Variants to test

  1. Other WebNN operations that create temporary tensors through SerializeTemporaryTensor. A positive result is a temporary tensor whose dimensions pass per-dimension validation but whose total byte size exceeds tensor_byte_length_limit, followed by an ASAN report in the GPU process.
  2. averagePool2d with explicit padding that cannot be expressed as SAME or VALID. The report says the pool2d path is shared, so the same padded shape construction should reach InsertPadOperation. A positive result is the same wrapped workspace size and an out-of-bounds write in the fill kernel.
  3. Other datatype widths on the same path. The wrap depends on the product of element count and datatype width, so different widths shift the shape needed to exceed UINT64_MAX. A positive result is a wrapped size_bits value and a workspace smaller than the true tensor.
  4. Other XNNPack operators whose workspace is planned from get_tensor_size. A positive result is an allocation smaller than the dimensions the kernel writes, detected by ASAN as a heap-buffer-overflow WRITE.
  5. Other callers of xnn_shape_multiply_all_dims. A positive result is a shape whose dimension product overflows size_t or whose bit-size product overflows uint64_t without a check.

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

What happened, in plain words

A security researcher found a way to make Google Chrome's GPU process write data past the end of a block of memory it had reserved. The trigger is a web page that asks the browser to run a small neural network operation, specifically a pooling operation with unusual padding settings. Chrome translates that request into a form a maths library called XNNPack can run. During that translation, a size calculation wraps around, like an old car odometer rolling from 999999 back to 000000. The library then reserves a tiny workspace (512 KB) while the code that fills it believes it has a gigantic one, so it keeps writing and spills into neighbouring memory.

The report asks for the credit [redacted] to be used for the vulnerability. The platform facts attached to this report give the title "Integer overflow in Blink (CVE-2026-7896)", list the program as Google Chrome (Chrome VRP), the weakness as integer overflow, the asset as Blink, the severity as critical, a bounty of 43,000.00 USD, and a disclosure date of 2026-05-05. The original report text itself, however, is about the WebNN TFLite backend and XNNPack, not about Blink directly, and it does not mention a CVE number, a severity rating or a bounty.

Before going further, a few everyday comparisons will help.

  • A web API is a set of rules a web page can use to ask the browser to do something on its behalf, like a waiter taking your order to the kitchen. WebNN is one such API: it lets a page ask the browser to build and run a neural network.
  • A neural network here is just a series of mathematical steps, often used for image recognition or similar tasks. A pooling step is one of those steps: it slides a small window over data and keeps, for example, the maximum value in each window (max pooling) or the average (average pooling).
  • Padding means adding extra empty cells around the edges of the data before the window slides over it, so the window fits neatly. Think of adding blank tiles around a jigsaw so the pieces line up.
  • An integer overflow is what happens when a fixed-size number container is asked to hold a value larger than it can represent. The value wraps around to a small number, silently. It is the odometer effect.
  • A heap buffer overflow (or heap out-of-bounds write) means a program writes data past the end of a reserved block of memory (the heap) into memory that belongs to something else. It is like writing past the last line of a notebook and onto the desk underneath.
  • ASAN (AddressSanitizer) is a debugging tool built into a special version of a program that watches memory accesses and shouts when one goes out of bounds.

Context

The report describes an integer overflow in the Chromium WebNN TFLite backend, combined with unchecked size arithmetic in XNNPack, that leads to a heap out-of-bounds write in the GPU process.

WebNN is the web API through which a page can build and run neural network graphs. In Chrome, one of the backends translates the WebNN graph into a TFLite model and delegates execution to XNNPack. TFLite is a format and runtime for small machine-learning models; XNNPack is a library of fast maths routines. The report concerns two pooling operations, maxPool2d and averagePool2d, when they are given explicit padding that cannot be expressed as TFLite SAME or VALID padding. SAME and VALID are two standard padding conventions; explicit padding means the page spells out the exact number of extra cells on each side. In that case the translator inserts an internal PAD node ahead of the pool. A node here is one step in the graph; a PAD node just adds the extra cells.

The output tensor of that internal PAD node is created without a check on its total byte size, and XNNPack's tensor size computation can then wrap around in uint64_t arithmetic. A tensor is a multi-dimensional array of numbers; its byte size is how much memory it needs. uint64_t is an unsigned 64-bit integer, a container that can hold values from 0 up to about 18.4 quintillion. The memory planner allocates a workspace based on the wrapped value, while the PAD kernel writes according to the true dimensions, producing an immediate heap buffer overflow in the GPU process. The GPU process is the part of Chrome that talks to the graphics card and, in this setup, runs the delegated maths.

The report states that all platforms where the TFLite WebNN backend is active are affected: Linux, macOS, Windows and ChromeOS.

Setup

The researcher tested at commit 7c89d33808e55 on Linux x64, using an ASAN build. A commit is a saved snapshot of the source code in a version-control system; the short string identifies exactly which snapshot. An ASAN build is a build of Chrome compiled with AddressSanitizer so that memory errors are caught and reported instead of silently corrupting things.

The build configuration is given as out/asan-release/args.gn:

Text
is_asan = true
is_debug = false
dcheck_always_on = false
target_cpu = "x64"
is_component_build = true

Line by line:

  1. is_asan = true turns on AddressSanitizer, the memory-watching tool.
  2. is_debug = false builds a non-debug binary.
  3. dcheck_always_on = false turns off always-on DCHECK assertions.
  4. target_cpu = "x64" builds for 64-bit Intel/AMD processors.
  5. is_component_build = true builds Chrome as a component build.

The proof of concept is served locally over HTTP and loaded in a Chrome build with the WebNN feature flag enabled. A feature flag is a switch that turns an experimental feature on or off. The preconditions implied by the reproduction are a Chrome build with the TFLite WebNN backend active, the WebMachineLearningNeuralNetwork feature enabled, and enough memory for a large max-pooling indirection buffer (the report puts it at approximately 24 GB, which it says is large but within reach of servers and workstations). An indirection buffer is an internal table of pointers that tells the pooling code where each window starts.

Finding it

The researcher traced the problem through three commits, which the report presents as a bisect. A bisect is a search through the history of a codebase to find the exact change that introduced a behaviour.

  1. XNNPack upstream, xnn_shape_multiply_all_dims never overflow-checked. Commit [redacted], dated 2021-09-28, author Marat Dukhan, subject "Refactor creation and setup of Operators from Nodes", PiperOrigin-RevId 399455001. The report says this function is a simple batch_size *= shape->dim[i] loop with no overflow check and has never had one. get_tensor_size multiplies the result by xnn_datatype_size_bits in uint64_t, which wraps for sufficiently large shapes, causing workspace underallocation. In plain words: the code that works out how big a tensor is has always been able to roll over, and nobody had guarded it.
  2. Became web-reachable, InsertPadOperation introduced with unchecked SerializeTemporaryTensor. Commit [redacted], dated 2024-03-12, author Junwei Fu, subject "webnn: Support Conv2d in TFLite converter", review at https://chromium-review.googlesource.com/c/chromium/src/+/5337479. This commit introduced InsertPadOperation using SerializeTemporaryTensor() (no byte-size check) to create internal PAD output tensors. The function validates that individual dimensions fit in int32_t but never checks the total byte size against tensor_byte_length_limit. int32_t is a 32-bit signed integer; tensor_byte_length_limit is the configured maximum size a tensor is allowed to have. The pool2d path was added subsequently and reuses the same function.
  3. Checked variant introduced but InsertPadOperation not updated. Commit [redacted], dated 2025-10-31, author Lynne Jiang, subject "webnn: Enable temp tensor byte size check.", review at https://chromium-review.googlesource.com/c/chromium/src/+/7092679. This commit introduced SerializeTemporaryTensorWithByteSizeCheck() and updated one call site (the float16-to-float32 cast dequantize path), but InsertPadOperation and other callers of SerializeTemporaryTensor were not updated. A call site is a place in the code that calls a function. Dequantize means converting compressed low-precision numbers back to a more precise form.

What made it look wrong is the combination: a temporary tensor is created with dimensions that pass per-dimension int32_t validation but whose product, multiplied by the datatype width, exceeds UINT64_MAX. UINT64_MAX is the largest value a 64-bit unsigned integer can hold. The safe helper already existed in the codebase but was not used on this path.

Exploitation

Step 1: understand the translation path

When maxPool2d or averagePool2d receives explicit padding that cannot be expressed as TFLite SAME or VALID, SerializePool2d calls InsertPadOperation to emit a separate PAD node ahead of the pool. InsertPadOperation computes the padded output dimensions with checked arithmetic, verifying that each individual dimension fits in int32_t, then creates the tensor:

C
// services/webnn/tflite/graph_builder_tflite.cc:3563-3565
const TensorIndex output_tensor_index =
    SerializeTemporaryTensor(output_shape, input_tensor_info.data_type,
                             input_tensor_info.quantize_params);

Line by line:

  1. The comment names the file and line numbers, so a reader can find the code in the Chromium source tree.
  2. const TensorIndex output_tensor_index = declares a variable that will hold the identifier of the new tensor. const means it will not be reassigned.
  3. SerializeTemporaryTensor(output_shape, input_tensor_info.data_type, calls the function that creates the tensor, passing the shape (the list of dimensions), the data type (for example 32-bit float), and
  4. input_tensor_info.quantize_params); the quantisation parameters, which describe how numbers are scaled and offset when stored compactly. Quantisation is a way of storing numbers in fewer bits.

SerializeTemporaryTensor accepts any dimensions without validating total byte size:

C
// services/webnn/tflite/graph_builder_tflite.cc:3063-3074
TensorIndex GraphBuilderTflite::SerializeTemporaryTensor(
    base::span<const int32_t> dimensions,
    ::tflite::TensorType tensor_type,
    QuantizateParametersOffset quantize_params) {
  const TensorIndex temporary_tensor_index =
      base::checked_cast<TensorIndex>(tensors_.size());
  tensors_.emplace_back(::tflite::CreateTensor(
      builder_, builder_.CreateVector<int32_t>(dimensions), tensor_type,
      /*buffer=*/0, /*name=*/0, quantize_params));
  return temporary_tensor_index;
}

Line by line:

  1. The comment again gives the file and line range.
  2. TensorIndex GraphBuilderTflite::SerializeTemporaryTensor( is the function signature: it belongs to the GraphBuilderTflite class and returns a TensorIndex.
  3. base::span<const int32_t> dimensions, is the list of dimensions, each a 32-bit signed integer. A span is a lightweight view over a range of values.
  4. ::tflite::TensorType tensor_type, is the element type of the tensor.
  5. QuantizateParametersOffset quantize_params) { is the quantisation parameters (the spelling in the original is kept).
  6. const TensorIndex temporary_tensor_index = prepares to record the new tensor's index.
  7. base::checked_cast<TensorIndex>(tensors_.size()); converts the current number of tensors to the index type, with a runtime check that the conversion is safe.
  8. tensors_.emplace_back(::tflite::CreateTensor( adds a new tensor to the list, built by CreateTensor.
  9. builder_, builder_.CreateVector<int32_t>(dimensions), tensor_type, passes the builder, the dimensions as a vector, and the element type.
  10. /*buffer=*/0, /*name=*/0, quantize_params)); sets the buffer and name to zero (meaning none) and passes the quantisation parameters. Note that nothing here checks the total byte size.
  11. return temporary_tensor_index; returns the index of the new tensor.
  12. } closes the function.

The codebase already provides a safe alternative, SerializeTemporaryTensorWithByteSizeCheck, which validates byte length against context_properties_.tensor_byte_length_limit before creation. InsertPadOperation does not use it. In everyday terms: there is a door with a lock right next to the one being used, but this path walks through the unlocked door.

Step 2: understand the size arithmetic in XNNPack

XNNPack delegates the resulting PAD node and computes workspace requirements in get_tensor_size:

C
// third_party/xnnpack/src/src/tensor.c:779-781
uint64_t size_bits = xnn_datatype_size_bits(datatype);
size_bits *= xnn_shape_multiply_all_dims(shape);
return (size_bits + 7) >> 3;

Line by line:

  1. The comment gives the file and line numbers in the XNNPack source.
  2. uint64_t size_bits = xnn_datatype_size_bits(datatype); starts with the number of bits one element takes (for example 32 for a float).
  3. size_bits *= xnn_shape_multiply_all_dims(shape); multiplies that by the total number of elements. This is the multiplication that can wrap around.
  4. return (size_bits + 7) >> 3; converts bits to bytes by adding 7 (to round up) and shifting right by 3, which is the same as dividing by 8. Shifting is a fast way to divide by powers of two.

xnn_shape_multiply_all_dims returns a size_t product of all dimensions:

C
// third_party/xnnpack/src/src/tensor.c:636-644
size_t xnn_shape_multiply_all_dims(const struct xnn_shape* shape) {
  size_t batch_size = 1;
  for (size_t i = 0; i < shape->num_dims; i++) {
    batch_size *= shape->dim[i];
  }
  return batch_size;
}

Line by line:

  1. The comment gives the file and line numbers.
  2. size_t xnn_shape_multiply_all_dims(const struct xnn_shape* shape) { is the function signature. size_t is an unsigned integer type sized for the machine, typically 64 bits on x64.
  3. size_t batch_size = 1; starts the running product at 1, because multiplying by 1 changes nothing.
  4. for (size_t i = 0; i < shape->num_dims; i++) { loops over each dimension.
  5. batch_size *= shape->dim[i]; multiplies the running product by that dimension. No check is made for overflow.
  6. } closes the loop.
  7. return batch_size; returns the product.
  8. } closes the function.

Neither multiplication is overflow-checked. For a padded tensor shape [1, 32768, 32770, 536838146], the element count is 576,460,752,303,516,672. Multiplying by 32 bits yields 18,446,744,073,712,533,504, which exceeds UINT64_MAX by exactly 4,194,304. The wrapped size_bits value is 4,194,304, producing a workspace allocation of 524,288 bytes (512 KB). In everyday terms: the odometer rolls over, so the program thinks it needs a shoebox when it actually needs a warehouse.

Step 3: choose pool parameters that produce the padded shape

The PoC constructs this condition through maxPool2d with the following parameters: input [1, 1, 1, 536838146], window [32768, 32770], strides [32768, 32770], and padding [32767, 0, 32769, 0]. The pool's output shape is [1, 1, 1, 536838146], which passes all WebNN validation, while the internal padded shape overflows XNNPack's size computation. Using strides equal to the window dimensions keeps the max-pooling indirection buffer at approximately 24 GB, which the report describes as large but within the reach of servers and workstations. A stride is how far the window moves each step; Using strides equal to the window dimensions keeps the max-pooling indirection buffer at approximately 24 GB.

Step 4: build and serve the PoC

Serve the PoC and launch Chrome with the ASAN build:

Line by line:

  1. python3 -m http.server 8888 --directory issue_tflite005_xnnpack_pad_oob --bind [redacted] & starts a tiny web server using Python's built-in HTTP server module. It serves the directory issue_tflite005_xnnpack_pad_oob on port 8888, bound only to the loopback address [redacted] (the local machine), and the trailing & puts it in the background so the next command can run.
  2. ASAN_OPTIONS=detect_odr_violation=0 out/asan-release/chrome \ sets an environment variable for the ASAN runtime. detect_odr_violation=0 sets an ASAN runtime option. Then it runs the ASAN Chrome binary. Then it runs the ASAN Chrome binary.
  3. --no-sandbox \ disables Chrome's process sandbox. The sandbox is a security boundary that restricts what a process can do; --no-sandbox disables Chrome's process sandbox.
  4. --enable-features=WebMachineLearningNeuralNetwork \ turns on the WebNN feature flag.
  5. --user-data-dir=/tmp/poc-$(date +%s) \ gives Chrome a fresh temporary profile directory, named with the current Unix time so each run starts clean.
  6. http://[redacted]:8888/poc.html is the page to open, served by the Python server.

The report does not include the contents of poc.html.

Step 5: observe the crash

Graph construction takes approximately 60 to 90 seconds because of the roughly 24 GB max-pooling indirection buffer. After dispatch, the GPU process crashes immediately with an ASAN heap-buffer-overflow WRITE:

Text
==PID==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7b7439c02820
WRITE of size 16 at 0x7b7439c02820 thread T79 (ThreadPoolForeg)
    #0 xnn_xx_fill_ukernel__sse2_u64 xx-fill-sse2-u64.c:32
    ...
    #9 xnn_run_operator_with_index operator-run.c:2147
    #10 xnn_invoke_runtime runtime.c:1143
    #11 tflite::xnnpack::SubgraphInvoke(...) xnnpack_delegate.cc:1429
    ...
    #15 webnn::tflite::GraphImplTflite::ComputeResources::DoDispatch(...) graph_impl_tflite.cc:328

0x7b7439c02820 is located 0 bytes after 524320-byte region [0x7b7439b82800,0x7b7439c02820)
allocated by thread T79 (ThreadPoolForeg) here:
    #1 xnn_aligned_allocate allocator.c:46
    #2 xnn_plan_memory allocator.h:60
    #3 tflite::xnnpack::SubgraphPrepare(...) xnnpack_delegate.cc:1266

SUMMARY: AddressSanitizer: heap-buffer-overflow xx-fill-sse2-u64.c:32 in xnn_xx_fill_ukernel__sse2_u64

Line by line:

  1. ==PID==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7b7439c02820 is ASAN announcing that a memory access went out of bounds at that address. PID stands for process identifier.
  2. WRITE of size 16 at 0x7b7439c02820 thread T79 (ThreadPoolForeg) says the offending operation was a 16-byte write, performed by a worker thread in the thread pool (the background workers that run the maths).
  3. #0 xnn_xx_fill_ukernel__sse2_u64 xx-fill-sse2-u64.c:32 is the innermost function in the stack trace: a fill routine written with SSE2 instructions (a set of CPU instructions for handling several numbers at once).
  4. The ... lines are omitted frames.
  5. #9 xnn_run_operator_with_index operator-run.c:2147 and #10 xnn_invoke_runtime runtime.c:1143 are XNNPack functions that run an operator and the runtime.
  6. #11 tflite::xnnpack::SubgraphInvoke(...) xnnpack_delegate.cc:1429 is the TFLite delegate calling into XNNPack.
  7. #15 webnn::tflite::GraphImplTflite::ComputeResources::DoDispatch(...) graph_impl_tflite.cc:328 is the WebNN TFLite backend dispatching the graph.
  8. 0x7b7439c02820 is located 0 bytes after 524320-byte region [0x7b7439b82800,0x7b7439c02820) tells us the write landed exactly at the end of a 524,320-byte allocation. The write landed exactly at the end of a 524,320-byte allocation.
  9. allocated by thread T79 (ThreadPoolForeg) here: begins the stack trace of where that memory was reserved.
  10. #1 xnn_aligned_allocate allocator.c:46 and #2 xnn_plan_memory allocator.h:60 are the allocator and memory planner.
  11. #3 tflite::xnnpack::SubgraphPrepare(...) xnnpack_delegate.cc:1266 is the preparation step that planned the workspace.
  12. SUMMARY: AddressSanitizer: heap-buffer-overflow xx-fill-sse2-u64.c:32 in xnn_xx_fill_ukernel__sse2_u64 is ASAN's one-line summary.

The PAD operator's SSE2 fill kernel writes zero-padding into the workspace following the true 4D strides. After approximately 131,072 float writes the kernel crosses the 512 KB boundary and corrupts adjacent heap memory, which ASAN detects as a heap-buffer-overflow WRITE. The report says the complete ASAN log is in asan.log, which is not reproduced in the text.

Root cause

The vulnerability spans two components: the Chromium WebNN translation layer and XNNPack's tensor size arithmetic.

In Chromium, InsertPadOperation creates an internal PAD output tensor through SerializeTemporaryTensor, which checks that each dimension fits in int32_t but not that the total byte size is within tensor_byte_length_limit. A safe helper, SerializeTemporaryTensorWithByteSizeCheck, exists and is used on at least one other path (the float16-to-float32 cast dequantize path), but not here. The pool2d path was added later and reused the unchecked function.

In XNNPack, xnn_shape_multiply_all_dims multiplies dimensions in size_t without an overflow check, and get_tensor_size multiplies the result by the datatype width in uint64_t without an overflow check. For the chosen shape the second multiplication wraps, so the memory planner allocates a 512 KB workspace while the kernel writes according to the true dimensions.

Why the existing defences did not stop it: WebNN validation accepts the pool output shape, and the per-dimension int32_t check in the translator passes. The byte-size limit check that would have caught the temporary tensor is implemented in a helper that this call site does not use. The report does not describe any other mitigation that was in place.

Impact

The report describes an immediate heap buffer overflow write in the GPU process, triggered by a web page that builds a WebNN graph with the described pool parameters. The write is performed by the PAD fill kernel after it crosses the underallocated workspace boundary. The conditions are a Chrome build with the TFLite WebNN backend active, the WebNN feature enabled, and sufficient memory for the large indirection buffer. The report lists Linux, macOS, Windows and ChromeOS as affected platforms where the backend is active.

Fix

The original report does not state which change fixed the issue. It identifies the missing check in InsertPadOperation and the unchecked multiplications in XNNPack, and it notes that SerializeTemporaryTensorWithByteSizeCheck already exists and validates byte length against context_properties_.tensor_byte_length_limit. On the evidence in the report, the fix would be to route InsertPadOperation (and the other remaining callers of SerializeTemporaryTensor) through the byte-size-checked helper, and to add overflow checks to the XNNPack size arithmetic.

Variants to test

  1. Other WebNN operations that create temporary tensors through SerializeTemporaryTensor. A positive result is a temporary tensor whose dimensions pass per-dimension validation but whose total byte size exceeds tensor_byte_length_limit, followed by an ASAN report in the GPU process.
  2. averagePool2d with explicit padding that cannot be expressed as SAME or VALID. The report says the pool2d path is shared, so the same padded shape construction should reach InsertPadOperation. A positive result is the same wrapped workspace size and an out-of-bounds write in the fill kernel.
  3. Other datatype widths on the same path. The wrap depends on the product of element count and datatype width, so different widths shift the shape needed to exceed UINT64_MAX. A positive result is a wrapped size_bits value and a workspace smaller than the true tensor.
  4. Other XNNPack operators whose workspace is planned from get_tensor_size. A positive result is an allocation smaller than the dimensions the kernel writes, detected by ASAN as a heap-buffer-overflow WRITE.
  5. Other callers of xnn_shape_multiply_all_dims. A positive result is a shape whose dimension product overflows size_t or whose bit-size product overflows uint64_t without a check.

Glossary

  • API: a defined set of rules a program or web page uses to ask another piece of software to do something.
  • ASAN (AddressSanitizer): a debugging tool that watches memory accesses and reports out-of-bounds reads and writes.
  • averagePool2d: a WebNN operation that slides a window over data and outputs the average of each window.
  • bisect: a search through a codebase's history to find the change that introduced a behaviour.
  • call site: a place in source code where a function is called.
  • commit: a saved snapshot of source code in a version-control system, identified by a hash.
  • dequantize: converting compact low-precision numbers back to a more precise representation.
  • feature flag: a switch that enables or disables an experimental feature at runtime.
  • GPU process: the Chrome process that handles graphics and, in this setup, delegated maths.
  • heap: the area of memory a program uses for dynamically allocated data.
  • heap buffer overflow / heap out-of-bounds write: writing past the end of a reserved block of heap memory into neighbouring memory.
  • indirection buffer: an internal table of pointers telling the pooling code where each window begins.
  • integer overflow: when a fixed-size number container is asked to hold a value too large for it, and the value wraps around.
  • int32_t: a 32-bit signed integer type.
  • maxPool2d: a WebNN operation that slides a window over data and outputs the maximum of each window.
  • neural network: a series of mathematical steps, often used for tasks such as image recognition.
  • node: one step in a computational graph.
  • padding: extra empty cells added around the edges of data so a sliding window fits neatly.
  • PAD node: a graph step that adds padding cells.
  • pooling: a step that slides a window over data and reduces each window to a single value (maximum or average).
  • proof of concept (PoC): a small demonstration that triggers a vulnerability.
  • quantisation: storing numbers in fewer bits by scaling and offsetting them.
  • SAME / VALID: two standard padding conventions in TFLite.
  • sandbox: a security boundary that restricts what a process can do.
  • size_t: an unsigned integer type sized for the machine, typically 64 bits on x64.
  • SSE2: a set of CPU instructions for processing several numbers at once.
  • stride: how far a sliding window moves each step.
  • tensor: a multi-dimensional array of numbers.
  • tensor_byte_length_limit: the configured maximum byte size a tensor may have.
  • TFLite: a format and runtime for small machine-learning models.
  • uint64_t: an unsigned 64-bit integer type, holding values from 0 to UINT64_MAX.
  • UINT64_MAX: the largest value a 64-bit unsigned integer can hold (18,446,744,073,709,551,615).
  • WebNN: the web API through which a page can build and run neural network graphs.
  • XNNPack: a library of fast maths routines used to run neural network operations.

More by c6eed09fc8b174b0f3eebedcceb1e792

View all

52 more disclosed reports, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.