Uninitialized Use in WebNN (CVE-2026-17858)
The WebNN ONNX Runtime backend only zero-initialises tensors that are directly CPU-accessible, so GPU-backed tensors allocated from the WebGPU execution provider arena skip zeroing. An attacker could potentially read recycled uninitialised GPU memory from other WebNN sessions by reshaping such a tensor into a CPU-readable output.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 55 days
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential vulnerability in the WebNN ONNX Runtime (ORT) backend allows WebGPU Execution Provider device tensors to skip zero-initialization. This happens because the zero-filling implementation in TensorImplOrt is restricted to CPU-accessible tensors, with no hardware-clear fallback. An attacker could potentially leverage this to read uninitialized GPU-arena memory via a graph dispatch laundering technique.
Affected files:
services/webnn/ort/tensor_impl_ort.ccservices/webnn/ort/device_allocator.hservices/webnn/ort/context_impl_ort.ccservices/webnn/webnn_context_impl.ccservices/webnn/ort/graph_impl_ort.ccservices/webnn/public/mojom/tensor_usage_mojom_traits.h
Estimated timestamp from git blame: 2025-11-25
Description
A potential uninitialized GPU-process memory leak exists in Chromium's WebNN ONNX Runtime (ORT) backend implementation. Specifically, in services/webnn/ort/tensor_impl_ort.cc, TensorImplOrt only zero-initializes backing memory when the tensor is directly CPU-accessible (can_access_on_cpu is true):
TensorImplOrt::TensorImplOrt(
mojo::PendingAssociatedReceiver<mojom::WebNNTensor> receiver,
WebNNContextImpl& context,
mojom::TensorInfoPtr tensor_info,
size_t size,
ScopedOrtValue tensor,
bool can_access_on_cpu,
scoped_refptr<DeviceAllocator> device_allocator)
: WebNNTensorImpl(std::move(receiver), context, std::move(tensor_info)),
device_allocator_((std::move(device_allocator))),
tensor_(std::move(tensor)),
size_(size),
can_access_on_cpu_(can_access_on_cpu) {
// Initialize the tensor with zeros, otherwise, reading uninitialized memory
// will get random values.
// TODO(crbug.com/461303833): check whether fast HW clears can be used
// instead.
if (can_access_on_cpu) {
std::ranges::fill(AsSpan(), 0);
}
}
When a tensor is created with default empty usage flags (i.e., readable and writable are omitted or set to false), the WebGPU Execution Provider (EP) allocator is selected as the device allocator (DeviceAllocator::ShouldUse returns true).
Because this allocator operates on GPU device buffers, CanAccessOnCPU() returns false. This causes can_access_on_cpu to be set to false, bypassing the CPU-based std::ranges::fill() zero-initialization logic. Since there is currently no GPU-side hardware-clear fallback implemented (as noted in the code's TODO), the newly allocated GPU buffer contains recycled, uninitialized memory from the ORT WebGPU buffer arena.
An attacker can potentially bypass read restrictions on this uninitialized device tensor by passing it as an input to a graph dispatch operation that performs a bitwise identity transformation (such as reshape) into a CPU-readable output tensor, allowing the uninitialized GPU-process arena contents to be exfiltrated.
Suggested/Potential Steps to Reproduce
Note: These are suggested and potential steps based on source code analysis; our tooling does not currently have the capability to run code to confirm a live proof of concept.
-
Enable the WebNN API (e.g., via
--enable-features=WebMachineLearningNeuralNetworkon Windows supporting the ORT WebGPU EP). -
Create a WebNN GPU context:
JavaScript const ctx = await navigator.ml.createContext({deviceType: 'gpu'}); -
Allocate an input tensor without specified usage parameters, defaulting its usage to empty
{}:JavaScript const A = await ctx.createTensor({dataType: 'float32', shape: [1048576]});This tensor gets allocated from the WebGPU EP device allocator arena and skips zero-initialization.
-
Allocate a second, readable CPU-backed tensor to act as the destination:
JavaScript const B = await ctx.createTensor({dataType: 'float32', shape: [1048576], readable: true}); -
Construct a graph with a
reshapeoperator mapping an inputxtoyof the same shape:JavaScript const builder = new MLGraphBuilder(ctx); const x = builder.input('x', {dataType: 'float32', shape: [1048576]}); const graph = await builder.build({'y': builder.reshape(x, [1048576])}); -
Dispatch the graph, using the uninitialized tensor
Aas input and the readable tensorBas output:JavaScript ctx.dispatch(graph, {'x': A}, {'y': B}); -
Read back the contents of
Bto exfiltrate the uninitialized GPU-arena memory:JavaScript const leaked = await ctx.readTensor(B);
Impact
Because the OrtEnv is a process-wide singleton shared across WebNN contexts, the recycled buffer arena may contain sensitive neural network model weights, intermediate layers, and inputs/outputs from WebNN sessions of other origins running in the same GPU process, leading to a potential cross-origin information leak.
Suggested Fix
Implement a GPU-side (hardware-clear) buffer clear fallback in the TensorImplOrt constructor (or during the WebGPU device tensor creation flow in ContextImplOrt) when can_access_on_cpu is false. The backing WebGPU buffer must be fully zero-initialized on the GPU device before it can be used or referenced by any graph execution operations.
Evaluated with Chrome root at commit: d8b226a3be7c9c1ac9240c09e14698866c82e4ac
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
Data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the zero-initialisation in TensorImplOrt is guarded by a CPU-accessibility check, and no GPU-side clear fallback exists for device-only tensors.
Impact
Because the ORT environment is a process-wide singleton, the recycled buffer arena may contain sensitive model weights and intermediate data from WebNN sessions of other origins in the same GPU process, leading to a potential cross-origin information leak.
What the attacker needed
WebNN API enabled; ORT WebGPU execution provider available; Attacker can run JavaScript in a browser
The fix
A GPU-side hardware-clear fallback should be implemented so that device tensors are fully zero-initialised on the GPU before use.
How it was found
- Enable the WebNN API with the ORT WebGPU execution provider.
- Create a WebNN GPU context.
- Allocate an input tensor with empty usage flags so it uses the GPU device allocator and skips zeroing.
- Allocate a second readable CPU-backed tensor as the destination.
- Build a graph with a reshape operator mapping input to output of the same shape.
- Dispatch the graph using the uninitialised tensor as input and the readable tensor as output, then read the output.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a program asks the computer for fresh memory, that memory may still contain data left over from whatever used it before. Good practice is to wipe it clean before handing it over. Here, tensors (multi-dimensional arrays used for machine learning) that live on the graphics card are not wiped, so a malicious web page might be able to read leftover data from other pages' machine-learning models.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.