Use after free in V8 (CVE-2026-78899)
A race condition in V8's WasmCodeManager allows a freed NativeModule's code map to be accessed after deallocation, leading to a use-after-free. An attacker could trigger this from a standard webpage, causing a crash and potentially enabling memory corruption outside the V8 sandbox.
Originally disclosed on Chrome VRP
- Fix shipped in 28 days
Report description
WasmCodeManager::LookupCode races NativeModule teardown and reads freed owned_code_ nodes
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
FeedbackMaker::AddCallIndirectCandidate() reads a WasmCodePointer value from call_indirect feedback, obtains its process-wide code entrypoint without a signature check, and calls WasmCodeManager::LookupCode() before checking whether the returned WasmCode belongs to the current instance's NativeModule.
// v8/src/wasm/module-compiler.cc:1219-1233
WasmCodePointer handle = WasmCodePointer{untrusted_code_pointer};
Address entry = GetProcessWideWasmCodePointerTable()
->GetEntrypointWithoutSignatureCheck(handle);
wasm::WasmCode* code =
wasm::GetWasmCodeManager()->LookupCode(nullptr, entry);
if (!code || code->native_module() != instance_data_->native_module() ||
code->IsAnonymous()) {
has_non_inlineable_targets_ = true;
return;
}
WasmCodeManager::LookupNativeModule() obtains a raw NativeModule* from lookup_map_ while holding native_modules_mutex_, but LookupCode() calls NativeModule::Lookup() only after that lock has been released. No strong owner of the module is acquired.
// v8/src/wasm/wasm-code-manager.cc:3040-3060
NativeModule* WasmCodeManager::LookupNativeModule(Address pc) const {
base::MutexGuard lock(&native_modules_mutex_);
// ...
return region_start <= pc && pc < region_end ? candidate : nullptr;
}
WasmCode* WasmCodeManager::LookupCode(Address pc) const {
NativeModule* candidate = LookupNativeModule(pc);
if (candidate) return candidate->Lookup(pc);
// ...
}
NativeModule::~NativeModule() removes engine bookkeeping, but its code-space entries remain in WasmCodeManager::lookup_map_ until the later WasmCodeAllocator member destructor. NativeModule declares code_allocator_ before allocation_mutex_ and owned_code_, so C++ reverse member destruction deletes the owned_code_ map before WasmCodeAllocator::~WasmCodeAllocator() removes those entries from lookup_map_.
// v8/src/wasm/wasm-code-manager.h:1030-1124
OperationsBarrier::Token engine_scope_;
WasmCodeAllocator code_allocator_;
// ...
mutable base::RecursiveMutex allocation_mutex_;
mutable std::map<Address, std::unique_ptr<WasmCode>> owned_code_;
The attached PoC reaches that dangling-pointer interval as follows:
- During a Dedicated Worker BackForwardCache freeze, a loop
WasmStackChecksuspends optimized WebAssembly code while a nestableWebAssembly.instantiateStreaming()completion task applies an active element segment to an imported ordinary table. WasmStackCheckOp::Effects()permits arbitrary writes, butLateLoadEliminationAnalyzer::ProcessWasmStackCheck()invalidates onlyWasmTrustedInstanceData::kMemory0SizeOffset. A following mutable numericglobal.setinvalidates the cached dispatch target load but not the cached implicit-argument load. The nextcall_indirectexecutes C's Liftoff code with A'sWasmTrustedInstanceData.- C's first direct-call counter updates A's first
call_indirectfeedback slot. Matching function indices and slot layouts turn A's existing handle into a valid handle for a function in a foreign targetNativeModule. - The feedback consumer reads that foreign handle's entrypoint. A separate module's allocator teardown temporarily holds
native_modules_mutex_while the target worker releases its lastNativeModuleowner and frees anowned_code_node; the laterWasmCodeAllocatordestructor cannot eraselookup_map_while that mutex remains held. LookupNativeModule()still returns the dying module, andNativeModule::Lookup()traverses the freedowned_code_node.
The attached AddressSanitizer log reports a read of a freed 48-byte std::map node. Symbolizing its Chrome offsets against Build ID c56df57ff7a2e0eb gives NativeModule::Lookup() through FeedbackMaker::AddCallIndirectCandidate() and TransitiveTypeFeedbackProcessor on one Dedicated Worker, while another Dedicated Worker frees the node through NativeModule::~NativeModule() and Isolate::ReleaseSharedPtrs().
PoC
All WebAssembly modules, Worker sources, navigation, and synchronization are embedded in poc.html. The page uses standard web APIs and an ordinary unshared WebAssembly table.
The attached run used the default BackForwardCache configuration. The final cross-thread lookup is timing-sensitive; rerun with a fresh profile if the page reaches completed-without-crash.
Reproduce
Start the attached local server:
python3 /path/to/attachment/server.py
Run Chrome with a fresh profile:
ASAN_OPTIONS=detect_leaks=0:abort_on_error=1:symbolize=1 \
/path/to/chrome \
--headless=new \
--incognito \
--no-sandbox \
--no-zygote \
--disable-crash-reporter \
--user-data-dir=/path/to/profile \
http://127.0.0.1:8181/poc.html
--incognito and the fresh profile avoid startup state from an earlier run. --no-zygote improves timing reliability, and --no-sandbox simplifies sanitizer log collection.
Impact analysis
A standard webpage can trigger a cross-thread heap use-after-free in trusted native V8 memory outside the V8 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
Memory Corruption (in a sandboxed process)
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 NativeModule destructor frees the owned_code_ map before the WasmCodeAllocator destructor removes entries from lookup_map_, and LookupCode() accesses the map without holding a lock or strong reference.
What the attacker needed
Victim visits a malicious webpage; Chrome with WebAssembly enabled; timing-sensitive race condition
How it was found
- Start the attached local server.
- Run Chrome with a fresh profile and the provided flags.
- Load the PoC page, which triggers the race and use-after-free.
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.
This is a use-after-free bug, where a program tries to use memory after it has been freed. In this case, a race between two threads in Chrome's WebAssembly engine lets one thread read a data structure that another thread has already deleted, which can crash the browser or be exploited for code execution.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.