Use after free in V8 (CVE-2024-5841)
A use-after-free in V8's inspector session occurs when a worker thread's DevTools session is detached while a debugger command is still being processed. An attacker could potentially cause a crash or memory corruption by repeatedly loading a page that triggers this race condition.
Originally disclosed on Chrome VRP
- Fix shipped in 4 months
tested os: ubuntu 22.04 tested chrome version: stable & dev
repro steps: /chrome --disable-gpu --auto-open-devtools-for-tabs --disable-in-process-stack-traces --incognito --user-data-dir=/tmp/xx1 --js-flags=--expose-gc http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html UAF will repro after several or dozens of refreshes. If it doesn't repro, try opening a few more tabs.
==1==ERROR: AddressSanitizer: heap-use-after-free on address 0x514000141578 at pc 0x5561533891f4 bp 0x7f2ded449d10 sp 0x7f2ded449d08 READ of size 8 at 0x514000141578 thread T315 (DedicatedWorker) #0 0x5561533891f3 in reset ./../../third_party/libc++/src/include/__memory/unique_ptr.h:276:29 #1 0x5561533891f3 in operator= ./../../third_party/libc++/src/include/__memory/unique_ptr.h:220:5 #2 0x5561533891f3 in v8_inspector::V8DebuggerAgentImpl::setBlackboxPattern(v8_inspector::String16 const&) ./../../v8/src/inspector/v8-debugger-agent-impl.cc:1698:21 #3 0x55615339fc39 in v8_inspector::V8DebuggerAgentImpl::setBlackboxPatterns(std::__Cr::unique_ptr<std::__Cr::vector<v8_inspector::String16, std::__Cr::allocator<v8_inspector::String16>>, std::__Cr::default_delete<std::__Cr::vector<v8_inspector::String16, std::__Cr::allocator<v8_inspector::String16>>>>) ./../../v8/src/inspector/v8-debugger-agent-impl.cc:1685:23 #4 0x5561532e7d3b in v8_inspector::protocol::Debugger::DomainDispatcherImpl::setBlackboxPatterns(v8_crdtp::Dispatchable const&) ./gen/v8/src/inspector/protocol/Debugger.cpp:1294:44 #5 0x5561534646ca in operator() ./../../third_party/libc++/src/include/__functional/function.h:714:12 #6 0x5561534646ca in operator() ./../../third_party/libc++/src/include/__functional/function.h:981:10 #7 0x5561534646ca in v8_crdtp::UberDispatcher::DispatchResult::Run() ./../../v8/third_party/inspector_protocol/crdtp/dispatch.cc:509:3 #8 0x5561533fe83f in v8_inspector::V8InspectorSessionImpl::dispatchProtocolMessage(v8_inspector::StringView) ./../../v8/src/inspector/v8-inspector-session-impl.cc:395:39 #9 0x55616a9f87b8 in blink::DevToolsSession::DispatchProtocolCommandImpl(int, WTF::String const&, base::span<unsigned char const, 18446744073709551615ul, unsigned char const*>) ./../../third_party/blink/renderer/core/inspector/devtools_session.cc:262:18 #10 0x55616aa01e37 in Invoke<void (blink::DevToolsSession::)(int, const WTF::String &, base::span<const unsigned char, 18446744073709551615UL, const unsigned char >), blink::DevToolsSession const &, int, WTF::String, WTF::Vector<unsigned char, 0U, WTF::PartitionAllocator> > ./../../base/functional/bind_internal.h:713:12 #11 0x55616aa01e37 in MakeItSo<void (blink::DevToolsSession::)(int, const WTF::String &, base::span<const unsigned char, 18446744073709551615UL, const unsigned char >), std::__Cr::tuple<blink::internal::BasicUnwrappingCrossThreadHandle<blink::DevToolsSession, blink::internal::WeakCrossThreadHandleWeaknessPolicy>, int, WTF::String, WTF::Vector<unsigned char, 0U, WTF::PartitionAllocator> > > ./../../base/functional/bind_internal.h:892:5 #12 0x55616aa01e37 in RunImpl<void (blink::DevToolsSession::)(int, const WTF::String &, base::span<const unsigned char, 18446744073709551615UL, const unsigned char >), std::__Cr::tuple<blink::internal::BasicUnwrappingCrossThreadHandle<blink::DevToolsSession, blink::internal::WeakCrossThreadHandleWeaknessPolicy>, int, WTF::String, WTF::Vector<unsigned char, 0U, WTF::PartitionAllocator> >, 0UL, 1UL, 2UL, 3UL> ./../../base/functional/bind_internal.h:1005:14 #13 0x55616aa01e37 in base::internal::Invoker<base::internal::FunctorTraits<void (blink::DevToolsSession::)(int, WTF::String const&, base::span<unsigned char const, 18446744073709551615ul, unsigned char const>)>, base::internal::BindState<true, true, false, void (blink::DevToolsSession::)(int, WTF::String const&, base::span<unsigned char const, 18446744073709551615ul, unsigned char const*>), blink::internal::BasicUnwrappingCrossThreadHandle<blink::DevToolsSession, blink::internal::WeakCrossThreadHandleWeaknessPolicy>, int, WTF::String, WTF::Vector<unsigned char, 0u, WTF::PartitionAllocator>>, void ()>::RunOnce(base::internal::BindStateBase*) ./../../base/functional/bind_internal.h:918:12 #14 0x55616a6cf18f in Run ./../../base/functional/callback.h:156:12 #15 0x55616a6cf18f in Run ./../../third_party/blink/renderer/platform/wtf/functional.h:341:33 #16 0x55616a6cf18f in blink::InspectorTaskRunner::PerformSingleInterruptingTaskDontWait() ./../../third_party/blink/renderer/core/inspector/inspector_task_runner.cc:103:21 #17 0x55616a6d0bf4 in Invoke<void (blink::InspectorTaskRunner::)(), scoped_refptrblink::InspectorTaskRunner > ./../../base/functional/bind_internal.h:713:12 #18 0x55616a6d0bf4 in MakeItSo<void (blink::InspectorTaskRunner::)(), std::__Cr::tuple<scoped_refptrblink::InspectorTaskRunner > > ./../../base/functional/bind_internal.h:868:12 #19 0x55616a6d0bf4 in RunImpl<void (blink::InspectorTaskRunner::)(), std::__Cr::tuple<scoped_refptrblink::InspectorTaskRunner >, 0UL> ./../../base/functional/bind_internal.h:1005:14 #20 0x55616a6d0bf4 in base::internal::Invoker<base::internal::FunctorTraits<void (blink::InspectorTaskRunner::)()>, base::internal::BindState<true, true, false, void (blink::InspectorTaskRunner::)(), scoped_refptrblink::InspectorTaskRunner>, void ()>::RunOnce(base::internal::BindStateBase) ./../../base/functional/bind_internal.h:918:12 #21 0x55615d5bf444 in Run ./../../base/functional/callback.h:156:12 #22 0x55615d5bf444 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) ./../../base/task/common/task_annotator.cc:202:34 #23 0x55615d61e60f in RunTask<(lambda at ../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:475:11)> ./../../base/task/common/task_annotator.h:89:5 #24 0x55615d61e60f in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:473:23 #25 0x55615d61d609 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:338:41 #26 0x55615d61f3ca in non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:0:0 #27 0x55615d4bb12c in base::MessagePumpDefault::Run(base::MessagePump::Delegate*) ./../../base/message_loop/message_pump_default.cc:40:55 #28 0x55615d62020e in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:638:12 #29 0x55615d5546df in base::RunLoop::Run(base::Location const&) ./../../base/run_loop.cc:134:14 #30 0x5561745e4693 in content::(anonymous namespace)::NestedMessageLoopRunnerImpl::Run() ./../../content/child/blink_platform_impl.cc:88:14 #31 0x55616bff2285 in blink::WorkerThread::PauseOrFreezeOnWorkerThread(blink::mojom::FrameLifecycleState, bool) ./../../third_party/blink/renderer/core/workers/worker_thread.cc:917:20 #32 0x55616bfed8e3 in blink::WorkerThread::PauseOrFreeze(blink::mojom::FrameLifecycleState, bool) ./../../third_party/blink/renderer/core/workers/worker_thread.cc:857:5 #33 0x55616a9db71f in blink::WorkerThreadDebugger::runMessageLoopOnPause(int) ./../../third_party/blink/renderer/core/inspector/worker_thread_debugger.cc:182:11 #34 0x55616bfe9e49 in blink::WorkerThread::InitializeOnWorkerThread(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams>, std::__Cr::optionalblink::WorkerBackingThreadStartupData const&, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams>) ./../../third_party/blink/renderer/core/workers/worker_thread.cc:671:33 #35 0x55616bff3031 in Invoke<void (blink::WorkerThread::)(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams >, const std::__Cr::optionalblink::WorkerBackingThreadStartupData &, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams >), blink::WorkerThread , std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams >, std::__Cr::optionalblink::WorkerBackingThreadStartupData, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams > > ./../../base/functional/bind_internal.h:713:12 #36 0x55616bff3031 in MakeItSo<void (blink::WorkerThread::)(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams >, const std::__Cr::optionalblink::WorkerBackingThreadStartupData &, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams >), std::__Cr::tuple<WTF::CrossThreadUnretainedWrapperblink::WorkerThread, std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams >, std::__Cr::optionalblink::WorkerBackingThreadStartupData, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams > > > ./../../base/functional/bind_internal.h:868:12 #37 0x55616bff3031 in RunImpl<void (blink::WorkerThread::)(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams >, const std::__Cr::optionalblink::WorkerBackingThreadStartupData &, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams >), std::__Cr::tuple<WTF::CrossThreadUnretainedWrapperblink::WorkerThread, std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams >, std::__Cr::optionalblink::WorkerBackingThreadStartupData, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams > >, 0UL, 1UL, 2UL, 3UL> ./../../base/functional/bind_internal.h:1005:14 #38 0x55616bff3031 in base::internal::Invoker<base::internal::FunctorTraits<void (blink::WorkerThread::)(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams>, std::__Cr::optionalblink::WorkerBackingThreadStartupData const&, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams>)>, base::internal::BindState<true, true, false, void (blink::WorkerThread::)(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams>, std::__Cr::optionalblink::WorkerBackingThreadStartupData const&, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams>), WTF::CrossThreadUnretainedWrapperblink::WorkerThread, std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams>, std::__Cr::optionalblink::WorkerBackingThreadStartupData, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams>>, void ()>::RunOnce(base::internal::BindStateBase*) ./../../base/functional/bind_internal.h:918:12 #39 0x55615d5bf444 in Run ./../../base/functional/callback.h:156:12 #40 0x55615d5bf444 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) ./../../base/task/common/task_annotator.cc:202:34 #41 0x55615d61e60f in RunTask<(lambda at ../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:475:11)> ./../../base/task/common/task_annotator.h:89:5 #42 0x55615d61e60f in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:473:23 #43 0x55615d61d609 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:338:41 #44 0x55615d61f3ca in non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:0:0 #45 0x55615d4bb12c in base::MessagePumpDefault::Run(base::MessagePump::Delegate*) ./../../base/message_loop/message_pump_default.cc:40:55 #46 0x55615d6200ff in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:641:12 #47 0x55615d5546df in base::RunLoop::Run(base::Location const&) ./../../base/run_loop.cc:134:14 #48 0x556159e4ffdc in blink::scheduler::NonMainThreadImpl::SimpleThreadImpl::Run() ./../../third_party/blink/renderer/platform/scheduler/worker/non_main_thread_impl.cc:182:14 #49 0x55615d6ed2b7 in base::(anonymous namespace)::ThreadFunc(void*) ./../../base/threading/platform_thread_posix.cc:103:13 #50 0x55614bc93918 in asan_thread_start(void*) asan_rtl:28
0x514000141578 is located 312 bytes inside of 400-byte region [0x514000141440,0x5140001415d0) freed by thread T315 (DedicatedWorker) here: #0 0x55614bcca0bd in operator delete(void*) asan_rtl:3 #1 0x5561533fb4b4 in operator() ./../../third_party/libc++/src/include/__memory/unique_ptr.h:68:5 #2 0x5561533fb4b4 in reset ./../../third_party/libc++/src/include/__memory/unique_ptr.h:279:7 #3 0x5561533fb4b4 in ~unique_ptr ./../../third_party/libc++/src/include/__memory/unique_ptr.h:249:71 #4 0x5561533fb4b4 in v8_inspector::V8InspectorSessionImpl::~V8InspectorSessionImpl() ./../../v8/src/inspector/v8-inspector-session-impl.cc:169:1 #5 0x5561533fbbb3 in v8_inspector::V8InspectorSessionImpl::~V8InspectorSessionImpl() ./../../v8/src/inspector/v8-inspector-session-impl.cc:160:51 #6 0x55616a9f6b7c in operator() ./../../third_party/libc++/src/include/__memory/unique_ptr.h:68:5 #7 0x55616a9f6b7c in reset ./../../third_party/libc++/src/include/__memory/unique_ptr.h:279:7 #8 0x55616a9f6b7c in blink::DevToolsSession::Detach() ./../../third_party/blink/renderer/core/inspector/devtools_session.cc:215:15 #9 0x55616aa025f2 in Invoke<void (blink::DevToolsSession::)(), const cppgc::internal::BasicPersistent<blink::DevToolsSession, cppgc::internal::WeakPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy> &> ./../../base/functional/bind_internal.h:713:12 #10 0x55616aa025f2 in MakeItSo<void (blink::DevToolsSession::)(), std::__Cr::tuple<cppgc::internal::BasicPersistent<blink::DevToolsSession, cppgc::internal::WeakPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy> > > ./../../base/functional/bind_internal.h:892:5 #11 0x55616aa025f2 in RunImpl<void (blink::DevToolsSession::)(), std::__Cr::tuple<cppgc::internal::BasicPersistent<blink::DevToolsSession, cppgc::internal::WeakPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy> >, 0UL> ./../../base/functional/bind_internal.h:1005:14 #12 0x55616aa025f2 in base::internal::Invoker<base::internal::FunctorTraits<void (blink::DevToolsSession::)()>, base::internal::BindState<true, true, false, void (blink::DevToolsSession::)(), cppgc::internal::BasicPersistent<blink::DevToolsSession, cppgc::internal::WeakPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy>>, void ()>::RunOnce(base::internal::BindStateBase) ./../../base/functional/bind_internal.h:918:12 #13 0x55615ec511c2 in Run ./../../base/functional/callback.h:156:12 #14 0x55615ec511c2 in mojo::InterfaceEndpointClient::NotifyError(std::__Cr::optionalmojo::DisconnectReason const&) ./../../mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:744:31 #15 0x55615ec77646 in mojo::internal::MultiplexRouter::ProcessNotifyErrorTask(mojo::internal::MultiplexRouter::Task*, mojo::internal::MultiplexRouter::ClientCallBehavior, base::SequencedTaskRunner*) ./../../mojo/public/cpp/bindings/lib/multiplex_router.cc:1010:13 #16 0x55615ec6eb04 in mojo::internal::MultiplexRouter::ProcessTasks(mojo::internal::MultiplexRouter::ClientCallBehavior, base::SequencedTaskRunner*) ./../../mojo/public/cpp/bindings/lib/multiplex_router.cc:923:15 #17 0x55615ec78a48 in mojo::internal::MultiplexRouter::LockAndCallProcessTasks() ./../../mojo/public/cpp/bindings/lib/multiplex_router.cc:1124:3 #18 0x55615ec7a0b4 in Invoke<void (mojo::internal::MultiplexRouter::)(), scoped_refptrmojo::internal::MultiplexRouter > ./../../base/functional/bind_internal.h:713:12 #19 0x55615ec7a0b4 in MakeItSo<void (mojo::internal::MultiplexRouter::)(), std::__Cr::tuple<scoped_refptrmojo::internal::MultiplexRouter > > ./../../base/functional/bind_internal.h:868:12 #20 0x55615ec7a0b4 in RunImpl<void (mojo::internal::MultiplexRouter::)(), std::__Cr::tuple<scoped_refptrmojo::internal::MultiplexRouter >, 0UL> ./../../base/functional/bind_internal.h:1005:14 #21 0x55615ec7a0b4 in base::internal::Invoker<base::internal::FunctorTraits<void (mojo::internal::MultiplexRouter::)()>, base::internal::BindState<true, true, false, void (mojo::internal::MultiplexRouter::)(), scoped_refptrmojo::internal::MultiplexRouter>, void ()>::RunOnce(base::internal::BindStateBase) ./../../base/functional/bind_internal.h:918:12 #22 0x55615d5bf444 in Run ./../../base/functional/callback.h:156:12 #23 0x55615d5bf444 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) ./../../base/task/common/task_annotator.cc:202:34 #24 0x55615d61e60f in RunTask<(lambda at ../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:475:11)> ./../../base/task/common/task_annotator.h:89:5 #25 0x55615d61e60f in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:473:23 #26 0x55615d61d609 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:338:41 #27 0x55615d61f3ca in non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:0:0 #28 0x55615d4bb12c in base::MessagePumpDefault::Run(base::MessagePump::Delegate*) ./../../base/message_loop/message_pump_default.cc:40:55 #29 0x55615d62020e in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:638:12 #30 0x55615d5546df in base::RunLoop::Run(base::Location const&) ./../../base/run_loop.cc:134:14 #31 0x5561745e4693 in content::(anonymous namespace)::NestedMessageLoopRunnerImpl::Run() ./../../content/child/blink_platform_impl.cc:88:14 #32 0x55616bff2285 in blink::WorkerThread::PauseOrFreezeOnWorkerThread(blink::mojom::FrameLifecycleState, bool) ./../../third_party/blink/renderer/core/workers/worker_thread.cc:917:20 #33 0x556151510211 in v8::internal::Isolate::InvokeApiInterruptCallbacks() ./../../v8/src/execution/isolate.cc:1739:5 #34 0x556151570b8c in v8::internal::StackGuard::HandleInterrupts(v8::internal::StackGuard::InterruptLevel) ./../../v8/src/execution/stack-guard.cc:371:15 #35 0x5561524e238f in __RT_impl_Runtime_StackGuard ./../../v8/src/runtime/runtime-internal.cc:354:34 #36 0x5561524e238f in v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) ./../../v8/src/runtime/runtime-internal.cc:343:1 #37 0x5561549a8df5 in Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit setup-isolate-deserialize.cc:0:0 #38 0x55615490fdf9 in Builtins_InterpreterEntryTrampoline setup-isolate-deserialize.cc:0:0 #39 0x55615490d7db in Builtins_JSEntryTrampoline setup-isolate-deserialize.cc:0:0 #40 0x55615490d506 in Builtins_JSEntry setup-isolate-deserialize.cc:0:0 #41 0x5561514cf562 in Call ./../../v8/src/execution/simulator.h:178:12 #42 0x5561514cf562 in v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) ./../../v8/src/execution/execution.cc:418:22 #43 0x5561514d2b9d in v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) ./../../v8/src/execution/execution.cc:475:18 #44 0x5561514d2928 in v8::internal::Execution::TryCallScript(v8::internal::Isolate*, v8::internal::Handlev8::internal::JSFunction, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::FixedArray) ./../../v8/src/execution/execution.cc:551:10 #45 0x5561519fd0c1 in v8::internal::Genesis::CompileExtension(v8::internal::Isolate*, v8::Extension*) ./../../v8/src/init/bootstrapper.cc:4975:11
previously allocated by thread T315 (DedicatedWorker) here: #0 0x55614bcc985d in operator new(unsigned long) asan_rtl:3 #1 0x5561533fa206 in v8_inspector::V8InspectorSessionImpl::V8InspectorSessionImpl(v8_inspector::V8InspectorImpl*, int, int, v8_inspector::V8Inspector::Channel*, v8_inspector::StringView, v8_inspector::V8Inspector::ClientTrustLevel, std::__Cr::shared_ptr<v8_inspector::V8DebuggerBarrier>) ./../../v8/src/inspector/v8-inspector-session-impl.cc:129:25 #2 0x5561533f99b6 in v8_inspector::V8InspectorSessionImpl::create(v8_inspector::V8InspectorImpl*, int, int, v8_inspector::V8Inspector::Channel*, v8_inspector::StringView, v8_inspector::V8Inspector::ClientTrustLevel, std::__Cr::shared_ptr<v8_inspector::V8DebuggerBarrier>) ./../../v8/src/inspector/v8-inspector-session-impl.cc:98:54 #3 0x5561533e7cd8 in v8_inspector::V8InspectorImpl::connect(int, v8_inspector::V8Inspector::Channel*, v8_inspector::StringView, v8_inspector::V8Inspector::ClientTrustLevel, v8_inspector::V8Inspector::SessionPauseState) ./../../v8/src/inspector/v8-inspector-impl.cc:166:7 #4 0x55616a9f7877 in blink::DevToolsSession::ConnectToV8(v8_inspector::V8Inspector*, int) ./../../third_party/blink/renderer/core/inspector/devtools_session.cc:181:28 #5 0x55616a9dea02 in blink::WorkerInspectorController::AttachSession(blink::DevToolsSession*, bool) ./../../third_party/blink/renderer/core/inspector/worker_inspector_controller.cc:118:12 #6 0x55616a9f55bb in blink::DevToolsSession::DevToolsSession(blink::DevToolsAgent*, mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, WTF::String const&, bool, scoped_refptrbase::SequencedTaskRunner) ./../../third_party/blink/renderer/core/inspector/devtools_session.cc:166:20 #7 0x55616a9f2d66 in blink::DevToolsSession* cppgc::MakeGarbageCollectedTraitblink::DevToolsSession::Call<blink::DevToolsAgent*, mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool&, bool&, WTF::String const&, bool&, scoped_refptrbase::SingleThreadTaskRunner>(cppgc::AllocationHandle&, blink::DevToolsAgent*&&, mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost&&, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession&&, mojo::PendingReceiverblink::mojom::blink::DevToolsSession&&, mojo::StructPtrblink::mojom::blink::DevToolsSessionState&&, bool&, bool&, WTF::String const&, bool&, scoped_refptrbase::SingleThreadTaskRunner&&) ./../../v8/include/cppgc/allocation.h:242:32 #8 0x55616a9e4a69 in MakeGarbageCollected<blink::DevToolsSession, blink::DevToolsAgent , mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool &, bool &, const WTF::String &, bool &, scoped_refptrbase::SingleThreadTaskRunner > ./../../v8/include/cppgc/allocation.h:280:7 #9 0x55616a9e4a69 in MakeGarbageCollected<blink::DevToolsSession, blink::DevToolsAgent , mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool &, bool &, const WTF::String &, bool &, scoped_refptrbase::SingleThreadTaskRunner > ./../../third_party/blink/renderer/platform/heap/garbage_collected.h:37:10 #10 0x55616a9e4a69 in blink::DevToolsAgent::AttachDevToolsSessionImpl(mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, WTF::String const&, bool) ./../../third_party/blink/renderer/core/inspector/devtools_agent.cc:240:30 #11 0x55616a9ee390 in void base::internal::FunctorTraits<void (blink::DevToolsAgent::)(mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, WTF::String const&, bool)>::Invoke<void (blink::DevToolsAgent::)(mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, WTF::String const&, bool), blink::DevToolsAgent* const&, mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, WTF::String, bool>(void (blink::DevToolsAgent::)(mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, WTF::String const&, bool), blink::DevToolsAgent const&, mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost&&, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession&&, mojo::PendingReceiverblink::mojom::blink::DevToolsSession&&, mojo::StructPtrblink::mojom::blink::DevToolsSessionState&&, bool&&, bool&&, WTF::String&&, bool&&) ./../../base/functional/bind_internal.h:713:12 #12 0x55616a9ee0b9 in MakeItSo<void (blink::DevToolsAgent::)(mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, const WTF::String &, bool), std::__Cr::tuple<blink::internal::BasicUnwrappingCrossThreadHandle<blink::DevToolsAgent, blink::internal::WeakCrossThreadHandleWeaknessPolicy>, mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, WTF::String, bool> > ./../../base/functional/bind_internal.h:892:5 #13 0x55616a9ee0b9 in RunImpl<void (blink::DevToolsAgent::)(mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, const WTF::String &, bool), std::__Cr::tuple<blink::internal::BasicUnwrappingCrossThreadHandle<blink::DevToolsAgent, blink::internal::WeakCrossThreadHandleWeaknessPolicy>, mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, WTF::String, bool>, 0UL, 1UL, 2UL, 3UL, 4UL, 5UL, 6UL, 7UL, 8UL> ./../../base/functional/bind_internal.h:1005:14 #14 0x55616a9ee0b9 in base::internal::Invoker<base::internal::FunctorTraits<void (blink::DevToolsAgent::)(mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, WTF::String const&, bool)>, base::internal::BindState<true, true, false, void (blink::DevToolsAgent::)(mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, WTF::String const&, bool), blink::internal::BasicUnwrappingCrossThreadHandle<blink::DevToolsAgent, blink::internal::WeakCrossThreadHandleWeaknessPolicy>, mojo::PendingAssociatedRemoteblink::mojom::blink::DevToolsSessionHost, mojo::PendingAssociatedReceiverblink::mojom::blink::DevToolsSession, mojo::PendingReceiverblink::mojom::blink::DevToolsSession, mojo::StructPtrblink::mojom::blink::DevToolsSessionState, bool, bool, WTF::String, bool>, void ()>::RunOnce(base::internal::BindStateBase*) ./../../base/functional/bind_internal.h:918:12 #15 0x55616a6cf18f in Run ./../../base/functional/callback.h:156:12 #16 0x55616a6cf18f in Run ./../../third_party/blink/renderer/platform/wtf/functional.h:341:33 #17 0x55616a6cf18f in blink::InspectorTaskRunner::PerformSingleInterruptingTaskDontWait() ./../../third_party/blink/renderer/core/inspector/inspector_task_runner.cc:103:21 #18 0x55616a6d0bf4 in Invoke<void (blink::InspectorTaskRunner::)(), scoped_refptrblink::InspectorTaskRunner > ./../../base/functional/bind_internal.h:713:12 #19 0x55616a6d0bf4 in MakeItSo<void (blink::InspectorTaskRunner::)(), std::__Cr::tuple<scoped_refptrblink::InspectorTaskRunner > > ./../../base/functional/bind_internal.h:868:12 #20 0x55616a6d0bf4 in RunImpl<void (blink::InspectorTaskRunner::)(), std::__Cr::tuple<scoped_refptrblink::InspectorTaskRunner >, 0UL> ./../../base/functional/bind_internal.h:1005:14 #21 0x55616a6d0bf4 in base::internal::Invoker<base::internal::FunctorTraits<void (blink::InspectorTaskRunner::)()>, base::internal::BindState<true, true, false, void (blink::InspectorTaskRunner::)(), scoped_refptrblink::InspectorTaskRunner>, void ()>::RunOnce(base::internal::BindStateBase) ./../../base/functional/bind_internal.h:918:12 #22 0x55615d5bf444 in Run ./../../base/functional/callback.h:156:12 #23 0x55615d5bf444 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) ./../../base/task/common/task_annotator.cc:202:34 #24 0x55615d61e60f in RunTask<(lambda at ../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:475:11)> ./../../base/task/common/task_annotator.h:89:5 #25 0x55615d61e60f in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:473:23 #26 0x55615d61d609 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:338:41 #27 0x55615d61f3ca in non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:0:0 #28 0x55615d4bb12c in base::MessagePumpDefault::Run(base::MessagePump::Delegate*) ./../../base/message_loop/message_pump_default.cc:40:55 #29 0x55615d62020e in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:638:12 #30 0x55615d5546df in base::RunLoop::Run(base::Location const&) ./../../base/run_loop.cc:134:14 #31 0x5561745e4693 in content::(anonymous namespace)::NestedMessageLoopRunnerImpl::Run() ./../../content/child/blink_platform_impl.cc:88:14 #32 0x55616bff2285 in blink::WorkerThread::PauseOrFreezeOnWorkerThread(blink::mojom::FrameLifecycleState, bool) ./../../third_party/blink/renderer/core/workers/worker_thread.cc:917:20 #33 0x55616bfed8e3 in blink::WorkerThread::PauseOrFreeze(blink::mojom::FrameLifecycleState, bool) ./../../third_party/blink/renderer/core/workers/worker_thread.cc:857:5 #34 0x55616a9db71f in blink::WorkerThreadDebugger::runMessageLoopOnPause(int) ./../../third_party/blink/renderer/core/inspector/worker_thread_debugger.cc:182:11 #35 0x55616bfe9e49 in blink::WorkerThread::InitializeOnWorkerThread(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams>, std::__Cr::optionalblink::WorkerBackingThreadStartupData const&, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams>) ./../../third_party/blink/renderer/core/workers/worker_thread.cc:671:33 #36 0x55616bff3031 in Invoke<void (blink::WorkerThread::)(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams >, const std::__Cr::optionalblink::WorkerBackingThreadStartupData &, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams >), blink::WorkerThread , std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams >, std::__Cr::optionalblink::WorkerBackingThreadStartupData, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams > > ./../../base/functional/bind_internal.h:713:12 #37 0x55616bff3031 in MakeItSo<void (blink::WorkerThread::)(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams >, const std::__Cr::optionalblink::WorkerBackingThreadStartupData &, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams >), std::__Cr::tuple<WTF::CrossThreadUnretainedWrapperblink::WorkerThread, std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams >, std::__Cr::optionalblink::WorkerBackingThreadStartupData, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams > > > ./../../base/functional/bind_internal.h:868:12 #38 0x55616bff3031 in RunImpl<void (blink::WorkerThread::)(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams >, const std::__Cr::optionalblink::WorkerBackingThreadStartupData &, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams >), std::__Cr::tuple<WTF::CrossThreadUnretainedWrapperblink::WorkerThread, std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams >, std::__Cr::optionalblink::WorkerBackingThreadStartupData, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams > >, 0UL, 1UL, 2UL, 3UL> ./../../base/functional/bind_internal.h:1005:14 #39 0x55616bff3031 in base::internal::Invoker<base::internal::FunctorTraits<void (blink::WorkerThread::)(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams>, std::__Cr::optionalblink::WorkerBackingThreadStartupData const&, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams>)>, base::internal::BindState<true, true, false, void (blink::WorkerThread::)(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams>, std::__Cr::optionalblink::WorkerBackingThreadStartupData const&, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams>), WTF::CrossThreadUnretainedWrapperblink::WorkerThread, std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams>, std::__Cr::optionalblink::WorkerBackingThreadStartupData, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams>>, void ()>::RunOnce(base::internal::BindStateBase*) ./../../base/functional/bind_internal.h:918:12 #40 0x55615d5bf444 in Run ./../../base/functional/callback.h:156:12 #41 0x55615d5bf444 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) ./../../base/task/common/task_annotator.cc:202:34 #42 0x55615d61e60f in RunTask<(lambda at ../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:475:11)> ./../../base/task/common/task_annotator.h:89:5 #43 0x55615d61e60f in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:473:23 #44 0x55615d61d609 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:338:41 #45 0x55615d61f3ca in non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:0:0
Thread T315 (DedicatedWorker) created by T0 (chrome) here: #0 0x55614bc7b9f1 in ___interceptor_pthread_create asan_rtl:3 #1 0x55615d6ec810 in base::(anonymous namespace)::CreateThread(unsigned long, bool, base::PlatformThreadBase::Delegate*, base::PlatformThreadHandle*, base::ThreadType, base::MessagePumpType) ./../../base/threading/platform_thread_posix.cc:148:13 #2 0x55615d69fb98 in base::SimpleThread::StartAsync() ./../../base/threading/simple_thread.cc:55:13 #3 0x556159e4d94a in blink::NonMainThread::CreateThread(blink::ThreadCreationParams const&) ./../../third_party/blink/renderer/platform/scheduler/worker/non_main_thread_impl.cc:40:11 #4 0x55616bfc0bc9 in blink::WorkerBackingThread::WorkerBackingThread(blink::ThreadCreationParams const&) ./../../third_party/blink/renderer/core/workers/worker_backing_thread.cc:133:23 #5 0x55616bfb1479 in make_unique<blink::WorkerBackingThread, blink::ThreadCreationParams &> ./../../third_party/libc++/src/include/__memory/unique_ptr.h:621:30 #6 0x55616bfb1479 in blink::DedicatedWorkerThread::DedicatedWorkerThread(blink::ExecutionContext*, blink::DedicatedWorkerObjectProxy&, mojo::PendingRemoteblink::mojom::blink::DedicatedWorkerHost, mojo::PendingRemoteblink::mojom::blink::BackForwardCacheControllerHost) ./../../third_party/blink/renderer/core/workers/dedicated_worker_thread.cc:62:28 #7 0x55616bf77ccf in make_unique<blink::DedicatedWorkerThread, blink::ExecutionContext , blink::DedicatedWorkerObjectProxy &, mojo::PendingRemoteblink::mojom::blink::DedicatedWorkerHost, mojo::PendingRemoteblink::mojom::blink::BackForwardCacheControllerHost > ./../../third_party/libc++/src/include/__memory/unique_ptr.h:621:30 #8 0x55616bf77ccf in blink::DedicatedWorkerMessagingProxy::CreateWorkerThread() ./../../third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc:306:10 #9 0x55616bfb8495 in blink::ThreadedMessagingProxyBase::InitializeWorkerThread(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams>, std::__Cr::optionalblink::WorkerBackingThreadStartupData const&, std::__Cr::optional<base::TokenTypeblink::DedicatedWorkerTokenTypeMarker const> const&, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_deleteblink::WorkerDevToolsParams>) ./../../third_party/blink/renderer/core/workers/threaded_messaging_proxy_base.cc:83:20 #10 0x55616bf74664 in blink::DedicatedWorkerMessagingProxy::StartWorkerGlobalScope(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_deleteblink::GlobalScopeCreationParams>, std::__Cr::unique_ptr<blink::WorkerMainScriptLoadParameters, std::__Cr::default_deleteblink::WorkerMainScriptLoadParameters>, blink::WorkerOptions const, blink::KURL const&, blink::FetchClientSettingsObjectSnapshot const&, v8_inspector::V8StackTraceId const&, WTF::String const&, base::StrongAlias<blink::RejectCoepUnsafeNoneTag, bool>, base::TokenTypeblink::DedicatedWorkerTokenTypeMarker const&, mojo::PendingRemoteblink::mojom::blink::DedicatedWorkerHost, mojo::PendingRemoteblink::mojom::blink::BackForwardCacheControllerHost) ./../../third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc:100:3 #11 0x55616bfa85e0 in blink::DedicatedWorker::ContinueStart(blink::KURL const&, std::__Cr::unique_ptr<blink::WorkerMainScriptLoadParameters, std::__Cr::default_deleteblink::WorkerMainScriptLoadParameters>, network::mojom::ReferrerPolicy, WTF::Vector<mojo::StructPtrnetwork::mojom::blink::ContentSecurityPolicy, 0u, WTF::PartitionAllocator>, WTF::String const&, base::StrongAlias<blink::RejectCoepUnsafeNoneTag, bool>, mojo::PendingRemoteblink::mojom::blink::BackForwardCacheControllerHost) ./../../third_party/blink/renderer/core/workers/dedicated_worker.cc:415:19 #12 0x55616bfa925d in blink::DedicatedWorker::OnScriptLoadStarted(std::__Cr::unique_ptr<blink::WorkerMainScriptLoadParameters, std::__Cr::default_deleteblink::WorkerMainScriptLoadParameters>, blink::CrossVariantMojoRemoteblink::mojom::BackForwardCacheControllerHostInterfaceBase) ./../../third_party/blink/renderer/core/workers/dedicated_worker.cc:329:3 #13 0x5561746ac8fa in content::DedicatedWorkerHostFactoryClient::OnScriptLoadStarted(mojo::StructPtrblink::mojom::ServiceWorkerContainerInfoForClient, mojo::StructPtrblink::mojom::WorkerMainScriptLoadParams, std::__Cr::unique_ptr<blink::PendingURLLoaderFactoryBundle, std::__Cr::default_deleteblink::PendingURLLoaderFactoryBundle>, mojo::PendingReceiverblink::mojom::SubresourceLoaderUpdater, mojo::StructPtrblink::mojom::ControllerServiceWorkerInfo, mojo::PendingRemoteblink::mojom::BackForwardCacheControllerHost) ./../../content/renderer/worker/dedicated_worker_host_factory_client.cc:206:12 #14 0x556150216be2 in blink::mojom::DedicatedWorkerHostFactoryClientStubDispatch::Accept(blink::mojom::DedicatedWorkerHostFactoryClient*, mojo::Message*) ./gen/third_party/blink/public/mojom/worker/dedicated_worker_host_factory.mojom.cc:425:13 #15 0x55615ec4b969 in mojo::InterfaceEndpointClient::HandleValidatedMessage(mojo::Message*) ./../../mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:1021:54 #16 0x55615ec67b27 in mojo::MessageDispatcher::Accept(mojo::Message*) ./../../mojo/public/cpp/bindings/lib/message_dispatcher.cc:43:19 #17 0x55615ec50a55 in mojo::InterfaceEndpointClient::HandleIncomingMessage(mojo::Message*) ./../../mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:706:20 #18 0x55615ec75134 in mojo::internal::MultiplexRouter::ProcessIncomingMessage(mojo::internal::MultiplexRouter::MessageWrapper*, mojo::internal::MultiplexRouter::ClientCallBehavior, base::SequencedTaskRunner*) ./../../mojo/public/cpp/bindings/lib/multiplex_router.cc:1096:42 #19 0x55615ec732b0 in mojo::internal::MultiplexRouter::Accept(mojo::Message*) ./../../mojo/public/cpp/bindings/lib/multiplex_router.cc:710:7 #20 0x55615ec67b27 in mojo::MessageDispatcher::Accept(mojo::Message*) ./../../mojo/public/cpp/bindings/lib/message_dispatcher.cc:43:19 #21 0x55615ec42ac0 in mojo::Connector::DispatchMessage(mojo::ScopedHandleBasemojo::MessageHandle) ./../../mojo/public/cpp/bindings/lib/connector.cc:554:49 #22 0x55615ec445aa in mojo::Connector::ReadAllAvailableMessages() ./../../mojo/public/cpp/bindings/lib/connector.cc:611:14 #23 0x55615ec43fc9 in OnHandleReadyInternal ./../../mojo/public/cpp/bindings/lib/connector.cc:444:3 #24 0x55615ec43fc9 in mojo::Connector::OnWatcherHandleReady(char const*, unsigned int) ./../../mojo/public/cpp/bindings/lib/connector.cc:410:3 #25 0x55615ec45994 in Invoke<void (mojo::Connector::)(const char , unsigned int), mojo::Connector , const char , unsigned int> ./../../base/functional/bind_internal.h:713:12 #26 0x55615ec45994 in MakeItSo<void (mojo::Connector::const &)(const char , unsigned int), const std::__Cr::tuple<base::internal::UnretainedWrapper<mojo::Connector, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>, base::internal::UnretainedWrapper<const char, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0> > &, unsigned int> ./../../base/functional/bind_internal.h:868:12 #27 0x55615ec45994 in void base::internal::Invoker<base::internal::FunctorTraits<void (mojo::Connector::)(char const, unsigned int)>, base::internal::BindState<true, true, false, void (mojo::Connector::)(char const, unsigned int), base::internal::UnretainedWrapper<mojo::Connector, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>, base::internal::UnretainedWrapper<char const, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>, void (unsigned int)>::RunImpl<void (mojo::Connector:: const&)(char const, unsigned int), std::__Cr::tuple<base::internal::UnretainedWrapper<mojo::Connector, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>, base::internal::UnretainedWrapper<char const, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>> const&, 0ul, 1ul>(void (mojo::Connector::* const&)(char const*, unsigned int), std::__Cr::tuple<base::internal::UnretainedWrapper<mojo::Connector, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>, base::internal::UnretainedWrapper<char const, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>> const&, std::__Cr::integer_sequence<unsigned long, 0ul, 1ul>, unsigned int&&) ./../../base/functional/bind_internal.h:1005:14 #28 0x55615ec456e4 in base::internal::Invoker<base::internal::FunctorTraits<void (mojo::Connector::)(char const, unsigned int)>, base::internal::BindState<true, true, false, void (mojo::Connector::)(char const, unsigned int), base::internal::UnretainedWrapper<mojo::Connector, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>, base::internal::UnretainedWrapper<char const, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>, void (unsigned int)>::Run(base::internal::BindStateBase*, unsigned int) ./../../base/functional/bind_internal.h:925:12 #29 0x556150812183 in base::RepeatingCallback<void (unsigned int)>::Run(unsigned int) const & ./../../base/functional/callback.h:344:12 #30 0x556150811f0f in Invoke<void (const &)(const base::RepeatingCallback<void (unsigned int)> &, unsigned int, const mojo::HandleSignalsState &), const base::RepeatingCallback<void (unsigned int)> &, unsigned int, const mojo::HandleSignalsState &> ./../../base/functional/bind_internal.h:644:12 #31 0x556150811f0f in MakeItSo<void (const &)(const base::RepeatingCallback<void (unsigned int)> &, unsigned int, const mojo::HandleSignalsState &), const std::__Cr::tuple<base::RepeatingCallback<void (unsigned int)> > &, unsigned int, const mojo::HandleSignalsState &> ./../../base/functional/bind_internal.h:868:12 #32 0x556150811f0f in RunImpl<void (const &)(const base::RepeatingCallback<void (unsigned int)> &, unsigned int, const mojo::HandleSignalsState &), const std::__Cr::tuple<base::RepeatingCallback<void (unsigned int)> > &, 0UL> ./../../base/functional/bind_internal.h:1005:14 #33 0x556150811f0f in base::internal::Invoker<base::internal::FunctorTraits<void ()(base::RepeatingCallback<void (unsigned int)> const&, unsigned int, mojo::HandleSignalsState const&)>, base::internal::BindState<false, true, false, void ()(base::RepeatingCallback<void (unsigned int)> const&, unsigned int, mojo::HandleSignalsState const&), base::RepeatingCallback<void (unsigned int)>>, void (unsigned int, mojo::HandleSignalsState const&)>::Run(base::internal::BindStateBase, unsigned int, mojo::HandleSignalsState const&) ./../../base/functional/bind_internal.h:925:12 #34 0x55615ecca68b in base::RepeatingCallback<void (unsigned int, mojo::HandleSignalsState const&)>::Run(unsigned int, mojo::HandleSignalsState const&) const & ./../../base/functional/callback.h:344:12 #35 0x55615ecc9fad in mojo::SimpleWatcher::OnHandleReady(int, unsigned int, mojo::HandleSignalsState const&) ./../../mojo/public/cpp/system/simple_watcher.cc:278:14 #36 0x55615eccb1f4 in Invoke<void (mojo::SimpleWatcher::)(int, unsigned int, const mojo::HandleSignalsState &), const base::WeakPtrmojo::SimpleWatcher &, int, unsigned int, mojo::HandleSignalsState> ./../../base/functional/bind_internal.h:713:12 #37 0x55615eccb1f4 in MakeItSo<void (mojo::SimpleWatcher::)(int, unsigned int, const mojo::HandleSignalsState &), std::__Cr::tuple<base::WeakPtrmojo::SimpleWatcher, int, unsigned int, mojo::HandleSignalsState> > ./../../base/functional/bind_internal.h:892:5 #38 0x55615eccb1f4 in void base::internal::Invoker<base::internal::FunctorTraits<void (mojo::SimpleWatcher::)(int, unsigned int, mojo::HandleSignalsState const&)>, base::internal::BindState<true, true, false, void (mojo::SimpleWatcher::)(int, unsigned int, mojo::HandleSignalsState const&), base::WeakPtrmojo::SimpleWatcher, int, unsigned int, mojo::HandleSignalsState>, void ()>::RunImpl<void (mojo::SimpleWatcher::)(int, unsigned int, mojo::HandleSignalsState const&), std::__Cr::tuple<base::WeakPtrmojo::SimpleWatcher, int, unsigned int, mojo::HandleSignalsState>, 0ul, 1ul, 2ul, 3ul>(void (mojo::SimpleWatcher::&&)(int, unsigned int, mojo::HandleSignalsState const&), std::__Cr::tuple<base::WeakPtrmojo::SimpleWatcher, int, unsigned int, mojo::HandleSignalsState>&&, std::__Cr::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul>) ./../../base/functional/bind_internal.h:1005:14 #39 0x55615d5bf444 in Run ./../../base/functional/callback.h:156:12 #40 0x55615d5bf444 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) ./../../base/task/common/task_annotator.cc:202:34 #41 0x55615d61e60f in RunTask<(lambda at ../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:475:11)> ./../../base/task/common/task_annotator.h:89:5 #42 0x55615d61e60f in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:473:23 #43 0x55615d61d609 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:338:41 #44 0x55615d61f3ca in non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:0:0 #45 0x55615d4bb12c in base::MessagePumpDefault::Run(base::MessagePump::Delegate*) ./../../base/message_loop/message_pump_default.cc:40:55 #46 0x55615d6200ff in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:641:12 #47 0x55615d5546df in base::RunLoop::Run(base::Location const&) ./../../base/run_loop.cc:134:14 #48 0x55617462660a in content::RendererMain(content::MainFunctionParams) ./../../content/renderer/renderer_main.cc:367:16 #49 0x55615acf5178 in content::RunZygote(content::ContentMainDelegate*) ./../../content/app/content_main_runner_impl.cc:676:14 #50 0x55615acf66bc in content::RunOtherNamedProcessTypeMain(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>> const&, content::MainFunctionParams, content::ContentMainDelegate*) ./../../content/app/content_main_runner_impl.cc:780:12 #51 0x55615acf90ef in content::ContentMainRunnerImpl::Run() ./../../content/app/content_main_runner_impl.cc:1146:10 #52 0x55615acf34d0 in content::RunContentProcess(content::ContentMainParams, content::ContentMainRunner*) ./../../content/app/content_main.cc:335:36 #53 0x55615acf3b4b in content::ContentMain(content::ContentMainParams) ./../../content/app/content_main.cc:348:10 #54 0x55614bccbf28 in ChromeMain ./../../chrome/app/chrome_main.cc:192:12 #55 0x7f323f029d8f in __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
SUMMARY: AddressSanitizer: heap-use-after-free (/home/pwn11/asan-linux-release/chrome+0x15bb11f3) (BuildId: 4e869c3b145cc235) Shadow bytes around the buggy address: 0x514000141280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x514000141300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x514000141380: 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa 0x514000141400: fa fa fa fa fa fa f7 fa fd fd fd fd fd fd fd fd 0x514000141480: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd =>0x514000141500: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd[fd] 0x514000141580: fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa 0x514000141600: fa fa fa fa fa fa f7 fa fd fd fd fd fd fd fd fd 0x514000141680: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x514000141700: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x514000141780: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb
==1==ADDITIONAL INFO
==1==Note: Please include this section with the ASan report. Task trace: #0 0x55616a6ce5c0 in blink::InspectorTaskRunner::AppendTask(WTF::CrossThreadOnceFunction<void ()>) ./../../third_party/blink/renderer/core/inspector/inspector_task_runner.cc:40:30
MiraclePtr Status: NOT PROTECTED No raw_ptr<T> access to this region was detected prior to this crash. This crash is still exploitable with MiraclePtr. Refer to https://chromium.googlesource.com/chromium/src/+/main/base/memory/raw_ptr.md for details.
==1==END OF ADDITIONAL INFO ==1==ABORTING
Context
This is a use-after-free in V8, the JavaScript engine inside Chrome, tracked as CVE-2024-5841 and reported through the Chrome VRP. The crash happens in the V8 inspector, the component that serves the DevTools protocol, and specifically in the code path that handles the Debugger.setBlackboxPatterns command. The report was disclosed on 11 June 2024, rated medium severity, and paid a bounty of 2000.00 USD. The researcher is Cassidy Kim (@cassidy6564).
The interesting part is the thread: the faulting access happens on a DedicatedWorker thread, not the main renderer thread. The worker's inspector session is being torn down while a protocol command is still being dispatched into it.
Setup
The report gives the tested environment:
- OS: Ubuntu 22.04
- Chrome: stable and dev channels
- An ASan build of Chrome, as shown by the AddressSanitizer output and the build path in the summary line
No account, role or special configuration is required. The only precondition is that DevTools is attached to the page, which the launch flags arrange automatically.
Finding it
The researcher does not describe how the bug was first noticed. What the report shows is a reliable reproduction: a page that spawns a dedicated worker, loaded repeatedly in tabs with DevTools auto-opened, eventually produces a heap-use-after-free in v8_inspector::V8DebuggerAgentImpl::setBlackboxPattern. The UAF reproduces after several or dozens of refreshes, and if it does not reproduce, opening a few more tabs is suggested.
Exploitation
Step 1: launch Chrome with DevTools auto-opened and GC exposed
/chrome --disable-gpu --auto-open-devtools-for-tabs --disable-in-process-stack-traces --incognito --user-data-dir=/tmp/xx1 --js-flags=--expose-gc http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html
The launch command uses these flags:
--auto-open-devtools-for-tabsattaches a DevTools session to every tab, which is what creates the inspector session on the worker.
The same crash.html URL is passed thirteen times on the command line.
Step 2: refresh until the race lands
UAF will repro after several or dozens of refreshes. If it doesn't repro, try opening a few more tabs.
The report says the UAF reproduces after several or dozens of refreshes.
Step 3: read the ASan report
The crash is reported as:
==1==ERROR: AddressSanitizer: heap-use-after-free on address 0x514000141578 at pc 0x5561533891f4 bp 0x7f2ded449d10 sp 0x7f2ded449d08
READ of size 8 at 0x514000141578 thread T315 (DedicatedWorker)
The faulting read is on thread T315, a DedicatedWorker. The top of the stack is the assignment into a unique_ptr inside setBlackboxPattern:
#0 0x5561533891f3 in reset ./../../third_party/libc++/src/include/__memory/unique_ptr.h:276:29
#1 0x5561533891f3 in operator= ./../../third_party/libc++/src/include/__memory/unique_ptr.h:220:5
#2 0x5561533891f3 in v8_inspector::V8DebuggerAgentImpl::setBlackboxPattern(v8_inspector::String16 const&) ./../../v8/src/inspector/v8-debugger-agent-impl.cc:1698:21
#3 0x55615339fc39 in v8_inspector::V8DebuggerAgentImpl::setBlackboxPatterns(std::__Cr::unique_ptr<std::__Cr::vector<v8_inspector::String16, std::__Cr::allocator<v8_inspector::String16>>, std::__Cr::default_delete<std::__Cr::vector<v8_inspector::String16, std::__Cr::allocator<v8_inspector::String16>>>>) ./../../v8/src/inspector/v8-debugger-agent-impl.cc:1685:23
#4 0x5561532e7d3b in v8_inspector::protocol::Debugger::DomainDispatcherImpl::setBlackboxPatterns(v8_crdtp::Dispatchable const&) ./gen/v8/src/inspector/protocol/Debugger.cpp:1294:44
Below that, the command is being dispatched from Blink into V8:
#8 0x5561533fe83f in v8_inspector::V8InspectorSessionImpl::dispatchProtocolMessage(v8_inspector::StringView) ./../../v8/src/inspector/v8-inspector-session-impl.cc:395:39
#9 0x55616a9f87b8 in blink::DevToolsSession::DispatchProtocolCommandImpl(int, WTF::String const&, base::span<unsigned char const, 18446744073709551615ul, unsigned char const*>) ./../../third_party/blink/renderer/core/inspector/devtools_session.cc:262:18
The dispatch is running from InspectorTaskRunner::PerformSingleInterruptingTaskDontWait, which is how Blink runs inspector work on the worker thread:
#16 0x55616a6cf18f in blink::InspectorTaskRunner::PerformSingleInterruptingTaskDontWait() ./../../third_party/blink/renderer/core/inspector/inspector_task_runner.cc:103:21
And the worker thread is inside a nested message loop because it was paused or frozen for the debugger:
#31 0x55616bff2285 in blink::WorkerThread::PauseOrFreezeOnWorkerThread(blink::mojom::FrameLifecycleState, bool) ./../../third_party/blink/renderer/core/workers/worker_thread.cc:917:20
#33 0x55616a9db71f in blink::WorkerThreadDebugger::runMessageLoopOnPause(int) ./../../third_party/blink/renderer/core/inspector/worker_thread_debugger.cc:182:11
The freed region is described as:
0x514000141578 is located 312 bytes inside of 400-byte region [0x514000141440,0x5140001415d0)
freed by thread T315 (DedicatedWorker) here:
The free stack shows the inspector session being destroyed from DevToolsSession::Detach, which is itself invoked from a Mojo error notification:
#4 0x5561533fb4b4 in v8_inspector::V8InspectorSessionImpl::~V8InspectorSessionImpl() ./../../v8/src/inspector/v8-inspector-session-impl.cc:169:1
#8 0x55616a9f6b7c in blink::DevToolsSession::Detach() ./../../third_party/blink/renderer/core/inspector/devtools_session.cc:215:15
#14 0x55615ec511c2 in mojo::InterfaceEndpointClient::NotifyError(std::__Cr::optional<mojo::DisconnectReason> const&) ./../../mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:744:31
The allocation stack shows the same session being created when the worker's inspector controller attached:
#1 0x5561533fa206 in v8_inspector::V8InspectorSessionImpl::V8InspectorSessionImpl(v8_inspector::V8InspectorImpl*, int, int, v8_inspector::V8Inspector::Channel*, v8_inspector::StringView, v8_inspector::V8Inspector::ClientTrustLevel, std::__Cr::shared_ptr<v8_inspector::V8DebuggerBarrier>) ./../../v8/src/inspector/v8-inspector-session-impl.cc:129:25
#4 0x55616a9f7877 in blink::DevToolsSession::ConnectToV8(v8_inspector::V8Inspector*, int) ./../../third_party/blink/renderer/core/inspector/devtools_session.cc:181:28
#5 0x55616a9dea02 in blink::WorkerInspectorController::AttachSession(blink::DevToolsSession*, bool) ./../../third_party/blink/renderer/core/inspector/worker_inspector_controller.cc:118:12
The additional info section names the task that was queued on the inspector task runner:
Task trace:
#0 0x55616a6ce5c0 in blink::InspectorTaskRunner::AppendTask(WTF::CrossThreadOnceFunction<void ()>) ./../../third_party/blink/renderer/core/inspector/inspector_task_runner.cc:40:30
It also records the pointer-hardening status:
MiraclePtr Status: NOT PROTECTED
No raw_ptr<T> access to this region was detected prior to this crash.
This crash is still exploitable with MiraclePtr.
Root cause
The sequence the stacks describe is a lifetime race on the worker's inspector session. A Debugger.setBlackboxPatterns command is queued as an interrupting task on the worker's InspectorTaskRunner. Before that task runs, the DevTools session is detached: a Mojo disconnect error reaches DevToolsSession::Detach, which destroys the V8InspectorSessionImpl and with it the V8DebuggerAgentImpl. The queued task then runs anyway and dispatches the protocol message into the freed session, and setBlackboxPattern writes through a dangling unique_ptr member.
The worker thread is inside a nested message loop from runMessageLoopOnPause at the time. The report does not state which side should have cancelled the other; it only shows the ordering that produces the crash.
MiraclePtr did not help here: the report records that no raw_ptr<T> access to the region was detected before the crash, and that the crash is still exploitable with MiraclePtr enabled.
Impact
The report is filed as a use-after-free in V8 with medium severity. The crash is a read of size 8 from freed heap memory on a worker thread, and the report notes it remains exploitable with MiraclePtr.
Fix
It only records the crash, the reproduction and the ASan output.
Variants to test
- Other
Debuggerdomain commands that mutate inspector agent state, such as blackbox pattern updates, sent to a worker session while the session is being detached. A positive result is an ASan heap-use-after-free whose free stack goes throughDevToolsSession::Detachand whose use stack is inside the correspondingV8DebuggerAgentImplmethod. - The same pattern on other worker types (shared and service workers) where an inspector session is attached and then disconnected. A positive result is the same detach-then-dispatch ordering on the worker thread.
- A positive result is a higher reproduction rate across refreshes.
- Detaching DevTools manually while a worker is paused at a breakpoint, rather than relying on tab refresh. A positive result is the same UAF with the detach arriving from the frontend disconnect instead of a Mojo error.
What happened, in plain words
Chrome is a web browser. Inside Chrome there is a piece of software called V8, which is the part that reads and runs the JavaScript code that web pages contain. V8 is what makes a page's scripts actually do something.
Chrome also has a set of tools for developers, called DevTools. When you press F12 in Chrome, or right-click and choose "Inspect", you open DevTools. It lets you look at a page's code, watch what it is doing, pause it, and so on. To make that work, Chrome and DevTools talk to each other using a set of agreed commands, called the DevTools protocol. Think of it as a menu of instructions: "pause here", "show me the variables", "ignore this file when debugging". One of those instructions is called Debugger.setBlackboxPatterns, and it tells the debugger which files to skip over while stepping through code.
This report is about a bug in that area. A web page can ask the browser to start a background helper, called a worker, which runs JavaScript separately from the page itself. A worker can also be inspected by DevTools. The bug is that, in a particular timing, the worker's debugging connection gets shut down and thrown away, but a command that was already on its way to that connection still gets delivered afterwards. The command then writes into memory that has already been freed. In security terms this is called a use-after-free: the program uses a piece of memory after it has given it back, like reading a note you already threw in the bin, except the bin may already have been emptied and refilled with something else.
The bug is tracked as CVE-2024-5841. A CVE is a public catalogue number given to a known security flaw so people can refer to it unambiguously. It was reported through the Chrome VRP, Chrome's Vulnerability Reward Program, which pays people who find and report security bugs. The report was disclosed on 11 June 2024, rated medium severity, and paid a bounty of 2000.00 USD. The researcher is Cassidy Kim (@cassidy6564).
The detail that makes this bug interesting is which thread it happens on. A thread is one line of execution inside a program; a program can run several at once. The crash happens on a worker thread, not on the main thread that draws the page. The worker's debugging session is being torn down at the same moment a protocol command is still being handed to it.
Setup
The report gives the tested environment:
- Operating system: Ubuntu 22.04
- Chrome: the stable and dev channels (two of the release tracks Chrome ships on)
- A special build of Chrome that includes AddressSanitizer, as shown by the AddressSanitizer output and the build path in the summary line
AddressSanitizer, usually shortened to ASan, is a tool built into a special version of a program that watches memory as the program runs. When the program touches memory it should not, ASan stops it and prints a detailed report. Normal Chrome does not have this; researchers build a special copy for testing.
No account, role or special configuration is required. The only precondition is that DevTools is attached to the page, which the launch flags arrange automatically.
Finding it
The researcher does not describe how the bug was first noticed. What the report shows is a reliable reproduction: a page that spawns a dedicated worker, loaded repeatedly in tabs with DevTools auto-opened, eventually produces a heap-use-after-free in v8_inspector::V8DebuggerAgentImpl::setBlackboxPattern. The UAF reproduces after several or dozens of refreshes, and if it does not reproduce, opening a few more tabs is suggested.
A dedicated worker is a background script that belongs to one page. It runs on its own thread, separate from the page, which is why the crash lands on a worker thread rather than the main one.
Exploitation
Step 1: launch Chrome with DevTools auto-opened and GC exposed
/chrome --disable-gpu --auto-open-devtools-for-tabs --disable-in-process-stack-traces --incognito --user-data-dir=/tmp/xx1 --js-flags=--expose-gc http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html http://localhost:8880/crash.html
This is a command you type into a terminal to start Chrome. Everything after the program name is a flag, a switch that changes how Chrome behaves, followed by the web addresses Chrome should open. Line by line:
/chromeis the program being started, here the ASan build of Chrome.--auto-open-devtools-for-tabsmakes Chrome open DevTools automatically for every tab.- Garbage collection is the process where the browser reclaims memory it no longer needs; normally pages cannot trigger it directly.
- The same
crash.htmladdress is passed thirteen times on the command line.
Step 2: refresh until the race lands
UAF will repro after several or dozens of refreshes. If it doesn't repro, try opening a few more tabs.
The report says the UAF reproduces after several or dozens of refreshes.
A race here means two things happening at almost the same moment, where the outcome depends on which one finishes first. If the shutdown always happened before the command arrived, or always after, there would be no bug. The problem is the in-between case, which only shows up some of the time, hence the repeated refreshes.
Step 3: read the ASan report
The crash is reported as:
==1==ERROR: AddressSanitizer: heap-use-after-free on address 0x514000141578 at pc 0x5561533891f4 bp 0x7f2ded449d10 sp 0x7f2ded449d08
READ of size 8 at 0x514000141578 thread T315 (DedicatedWorker)
This is ASan announcing the problem. It says the program tried to read from a memory address that had already been freed (heap-use-after-free). The read was 8 bytes long, and it happened on thread T315, which ASan labels as a DedicatedWorker. The other numbers are internal addresses and register values that help developers locate the exact instruction.
The faulting read is on thread T315, a DedicatedWorker. The top of the stack is the assignment into a unique_ptr inside setBlackboxPattern:
#0 0x5561533891f3 in reset ./../../third_party/libc++/src/include/__memory/unique_ptr.h:276:29
#1 0x5561533891f3 in operator= ./../../third_party/libc++/src/include/__memory/unique_ptr.h:220:5
#2 0x5561533891f3 in v8_inspector::V8DebuggerAgentImpl::setBlackboxPattern(v8_inspector::String16 const&) ./../../v8/src/inspector/v8-debugger-agent-impl.cc:1698:21
#3 0x55615339fc39 in v8_inspector::V8DebuggerAgentImpl::setBlackboxPatterns(std::__Cr::unique_ptr<std::__Cr::vector<v8_inspector::String16, std::__Cr::allocator<v8_inspector::String16>>, std::__Cr::default_delete<std::__Cr::vector<v8_inspector::String16, std::__Cr::allocator<v8_inspector::String16>>>>) ./../../v8/src/inspector/v8-debugger-agent-impl.cc:1685:23
#4 0x5561532e7d3b in v8_inspector::protocol::Debugger::DomainDispatcherImpl::setBlackboxPatterns(v8_crdtp::Dispatchable const&) ./gen/v8/src/inspector/protocol/Debugger.cpp:1294:44
A stack trace is a list of the function calls that led to the current point, newest first. Frame #0 is where the crash happened, #1 is the function that called it, and so on down the list. Each line also shows the source file and line number, which is how developers know exactly where to look.
#0is insideunique_ptr.h, in a function calledreset. Aunique_ptris a small C++ object that owns a piece of memory and frees it automatically when it is no longer needed.resetreplaces what it owns. This is the exact instruction that touched freed memory.#1is the assignment operator of the sameunique_ptr, which callsreset.#2isV8DebuggerAgentImpl::setBlackboxPattern, the function that stores the blackbox pattern. This is the code that was running when the freed memory was read.#3issetBlackboxPatterns, the plural version, which handles the list of patterns and calls the singular one.#4is the protocol dispatcher, the piece of generated code that receives theDebugger.setBlackboxPatternscommand from DevTools and routes it to the right handler.
Below that, the command is being dispatched from Blink into V8:
#8 0x5561533fe83f in v8_inspector::V8InspectorSessionImpl::dispatchProtocolMessage(v8_inspector::StringView) ./../../v8/src/inspector/v8-inspector-session-impl.cc:395:39
#9 0x55616a9f87b8 in blink::DevToolsSession::DispatchProtocolCommandImpl(int, WTF::String const&, base::span<unsigned char const, 18446744073709551615ul, unsigned char const*>) ./../../third_party/blink/renderer/core/inspector/devtools_session.cc:262:18
Blink is the part of Chrome that handles web content: the page, its scripts, its workers. These frames show the command travelling from Blink's DevTools session into V8's inspector session. dispatchProtocolMessage is the function that takes a raw protocol message and hands it to the right part of V8.
The dispatch is running from InspectorTaskRunner::PerformSingleInterruptingTaskDontWait, which is how Blink runs inspector work on the worker thread:
#16 0x55616a6cf18f in blink::InspectorTaskRunner::PerformSingleInterruptingTaskDontWait() ./../../third_party/blink/renderer/core/inspector/inspector_task_runner.cc:103:21
A task runner is a queue of jobs that a thread works through one at a time. This frame shows the worker thread picking up a queued inspector job and running it. The name says it is an interrupting task: it is meant to jump in and run promptly.
And the worker thread is inside a nested message loop because it was paused or frozen for the debugger:
#31 0x55616bff2285 in blink::WorkerThread::PauseOrFreezeOnWorkerThread(blink::mojom::FrameLifecycleState, bool) ./../../third_party/blink/renderer/core/workers/worker_thread.cc:917:20
#33 0x55616a9db71f in blink::WorkerThreadDebugger::runMessageLoopOnPause(int) ./../../third_party/blink/renderer/core/inspector/worker_thread_debugger.cc:182:11
A message loop is the mechanism a thread uses to wait for and process incoming work. A nested one means the thread is running a second loop inside the first, which is what happens when the debugger pauses a worker: the worker sits in this inner loop, still able to process some messages, while the debugger is in control.
The freed region is described as:
0x514000141578 is located 312 bytes inside of 400-byte region [0x514000141440,0x5140001415d0)
freed by thread T315 (DedicatedWorker) here:
This tells us the memory that was read belonged to a 400-byte block, and the read was 312 bytes into it. ASan then shows where that block was freed.
The free stack shows the inspector session being destroyed from DevToolsSession::Detach, which is itself invoked from a Mojo error notification:
#4 0x5561533fb4b4 in v8_inspector::V8InspectorSessionImpl::~V8InspectorSessionImpl() ./../../v8/src/inspector/v8-inspector-session-impl.cc:169:1
#8 0x55616a9f6b7c in blink::DevToolsSession::Detach() ./../../third_party/blink/renderer/core/inspector/devtools_session.cc:215:15
#14 0x55615ec511c2 in mojo::InterfaceEndpointClient::NotifyError(std::__Cr::optional<mojo::DisconnectReason> const&) ./../../mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:744:31
Mojo is Chrome's internal messaging system, the way different parts of the browser talk to each other. When one end of a connection goes away, Mojo sends an error notification to the other end. Here that notification reaches DevToolsSession::Detach, which shuts the session down, and the destructor ~V8InspectorSessionImpl frees the session object. The tilde in front of a name in C++ marks a destructor, the function that runs when an object is destroyed.
The allocation stack shows the same session being created when the worker's inspector controller attached:
#1 0x5561533fa206 in v8_inspector::V8InspectorSessionImpl::V8InspectorSessionImpl(v8_inspector::V8InspectorImpl*, int, int, v8_inspector::V8Inspector::Channel*, v8_inspector::StringView, v8_inspector::V8Inspector::ClientTrustLevel, std::__Cr::shared_ptr<v8_inspector::V8DebuggerBarrier>) ./../../v8/src/inspector/v8-inspector-session-impl.cc:129:25
#4 0x55616a9f7877 in blink::DevToolsSession::ConnectToV8(v8_inspector::V8Inspector*, int) ./../../third_party/blink/renderer/core/inspector/devtools_session.cc:181:28
#5 0x55616a9dea02 in blink::WorkerInspectorController::AttachSession(blink::DevToolsSession*, bool) ./../../third_party/blink/renderer/core/inspector/worker_inspector_controller.cc:118:12
This is the other half of the story: where the memory came from in the first place. The session object was created when the worker's inspector controller attached a DevTools session to V8. So the same object was created here, later freed in the free stack above, and then read in the crash stack.
The additional info section names the task that was queued on the inspector task runner:
Task trace:
#0 0x55616a6ce5c0 in blink::InspectorTaskRunner::AppendTask(WTF::CrossThreadOnceFunction<void ()>) ./../../third_party/blink/renderer/core/inspector/inspector_task_runner.cc:40:30
This records that a task was added to the inspector task runner's queue.
It also records the pointer-hardening status:
MiraclePtr Status: NOT PROTECTED
No raw_ptr<T> access to this region was detected prior to this crash.
This crash is still exploitable with MiraclePtr.
MiraclePtr is a Chrome defence that makes certain kinds of use-after-free harder to exploit, by checking pointers before they are used. Here it reports that the crash is not protected by it: no protected pointer access to this memory was detected before the crash, and the crash is still exploitable even with MiraclePtr enabled. In plain terms, the safety net did not catch this one.
Root cause
The sequence the stacks describe is a lifetime race on the worker's inspector session. A Debugger.setBlackboxPatterns command is queued as an interrupting task on the worker's InspectorTaskRunner. Before that task runs, the DevTools session is detached: a Mojo disconnect error reaches DevToolsSession::Detach, which destroys the V8InspectorSessionImpl and with it the V8DebuggerAgentImpl. The queued task then runs anyway and dispatches the protocol message into the freed session, and setBlackboxPattern writes through a dangling unique_ptr member.
A dangling pointer is a reference to memory that has already been freed. It still looks like a valid address, but whatever is there now is not what the program expects. Writing through one is exactly the use-after-free ASan caught.
The worker thread is inside a nested message loop from runMessageLoopOnPause at the time, which is what allows the detach to be processed while the inspector task is still pending. The report does not state which side should have cancelled the other; it only shows the ordering that produces the crash.
MiraclePtr did not help here: the report records that no raw_ptr<T> access to the region was detected before the crash, and that the crash is still exploitable with MiraclePtr enabled.
Impact
The report is filed as a use-after-free in V8 with medium severity. The crash is a read of size 8 from freed heap memory on a worker thread, and the report notes it remains exploitable with MiraclePtr.
A sandbox escape would mean getting out of the restricted environment Chrome puts web content in, and reaching the rest of the computer. The report does not claim that.
Fix
It only records the crash, the reproduction and the ASan output.
Variants to test
- Other
Debuggerdomain commands that mutate inspector agent state, such as blackbox pattern updates, sent to a worker session while the session is being detached. A positive result is an ASan heap-use-after-free whose free stack goes throughDevToolsSession::Detachand whose use stack is inside the correspondingV8DebuggerAgentImplmethod. - The same pattern on other worker types (shared and service workers) where an inspector session is attached and then disconnected. A positive result is the same detach-then-dispatch ordering on the worker thread.
- A positive result is a higher reproduction rate across refreshes.
- Detaching DevTools manually while a worker is paused at a breakpoint, rather than relying on tab refresh. A positive result is the same UAF with the detach arriving from the frontend disconnect instead of a Mojo error.
A shared worker is a worker that several pages can share. A service worker is a worker that runs in the background, often to handle network requests or offline behaviour. A breakpoint is a marker in code where the debugger pauses execution so you can inspect what is going on.
Glossary
- AddressSanitizer (ASan): a tool built into a special test build of a program that detects and reports invalid memory access, such as reading memory that has already been freed.
- Blink: the part of Chrome that handles web content, including pages, scripts and workers.
- Bounty: a payment made by a company to someone who reports a security bug to it.
- Breakpoint: a marker in code where the debugger pauses execution so you can inspect the state.
- Chrome VRP: Chrome's Vulnerability Reward Program, which pays researchers for reporting security bugs in Chrome.
- CVE: a public catalogue number assigned to a known security vulnerability so it can be referred to unambiguously.
- Dangling pointer: a reference to memory that has already been freed, which still looks valid but no longer points to what the program expects.
- Dedicated worker: a background JavaScript script that belongs to one page and runs on its own thread.
- Destructor: in C++, the function that runs when an object is destroyed, marked by a tilde before the name.
- DevTools: the set of developer tools built into Chrome, opened with F12 or "Inspect", used to examine and debug pages.
- DevTools protocol: the agreed set of commands that DevTools and the browser use to talk to each other.
- Flag: a switch given on a program's command line that changes how it behaves.
- Garbage collection: the process where the browser reclaims memory it no longer needs.
- Heap: the area of memory a program uses for objects it creates while running.
- Message loop: the mechanism a thread uses to wait for and process incoming work.
- MiraclePtr: a Chrome defence that makes certain kinds of use-after-free harder to exploit by checking pointers before use.
- Mojo: Chrome's internal messaging system, used for communication between different parts of the browser.
- Nested message loop: a second message loop running inside the first, which happens when the debugger pauses a worker.
- Race: a situation where two things happen at almost the same moment and the outcome depends on which finishes first.
- Sandbox escape: getting out of the restricted environment Chrome puts web content in, and reaching the rest of the computer.
- Service worker: a background worker that often handles network requests or offline behaviour.
- Shared worker: a worker that several pages can share.
- Stack trace: a list of the function calls that led to a particular point in a program, newest first.
- Task runner: a queue of jobs that a thread works through one at a time.
- Thread: one line of execution inside a program; a program can run several at once.
- unique_ptr: a C++ object that owns a piece of memory and frees it automatically when it is no longer needed.
- Use-after-free: a bug where a program uses memory after it has been freed, which can lead to crashes or, in the wrong hands, to code execution.
- V8: the JavaScript engine inside Chrome, the part that reads and runs the JavaScript code on web pages.
- V8 inspector: the part of V8 that serves the DevTools protocol, letting DevTools inspect and control JavaScript.
- Worker: a background JavaScript script that runs separately from the page, on its own thread.