Use after free in V8 (CVE-2026-87657)
A same-tag substitution lets a WebAssembly streaming callback be pointed at another live streaming object, so a late URL assignment races a background code-caching callback that copies the same mutable string. The race frees the string's buffer while a copy is still reading it, producing a native heap use-after-free outside the V8 sandbox.
Originally disclosed on Chrome VRP
- Fix shipped in 37 days
Report description
V8 Sandbox Bypass: same-tag Managed<WasmStreaming> substitution races mutable StreamingDecoder::url_ after callback publication and causes a native heap UAF
Bug location
Where do you want to report your vulnerability?
Chrome VRP – Report security issues affecting the Chrome browser. See program rules
Which URL (or repository) have you found the vulnerability in?
https://source.chromium.org/chromium/chromium/src
The problem
Please describe the technical details of the vulnerability
Each WebAssembly.compileStreaming() call creates a distinct WasmStreaming, wraps its std::shared_ptr in Managed<WasmStreaming>, and installs that wrapper as the fulfillment and rejection callback data.
// v8/src/wasm/wasm-js.cc:838-854
std::shared_ptr<WasmStreaming> streaming = std::make_shared<WasmStreaming>(...);
i::DirectHandle<i::Managed<WasmStreaming>> data =
i::Managed<WasmStreaming>::From(i_isolate, 0, streaming);
v8::Function::New(context, i_isolate->wasm_streaming_callback(),
Utils::ToLocal(i::Cast<i::Object>(data)), 1);
WasmStreaming::kManagedTag is exactly kWasmWasmStreamingTag, and WasmStreaming::Unpack() resolves callback data through Managed<WasmStreaming>::ptr(). That exact-tag lookup verifies the native resource type but cannot verify that the live WasmStreaming belongs to the Promise reaction carrying the callback data.
// v8/include/v8-wasm.h:164-168; v8/src/wasm/wasm-js.cc:166-173
static constexpr internal::ExternalPointerTag kManagedTag =
internal::kWasmWasmStreamingTag;
std::shared_ptr<WasmStreaming> WasmStreaming::Unpack(Isolate* isolate,
Local<Value> value) {
auto managed =
i::Cast<i::Managed<WasmStreaming>>(Utils::OpenDirectHandle(*value));
return managed->ptr().as_shared_ptr();
}
With arbitrary read/write access inside the V8 sandbox, the PoC copies request B's genuine live external-pointer handle into the callback-data Foreign of another streaming request. The other request's fulfillment callback consequently obtains B's live WasmStreaming. The external-pointer entry, ManagedPtrDestructor, and WasmStreaming are all still valid.
Blink obtains the WasmStreaming from args.Data() but obtains the Response independently from args[0]. StreamFromResponseCallback() writes that response's URL, optionally installs its code-caching callback, and only then starts body loading; it performs no request-identity check.
// third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc:493-498,528,600-625
std::shared_ptr<v8::WasmStreaming> streaming =
v8::WasmStreaming::Unpack(args.GetIsolate(), args.Data());
Response* response = V8Response::ToWrappable(args.GetIsolate(), args[0]);
// ...
streaming->SetUrl(url_utf8.c_str(), url_utf8.size());
if (cache_handler) {
streaming->SetMoreFunctionsCanBeSerializedCallback(...);
}
response->BodyBuffer()->StartLoading(...);
StreamingDecoder retains one mutable std::string. shared_url() shares that same object instead of taking an immutable value snapshot, while SetUrl() performs an unchecked std::string::assign() on it.
// v8/src/wasm/streaming-decoder.h:124-129,169-181
std::shared_ptr<const std::string> shared_url() const { return url_; }
void SetUrl(base::Vector<const char> url) {
url_->assign(url.begin(), url.size());
}
StreamState stream_state_{kReceivingBytes};
const std::shared_ptr<std::string> url_ = std::make_shared<std::string>();
WasmStreamingImpl::SetMoreFunctionsCanBeSerializedCallback() captures this shared mutable string and later copies *url while a V8 compilation callback constructs CompiledWasmModule.
// v8/src/wasm/wasm-js.cc:98-105
streaming_decoder_->SetMoreFunctionsCanBeSerializedCallback(
[callback = std::move(callback),
url = streaming_decoder_->shared_url()](
const std::shared_ptr<i::wasm::NativeModule>& native_module) {
callback(CompiledWasmModule{native_module, *url});
});
The API contract says SetUrl() must run before Finish(), but the implementation neither checks stream_state_ nor synchronizes with CompilationStateImpl::callbacks_mutex_. A substituted request can therefore call SetUrl() on an already-finished decoder while TriggerCodeCachingAfterTimeoutTask::Run() reaches CompilationStateImpl::TriggerCallbacks() and copies the same string on a V8 background thread.
The PoC uses already-aborted data-URL responses for these late URL changes. Blink executes SetUrl() first, then BodyStreamBuffer::StartLoading() observes the abort. Because normal completion already moved the decoder's processors out, the subsequent StreamingDecoder::Abort() returns without delivering bytes to the finished stream or removing the callback already published to CompilationState.
The dangling pointer is produced in libc++'s long-string copy path. For the attached result, the first late assignment uses a 17,036,831-byte URL, producing a 17,036,832-byte allocation with public capacity 17,036,831. The background copy snapshots the old data pointer and length, then allocates its destination. Concurrently, a second late assignment uses a 17,036,832-byte URL, which is one byte beyond the old capacity; std::string::__grow_by_and_replace() allocates replacement storage and frees the old buffer. The pending __asan_memmove() then reads 17,036,832 bytes, including the terminator, through the dangling old pointer.
PoC
The attachments are poc.html, server.py, and asan.log. server.py embeds an unmodified XZ/base64 encoding of the published @ffmpeg/core 0.12.10 dist/umd/ffmpeg-core.wasm, obtained during packaging from https://cdn.jsdelivr.net/npm/@ ffmpeg/[email protected]/dist/umd/ffmpeg-core.wasm; the decoded bytes are 32,232,419 bytes with SHA-256 9f57947a5bd530d8f00c5b3f2cb2a3492faa7e5d823315342d6a8656d0a6b7b7. It verifies those bytes and serves only poc.html and /module.wasm from 127.0.0.1. This endpoint is required because FetchManager::Loader::DidReceiveResponse() creates ScriptCachedMetadataHandler for an HTTP-family application/wasm response (third_party/blink/renderer/core/fetch/fetch_manager.cc:723-741), and StreamFromResponseCallback() installs the V8 caching callback only when that handler exists (third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc:600-625). The PoC does not contact the packaging URL and uses no separate .wasm file.
The page creates finished victim streams, copies each victim's genuine live kWasmWasmStreamingTag handle into pending compileStreaming() callback-data Foreign objects, and drives default tiering so late SetUrl() calls race the code-caching callback.
The frozen package reproduced the target UAF in 17 of 30 isolated launches of the official build (56.7%). A missed race normally closes the page; repeat the same Chrome command while leaving server.py running.
Reproduce
Confirmed in asan-v8-sandbox-testing-linux-release-1669311.zip.
In one terminal, start the fixed loopback endpoint:
python3 /path/to/server.py
After it prints the readiness line, run the official sandbox-testing ASan build in a second terminal:
/path/to/chrome \
--headless=new \
--incognito \
'--js-flags=--run-as-sandbox-security-poc' \
http://127.0.0.1:8181/poc.html
Impact analysis
An attacker with arbitrary read/write access inside the V8 sandbox can redirect an ordinary WebAssembly.compileStreaming() callback to another live exact-tag WasmStreaming and trigger a cross-thread heap UAF in native libc++ storage outside the sandbox.
The cause
What version of Chrome have you found the security issue in?
153.0.7978.0
Is the security issue related to a crash?
Yes, it is related to a crash.
Choose the type of vulnerability
Sandbox Escape
Context
V8 is Chrome's JavaScript and WebAssembly engine, and it runs inside the V8 sandbox, a heap sandbox that is meant to contain memory corruption bugs in the engine. The feature at the centre of this report is WebAssembly.compileStreaming(), which fetches a WebAssembly module over the network and compiles it while the body is still arriving, rather than buffering the whole response first.
Each call to WebAssembly.compileStreaming() creates a distinct WasmStreaming object, wraps its std::shared_ptr in a Managed<WasmStreaming>, and installs that wrapper as the data for the fulfillment and rejection callbacks of the returned Promise. When the response arrives, Blink's StreamFromResponseCallback() unpacks the WasmStreaming from the callback data, takes the Response from the first callback argument, records the response URL on the streaming decoder, optionally installs a code-caching callback, and starts loading the body.
The bug is a use-after-free in native libc++ storage outside the sandbox, reached by substituting one live WasmStreaming for another through the callback data and then racing a mutable URL string across threads. The report classifies it as a sandbox escape, with a medium severity and a 1,000 USD bounty under the Chrome VRP. It was found in Chrome 153.0.7978.0 and disclosed on 8 September 2026.
Setup
The researcher is Jihyeon Jeong of Compsec Lab, Seoul National University, working as a research intern. The report was filed under the Chrome VRP, against the Chromium source repository at https://source.chromium.org/chromium/chromium/src.
The precondition is significant: the attacker already has arbitrary read/write access inside the V8 sandbox. The PoC is therefore a sandbox escape primitive, not an entry point. It was confirmed against the official sandbox-testing ASan build, asan-v8-sandbox-testing-linux-release-1669311.zip, and the PoC is designed to be run with the --run-as-sandbox-security-poc JavaScript flag that this build understands.
The attachments are poc.html, server.py and asan.log. server.py embeds an unmodified XZ/base64 encoding of the published @ffmpeg/core 0.12.10 dist/umd/ffmpeg-core.wasm, obtained during packaging from https://cdn.jsdelivr.net/npm/@ ffmpeg/[redacted]/dist/umd/ffmpeg-core.wasm. The decoded bytes are 32,232,419 bytes with SHA-256 [redacted]. The server verifies those bytes and serves only poc.html and /module.wasm from [redacted]. The PoC does not contact the packaging URL and uses no separate .wasm file.
The loopback HTTP endpoint is not incidental. FetchManager::Loader::DidReceiveResponse() creates a ScriptCachedMetadataHandler for an HTTP-family application/wasm response (third_party/blink/renderer/core/fetch/fetch_manager.cc:723-741), and StreamFromResponseCallback() installs the V8 caching callback only when that handler exists (third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc:600-625). Without the caching callback there is no background copy of the URL string to race against.
Finding it
The starting observation is that the callback data identifies a native resource by tag, not by request. WasmStreaming::kManagedTag is exactly kWasmWasmStreamingTag, and WasmStreaming::Unpack() resolves callback data through Managed<WasmStreaming>::ptr():
// v8/include/v8-wasm.h:164-168; v8/src/wasm/wasm-js.cc:166-173
static constexpr internal::ExternalPointerTag kManagedTag =
internal::kWasmWasmStreamingTag;
std::shared_ptr<WasmStreaming> WasmStreaming::Unpack(Isolate* isolate,
Local<Value> value) {
auto managed =
i::Cast<i::Managed<WasmStreaming>>(Utils::OpenDirectHandle(*value));
return managed->ptr().as_shared_ptr();
}
That exact-tag lookup verifies the native resource type, but it cannot verify that the live WasmStreaming belongs to the Promise reaction carrying the callback data. Any live WasmStreaming with the same tag will pass.
The second half of the problem is in Blink. StreamFromResponseCallback() obtains the WasmStreaming from args.Data() but obtains the Response independently from args[0]. It writes that response's URL, optionally installs its code-caching callback, and only then starts body loading. There is no request-identity check between the two:
// third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc:493-498,528,600-625
std::shared_ptr<v8::WasmStreaming> streaming =
v8::WasmStreaming::Unpack(args.GetIsolate(), args.Data());
Response* response = V8Response::ToWrappable(args.GetIsolate(), args[0]);
// ...
streaming->SetUrl(url_utf8.c_str(), url_utf8.size());
if (cache_handler) {
streaming->SetMoreFunctionsCanBeSerializedCallback(...);
}
response->BodyBuffer()->StartLoading(...);
The third element is the URL storage itself. StreamingDecoder retains one mutable std::string. shared_url() shares that same object instead of taking an immutable value snapshot, while SetUrl() performs an unchecked std::string::assign() on it:
// v8/src/wasm/streaming-decoder.h:124-129,169-181
std::shared_ptr<const std::string> shared_url() const { return url_; }
void SetUrl(base::Vector<const char> url) {
url_->assign(url.begin(), url.size());
}
StreamState stream_state_{kReceivingBytes};
const std::shared_ptr<std::string> url_ = std::make_shared<std::string>();
And the caching callback captures that shared mutable string and copies *url later, while a V8 compilation callback constructs CompiledWasmModule:
// v8/src/wasm/wasm-js.cc:98-105
streaming_decoder_->SetMoreFunctionsCanBeSerializedCallback(
[callback = std::move(callback),
url = streaming_decoder_->shared_url()](
const std::shared_ptr<i::wasm::NativeModule>& native_module) {
callback(CompiledWasmModule{native_module, *url});
});
The API contract says SetUrl() must run before Finish(), but the implementation neither checks stream_state_ nor synchronizes with CompilationStateImpl::callbacks_mutex_. A substituted request can therefore call SetUrl() on an already-finished decoder while TriggerCodeCachingAfterTimeoutTask::Run() reaches CompilationStateImpl::TriggerCallbacks() and copies the same string on a V8 background thread. That is the race the report exploits.
Exploitation
Step 1: create the victim streams
The page creates finished victim streams. Each WebAssembly.compileStreaming() call has already produced its own WasmStreaming, wrapped in a Managed<WasmStreaming> and installed as callback data:
// v8/src/wasm/wasm-js.cc:838-854
std::shared_ptr<WasmStreaming> streaming = std::make_shared<WasmStreaming>(...);
i::DirectHandle<i::Managed<WasmStreaming>> data =
i::Managed<WasmStreaming>::From(i_isolate, 0, streaming);
v8::Function::New(context, i_isolate->wasm_streaming_callback(),
Utils::ToLocal(i::Cast<i::Object>(data)), 1);
Because the tag is the same for every instance, a handle to any of these is interchangeable with any other as far as Unpack() is concerned.
Step 2: substitute the callback data
With arbitrary read/write inside the V8 sandbox, the PoC copies request B's genuine live external-pointer handle into the callback-data Foreign of another streaming request. The other request's fulfillment callback consequently obtains B's live WasmStreaming. At this point the external-pointer entry, the ManagedPtrDestructor and the WasmStreaming are all still valid, so nothing crashes and no type check fires.
Step 3: drive the late URL write
The PoC uses already-aborted data-URL responses for the late URL changes. Blink executes SetUrl() first, then BodyStreamBuffer::StartLoading() observes the abort. Because normal completion already moved the decoder's processors out, the subsequent StreamingDecoder::Abort() returns without delivering bytes to the finished stream or removing the callback already published to CompilationState. The substituted request therefore writes a URL into a decoder that has already finished, while the code-caching callback for that decoder is still reachable from the compilation state.
Step 4: race the background copy
The page drives default tiering so that the late SetUrl() calls race the code-caching callback. The dangling pointer is produced in libc++'s long-string copy path. For the attached result, the first late assignment uses a 17,036,831-byte URL, producing a 17,036,832-byte allocation with public capacity 17,036,831. The background copy snapshots the old data pointer and length, then allocates its destination. Concurrently, a second late assignment uses a 17,036,832-byte URL, which is one byte beyond the old capacity; std::string::__grow_by_and_replace() allocates replacement storage and frees the old buffer. The pending __asan_memmove() then reads 17,036,832 bytes, including the terminator, through the dangling old pointer.
Step 5: reproduce
Start the fixed loopback endpoint in one terminal:
python3 /path/to/server.py
After it prints the readiness line, run the official sandbox-testing ASan build in a second terminal:
/path/to/chrome \
--headless=new \
--incognito \
'--js-flags=--run-as-sandbox-security-poc' \
http://[redacted]:8181/poc.html
The command runs the official sandbox-testing ASan build headless and in incognito mode against the loopback page. The page is loaded from the loopback server on port 8181.
The frozen package reproduced the target UAF in 17 of 30 isolated launches of the official build (56.7%). A missed race normally closes the page; the fix is to repeat the same Chrome command while leaving server.py running.
Root cause
Three design decisions combine. First, callback data is validated by external-pointer tag only, so a live WasmStreaming from one request is accepted for another request's reaction. Second, StreamFromResponseCallback() takes the WasmStreaming from args.Data() and the Response from args[0] without checking that they belong together. Third, StreamingDecoder exposes its URL as a shared mutable std::string through shared_url(), and SetUrl() assigns into it without checking stream_state_ or taking CompilationStateImpl::callbacks_mutex_, so a write on the main thread can free the buffer that a background thread is about to copy.
The tag check is doing what it was designed to do, which is to confirm the native resource type. It was never a request-identity check, and the report shows that the gap between the two is exploitable once the sandbox is already compromised. The API contract that SetUrl() runs before Finish() is not enforced in code, so the finished-decoder case is reachable.
Impact
An attacker with arbitrary read/write access inside the V8 sandbox can redirect an ordinary WebAssembly.compileStreaming() callback to another live exact-tag WasmStreaming and trigger a cross-thread heap use-after-free in native libc++ storage outside the sandbox. The corruption is in native libc++ storage outside the sandbox. The report does not describe what an attacker does after the UAF.
Fix
The report does not state which change was made. Fixes that would address the root cause include: bind the callback data to the specific request so that a substituted WasmStreaming is rejected, for example by checking request identity in StreamFromResponseCallback() rather than relying on the external-pointer tag alone; make shared_url() return an immutable snapshot, or copy the URL under a lock, so the background callback never reads storage that the main thread can reallocate; and enforce the documented ordering by checking stream_state_ in SetUrl() and synchronising with CompilationStateImpl::callbacks_mutex_.
Variants to test
- Other
Managed<T>callback data with a shared tag. Look for APIs where a native object is passed to a callback throughManaged<T>and unpacked by tag alone. A positive result is a callback that accepts an object created by a different call to the same API and proceeds without an identity check. - Other Blink callbacks that read the native object from
args.Data()and the DOM object fromargs[0]. A positive result is a handler that acts on the two without verifying they came from the same request. - Other
shared_url()-style accessors that hand out ashared_ptrto mutable storage. A positive result is a background thread reading the string while the main thread reassigns it, visible as an ASan report on the old buffer. - Other setters documented as "call before Finish()" that do not check state. A positive result is a write accepted on an already-finished object that still has a published callback.
- String sizes around the libc++ capacity boundary. The observed trigger used a second assignment one byte beyond the old capacity.
What happened, in plain words
Chrome runs JavaScript and WebAssembly code inside a component called V8. V8 is itself wrapped in a protective layer called the V8 sandbox, whose job is to keep a memory bug inside V8 from reaching the rest of the browser. This report is about a way to get past that protective layer: a bug that lets an attacker who has already broken into the V8 sandbox reach memory outside it.
To understand the bug you need three ideas. The first is WebAssembly.compileStreaming(), a browser function that downloads a WebAssembly module (a compiled program format for the web) and starts compiling it while the download is still arriving, instead of waiting for the whole file. The second is a callback: a function you hand to the browser that the browser promises to call later, when something finishes. The third is a use-after-free: a bug where a program keeps using a piece of memory after it has given that memory back, so the memory may already have been reused for something else.
The short version: each streaming compile gets its own internal object, called WasmStreaming, and the browser stores a reference to it in the callback data. The check that decides whether that reference is acceptable only looks at the type of object, not at which request it came from. So one request's callback can be made to use another request's object. The browser then writes a URL into that other object's internal string, even though that object has already finished its work. Meanwhile a background thread is copying the same string. One thread frees the string's memory while the other is still reading it, and that is the use-after-free. The memory involved lives in the C++ standard library (libc++), outside the sandbox.
The report was filed under the Chrome Vulnerability Reward Program (Chrome VRP). It was found in Chrome 153.0.7978.0, rated medium severity, paid 1,000 USD, and disclosed on 8 September 2026.
Context
The product and the feature
V8 is Chrome's engine for JavaScript and WebAssembly. A browser engine is the part of the browser that reads and runs the code on a web page. WebAssembly, usually shortened to Wasm, is a fast, low-level format that lets code written in other languages run in the browser at near-native speed.
The V8 sandbox is a heap sandbox. A heap is the pool of memory a program uses for its objects at runtime; a sandbox here is a boundary that is supposed to contain memory-corruption bugs inside the engine, so that even if an attacker takes control of V8's memory, they cannot reach the rest of the browser process. Think of it as a fenced play area: a child can run anywhere inside the fence, but the fence is meant to stop them reaching the road.
The feature at the centre of this report is WebAssembly.compileStreaming(). Normally, if you want to compile a Wasm file, you download it completely and then compile it. compileStreaming() does both at once: it fetches the module over the network and compiles it while the body is still arriving. That is faster for large modules, but it means the browser has to keep track of a download and a compilation happening at the same time.
The objects involved
Each call to WebAssembly.compileStreaming() creates a distinct WasmStreaming object. That object is the bookkeeping for one streaming compile. Its lifetime is managed by a std::shared_ptr, a C++ "smart pointer" that keeps a count of how many owners an object has and frees it when the last owner lets go. The pointer is then wrapped in a Managed<WasmStreaming>, a V8 wrapper that ties a native C++ object to a JavaScript-visible value, and that wrapper is installed as the data for two callbacks: the fulfillment callback (called when the fetch succeeds) and the rejection callback (called when it fails). Both callbacks belong to the Promise that compileStreaming() returns. A Promise is JavaScript's way of representing a result that will arrive later.
When the response arrives, a piece of Blink code called StreamFromResponseCallback() runs. Blink is the part of Chrome that implements the web platform: HTML, the DOM, fetch, and so on. This function unpacks the WasmStreaming from the callback data, takes the Response object (the network response) from the first callback argument, records the response URL on the streaming decoder, optionally installs a code-caching callback, and starts loading the body.
What kind of bug it is
The bug is a use-after-free in native libc++ storage outside the sandbox. libc++ is the C++ standard library used by Chrome on this platform; it provides things like std::string. The bug is reached by substituting one live WasmStreaming for another through the callback data, and then racing a mutable URL string across threads. A race, or race condition, is a bug where two threads (two streams of execution inside one program) touch the same data at the same time and the result depends on who gets there first.
The report classifies the issue as a sandbox escape, with medium severity and a 1,000 USD bounty under the Chrome VRP. It was found in Chrome 153.0.7978.0 and disclosed on 8 September 2026.
Setup
Who and where
The researcher is Jihyeon Jeong of Compsec Lab, Seoul National University, working as a research intern. The report was filed under the Chrome VRP, against the Chromium source repository at https://source.chromium.org/chromium/chromium/src. Chromium is the open-source project Chrome is built from.
The precondition
The precondition is significant: the attacker already has arbitrary read/write access inside the V8 sandbox. "Arbitrary read/write" means the attacker can read and change any memory inside the sandbox at will. The PoC (proof of concept, a small program that demonstrates the bug) is therefore a sandbox escape primitive, not an entry point. In other words, it does not get an attacker into the sandbox; it gets an attacker who is already inside the sandbox out of it.
It was confirmed against the official sandbox-testing ASan build, asan-v8-sandbox-testing-linux-release-1669311.zip. ASan, the AddressSanitizer, is a tool built into a special build of the browser that watches memory accesses and reports when code reads or writes memory it should not. The PoC is designed to be run with the --run-as-sandbox-security-poc JavaScript flag that this build understands.
The attachments
The attachments are poc.html, server.py and asan.log. server.py embeds an unmodified XZ/base64 encoding of the published @ffmpeg/core 0.12.10 dist/umd/ffmpeg-core.wasm, obtained during packaging from https://cdn.jsdelivr.net/npm/@ ffmpeg/[redacted]/dist/umd/ffmpeg-core.wasm. XZ is a compression format and base64 is a way of writing binary data as plain text, so the file is a compressed, text-safe copy of a real Wasm module. The decoded bytes are 32,232,419 bytes with SHA-256 [redacted]. SHA-256 is a fingerprint of a file: if the bytes change, the fingerprint changes, so the server can check it is serving exactly the intended file. The server verifies those bytes and serves only poc.html and /module.wasm from [redacted], which is the loopback address, meaning the machine talking to itself. The PoC does not contact the packaging URL and uses no separate .wasm file.
Why a local web server is needed
The loopback HTTP endpoint is not incidental. FetchManager::Loader::DidReceiveResponse() creates a ScriptCachedMetadataHandler for an HTTP-family application/wasm response (third_party/blink/renderer/core/fetch/fetch_manager.cc:723-741), and StreamFromResponseCallback() installs the V8 caching callback only when that handler exists (third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc:600-625). A caching callback is the piece of code that later copies the URL. Without the caching callback there is no background copy of the URL string to race against. Serving the page over HTTP from a local server is what makes Blink create that handler.
Finding it
The tag check
The starting observation is that the callback data identifies a native resource by tag, not by request. A tag is a small label attached to a value that says what type of thing it is. WasmStreaming::kManagedTag is exactly kWasmWasmStreamingTag, and WasmStreaming::Unpack() resolves callback data through Managed<WasmStreaming>::ptr():
// v8/include/v8-wasm.h:164-168; v8/src/wasm/wasm-js.cc:166-173
static constexpr internal::ExternalPointerTag kManagedTag =
internal::kWasmWasmStreamingTag;
std::shared_ptr<WasmStreaming> WasmStreaming::Unpack(Isolate* isolate,
Local<Value> value) {
auto managed =
i::Cast<i::Managed<WasmStreaming>>(Utils::OpenDirectHandle(*value));
return managed->ptr().as_shared_ptr();
}
Line by line:
static constexpr internal::ExternalPointerTag kManagedTag = internal::kWasmWasmStreamingTag;declares a constant namedkManagedTagand sets it to the tag valuekWasmWasmStreamingTag. EveryWasmStreamingwrapper carries this same label.std::shared_ptr<WasmStreaming> WasmStreaming::Unpack(Isolate* isolate, Local<Value> value)is the function that takes a JavaScript value and returns the nativeWasmStreamingbehind it.Isolateis V8's name for one independent JavaScript execution environment.auto managed = i::Cast<i::Managed<WasmStreaming>>(Utils::OpenDirectHandle(*value));converts the incoming value into aManaged<WasmStreaming>wrapper. The cast is the type conversion step.return managed->ptr().as_shared_ptr();pulls the shared pointer out of the wrapper and returns it.
That exact-tag lookup verifies the native resource type, but it cannot verify that the live WasmStreaming belongs to the Promise reaction carrying the callback data. Any live WasmStreaming with the same tag will pass. A comparison: a bouncer checks that your ticket says "concert", but not that it is your ticket, so any concert ticket gets you in.
The missing identity check in Blink
The second half of the problem is in Blink. StreamFromResponseCallback() obtains the WasmStreaming from args.Data() but obtains the Response independently from args[0]. It writes that response's URL, optionally installs its code-caching callback, and only then starts body loading. There is no request-identity check between the two:
// third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc:493-498,528,600-625
std::shared_ptr<v8::WasmStreaming> streaming =
v8::WasmStreaming::Unpack(args.GetIsolate(), args.Data());
Response* response = V8Response::ToWrappable(args.GetIsolate(), args[0]);
// ...
streaming->SetUrl(url_utf8.c_str(), url_utf8.size());
if (cache_handler) {
streaming->SetMoreFunctionsCanBeSerializedCallback(...);
}
response->BodyBuffer()->StartLoading(...);
Line by line:
std::shared_ptr<v8::WasmStreaming> streaming = v8::WasmStreaming::Unpack(args.GetIsolate(), args.Data());gets theWasmStreamingfrom the callback's attached data. This is the object the callback was created with, or, in the attack, whatever object an attacker has put there.Response* response = V8Response::ToWrappable(args.GetIsolate(), args[0]);gets the networkResponsefrom the first argument the browser passed to the callback. This is a separate source of truth from the line above.streaming->SetUrl(url_utf8.c_str(), url_utf8.size());writes the response's URL into the streaming object.if (cache_handler) { streaming->SetMoreFunctionsCanBeSerializedCallback(...); }installs the code-caching callback if a cache handler exists. The...stands for arguments the report does not spell out.response->BodyBuffer()->StartLoading(...);starts loading the response body.
The two objects come from different places and nothing checks that they belong to the same request.
The shared mutable URL
The third element is the URL storage itself. StreamingDecoder retains one mutable std::string. shared_url() shares that same object instead of taking an immutable value snapshot, while SetUrl() performs an unchecked std::string::assign() on it:
// v8/src/wasm/streaming-decoder.h:124-129,169-181
std::shared_ptr<const std::string> shared_url() const { return url_; }
void SetUrl(base::Vector<const char> url) {
url_->assign(url.begin(), url.size());
}
StreamState stream_state_{kReceivingBytes};
const std::shared_ptr<std::string> url_ = std::make_shared<std::string>();
Line by line:
std::shared_ptr<const std::string> shared_url() const { return url_; }hands out a shared pointer to the URL string. Because it is a pointer to the same object, not a copy, every holder sees later changes.void SetUrl(base::Vector<const char> url) { url_->assign(url.begin(), url.size()); }replaces the contents of that string with the new URL.assignis the standard library call that overwrites a string's contents, and it can reallocate the string's memory if the new text does not fit.StreamState stream_state_{kReceivingBytes};records the decoder's state, starting at "receiving bytes".const std::shared_ptr<std::string> url_ = std::make_shared<std::string>();creates the one shared string object that all of the above point at.
The background copy
And the caching callback captures that shared mutable string and copies *url later, while a V8 compilation callback constructs CompiledWasmModule:
// v8/src/wasm/wasm-js.cc:98-105
streaming_decoder_->SetMoreFunctionsCanBeSerializedCallback(
[callback = std::move(callback),
url = streaming_decoder_->shared_url()](
const std::shared_ptr<i::wasm::NativeModule>& native_module) {
callback(CompiledWasmModule{native_module, *url});
});
Line by line:
streaming_decoder_->SetMoreFunctionsCanBeSerializedCallback(starts the call that installs the caching callback on the decoder.[callback = std::move(callback), url = streaming_decoder_->shared_url()](is a lambda, an inline function, that captures two things: the original callback, moved in, and the shared URL pointer fromshared_url().const std::shared_ptr<i::wasm::NativeModule>& native_module) {is the lambda's parameter, the compiled module.callback(CompiledWasmModule{native_module, *url});calls the original callback with aCompiledWasmModulebuilt from the module and the current contents of the URL string. The*urlis the copy that happens later, on whichever thread runs this callback.
The contract that is not enforced
The API contract says SetUrl() must run before Finish(), but the implementation neither checks stream_state_ nor synchronizes with CompilationStateImpl::callbacks_mutex_. A mutex is a lock that lets only one thread use a piece of data at a time; synchronizing with it means taking that lock before touching the data. A substituted request can therefore call SetUrl() on an already-finished decoder while TriggerCodeCachingAfterTimeoutTask::Run() reaches CompilationStateImpl::TriggerCallbacks() and copies the same string on a V8 background thread. That is the race the report exploits.
Exploitation
Step 1: create the victim streams
The page creates finished victim streams. Each WebAssembly.compileStreaming() call has already produced its own WasmStreaming, wrapped in a Managed<WasmStreaming> and installed as callback data:
// v8/src/wasm/wasm-js.cc:838-854
std::shared_ptr<WasmStreaming> streaming = std::make_shared<WasmStreaming>(...);
i::DirectHandle<i::Managed<WasmStreaming>> data =
i::Managed<WasmStreaming>::From(i_isolate, 0, streaming);
v8::Function::New(context, i_isolate->wasm_streaming_callback(),
Utils::ToLocal(i::Cast<i::Object>(data)), 1);
Line by line:
std::shared_ptr<WasmStreaming> streaming = std::make_shared<WasmStreaming>(...);creates a new streaming object for this call.i::DirectHandle<i::Managed<WasmStreaming>> data = i::Managed<WasmStreaming>::From(i_isolate, 0, streaming);wraps it in aManagedobject, which is the value the callback will carry.v8::Function::New(context, i_isolate->wasm_streaming_callback(), Utils::ToLocal(i::Cast<i::Object>(data)), 1);creates the callback function and attaches that wrapper as its data. The final1is the argument count.
Because the tag is the same for every instance, a handle to any of these is interchangeable with any other as far as Unpack() is concerned.
Step 2: substitute the callback data
With arbitrary read/write inside the V8 sandbox, the PoC copies request B's genuine live external-pointer handle into the callback-data Foreign of another streaming request. A Foreign is a V8 value that holds a pointer to something outside V8's own JavaScript objects. The other request's fulfillment callback consequently obtains B's live WasmStreaming. At this point the external-pointer entry, the ManagedPtrDestructor and the WasmStreaming are all still valid, so nothing crashes and no type check fires. The tag check cannot detect the substitution.
Step 3: drive the late URL write
The PoC uses already-aborted data-URL responses for the late URL changes. A data URL is a URL that contains the data inline instead of pointing at a server. Blink executes SetUrl() first, then BodyStreamBuffer::StartLoading() observes the abort. Because normal completion already moved the decoder's processors out, the subsequent StreamingDecoder::Abort() returns without delivering bytes to the finished stream or removing the callback already published to CompilationState. The substituted request therefore writes a URL into a decoder that has already finished, while the code-caching callback for that decoder is still reachable from the compilation state. In plain terms: the object is done, but its callback is still registered and can still run.
Step 4: race the background copy
The page drives default tiering so that the late SetUrl() calls race the code-caching callback. Tiering is the engine's strategy of compiling code in stages, starting with a quick version and later producing a more optimised one.
The dangling pointer is produced in libc++'s long-string copy path. A dangling pointer is a pointer to memory that has already been freed. For the attached result, the first late assignment uses a 17,036,831-byte URL, producing a 17,036,832-byte allocation with public capacity 17,036,831. Capacity is how much text a string can hold before it has to allocate new memory. The background copy snapshots the old data pointer and length, then allocates its destination. Concurrently, a second late assignment uses a 17,036,832-byte URL, which is one byte beyond the old capacity; std::string::__grow_by_and_replace() allocates replacement storage and frees the old buffer. The pending __asan_memmove() then reads 17,036,832 bytes, including the terminator, through the dangling old pointer. __asan_memmove() is the AddressSanitizer's checked version of the memory-copy routine, and the terminator is the zero byte that marks the end of a C-style string.
The sequence in order:
- The first late assignment makes the string allocate a buffer of 17,036,832 bytes, with room for 17,036,831 characters.
- The background copy records where the old buffer is and how long it is, then starts allocating its own destination.
- The second late assignment is one byte too long for the old buffer, so the string allocates a new buffer and frees the old one.
- The background copy now reads from the old, freed buffer. ASan reports the read.
Step 5: reproduce
Start the fixed loopback endpoint in one terminal:
python3 /path/to/server.py
This runs the Python server script, which serves the page and the Wasm module from the local machine.
After it prints the readiness line, run the official sandbox-testing ASan build in a second terminal:
/path/to/chrome \
--headless=new \
--incognito \
'--js-flags=--run-as-sandbox-security-poc' \
http://[redacted]:8181/poc.html
Line by line:
/path/to/chromeis the browser binary from the ASan sandbox-testing build.http://[redacted]:8181/poc.htmlloads the page from the loopback server on port 8181.
The frozen package reproduced the target UAF in 17 of 30 isolated launches of the official build (56.7%). A missed race normally closes the page; the fix is to repeat the same Chrome command while leaving server.py running. A race is timing-dependent, so a single run can miss it.
Root cause
Three design decisions combine.
- Callback data is validated by external-pointer tag only, so a live
WasmStreamingfrom one request is accepted for another request's reaction. StreamFromResponseCallback()takes theWasmStreamingfromargs.Data()and theResponsefromargs[0]without checking that they belong together.StreamingDecoderexposes its URL as a shared mutablestd::stringthroughshared_url(), andSetUrl()assigns into it without checkingstream_state_or takingCompilationStateImpl::callbacks_mutex_, so a write on the main thread can free the buffer that a background thread is about to copy.
The tag check is doing what it was designed to do, which is to confirm the native resource type. It was never a request-identity check, and the report shows that the gap between the two is exploitable once the sandbox is already compromised. The API contract that SetUrl() runs before Finish() is not enforced in code, so the finished-decoder case is reachable.
Impact
An attacker with arbitrary read/write access inside the V8 sandbox can redirect an ordinary WebAssembly.compileStreaming() callback to another live exact-tag WasmStreaming and trigger a cross-thread heap use-after-free in native libc++ storage outside the sandbox. The corruption is in native libc++ storage outside the sandbox. The report does not describe what an attacker does after the UAF.
Fix
The report does not state which change was made. Fixes that would address the root cause include:
- Bind the callback data to the specific request so that a substituted
WasmStreamingis rejected, for example by checking request identity inStreamFromResponseCallback()rather than relying on the external-pointer tag alone. - Make
shared_url()return an immutable snapshot, or copy the URL under a lock, so the background callback never reads storage that the main thread can reallocate. - Enforce the documented ordering by checking
stream_state_inSetUrl()and synchronising withCompilationStateImpl::callbacks_mutex_.
Variants to test
- Other
Managed<T>callback data with a shared tag. Look for APIs where a native object is passed to a callback throughManaged<T>and unpacked by tag alone. A positive result is a callback that accepts an object created by a different call to the same API and proceeds without an identity check. - Other Blink callbacks that read the native object from
args.Data()and the DOM object fromargs[0]. A positive result is a handler that acts on the two without verifying they came from the same request. - Other
shared_url()-style accessors that hand out ashared_ptrto mutable storage. A positive result is a background thread reading the string while the main thread reassigns it, visible as an ASan report on the old buffer. - Other setters documented as "call before Finish()" that do not check state. A positive result is a write accepted on an already-finished object that still has a published callback.
- String sizes around the libc++ capacity boundary. The observed trigger used a second assignment one byte beyond the old capacity.
Glossary
- API: a defined set of functions and rules that one piece of software offers to another, so they can talk to each other without knowing each other's internals.
- ASan (AddressSanitizer): a tool built into a special browser build that watches memory accesses and reports reads or writes to memory that has been freed or was never allocated.
- Base64: a way of writing binary data using only plain text characters, so it can be stored or sent safely.
- Blink: the part of Chrome that implements the web platform, such as HTML, the DOM and fetch.
- Callback: a function you give to another piece of code, which that code promises to call later when something happens.
- Capacity: how much data a string can hold before it must allocate a new, larger block of memory.
- Chrome VRP: the Chrome Vulnerability Reward Program, Google's scheme that pays people who report security bugs in Chrome.
- Chromium: the open-source project that Chrome is built from.
- Code-caching callback: the callback that saves compiled code so it can be reused later; in this report it is the code that copies the URL on a background thread.
- CompiledWasmModule: the object that represents a compiled WebAssembly module.
- Dangling pointer: a pointer that still refers to a block of memory after that memory has been freed.
- Data URL: a URL that carries its data inline instead of pointing to a server.
- DOM: the tree of objects a browser builds to represent the elements of a web page.
- External pointer: a pointer from V8's JavaScript world to a native object outside it.
- Foreign: a V8 value that holds a pointer to something outside V8's own JavaScript objects.
- Heap: the pool of memory a program uses for its objects while it runs.
- HTTP: the protocol browsers and servers use to exchange web pages and other resources.
- Isolate: V8's name for one independent JavaScript execution environment.
- Lambda: an inline function in C++ that can capture variables from the code around it.
- libc++: the C++ standard library implementation used by Chrome on this platform, which provides things like
std::string. - Loopback address: the address
[redacted], which means the machine talking to itself. - Managed<T>: a V8 wrapper that ties a native C++ object of type
Tto a JavaScript-visible value. - Mutex: a lock that lets only one thread use a piece of data at a time.
- PoC (proof of concept): a small program that demonstrates a bug in practice.
- Promise: JavaScript's way of representing a result that will arrive later, with callbacks for success and failure.
- Race condition: a bug where two threads touch the same data at the same time and the outcome depends on who gets there first.
- Sandbox: a boundary that is supposed to contain bugs or attacks inside a limited area.
- Sandbox escape: a bug that lets an attacker who is already inside a sandbox reach outside it.
- SHA-256: a fingerprint of a file's bytes; if the bytes change, the fingerprint changes.
- Shared pointer (
std::shared_ptr): a C++ smart pointer that counts its owners and frees the object when the last owner lets go. - Snapshot: a copy of a value taken at one moment, which later changes to the original do not affect.
- std::string: the C++ standard library's text type, which manages its own memory and reallocates when it grows.
- Tag: a small label attached to a value that says what type of thing it is.
- Thread: one stream of execution inside a program; a program can have several running at once.
- Tiering: an engine's strategy of compiling code in stages, starting quick and later producing a more optimised version.
- Use-after-free: a bug where a program keeps using memory after it has been freed, so the memory may already have been reused.
- V8: Chrome's engine for JavaScript and WebAssembly.
- V8 sandbox: the protective layer around V8 that is meant to contain memory-corruption bugs inside the engine.
- Wasm (WebAssembly): a fast, low-level format that lets code written in other languages run in the browser at near-native speed.
- WasmStreaming: the internal object that tracks one streaming compile started by
WebAssembly.compileStreaming(). - XZ: a compression format.