Skip to content
Memory corruption Advisory Advanced CVE-2025-4372

Use after free in WebAudio (CVE-2025-4372)

A use-after-free occurs in the WebAudio code when an audio buffer is freed on the main thread while a semi-realtime audio worklet thread is still reading from it. The reporter has not yet produced a working proof of concept and describes the trigger as a race condition with very low probability.

Huang Xilin Follow

Originally disclosed on Chrome VRP

Bounty$7,000 Medium View original
  • Fix shipped in 17 days

Steps to reproduce the problem

This vulnerability is a race condition vulnerability with a very low probability of being triggered. I am still trying to reproduce the vulnerability and construct a PoC.

Problem Description

I currently don't know the root cause of this vulnerability. For now, I can only provide the stack backtrace of the vulnerability. You can analyze it based on the stack backtrace first, and I will provide a more detailed vulnerability analysis later.

Summary

Security: Uaf in media::AudioBus

Custom Questions

Type of crash:

tab

Crash state:

==4065400==ERROR: AddressSanitizer: heap-use-after-free on address 0x706aed7ea2f0 at pc 0x5a2da2f06753 bp 0x700a511fcc70 sp 0x700a511fcc68
READ of size 8 at 0x706aed7ea2f0 thread T26 (Semi-Realtime A)
==4065400==WARNING: invalid path to external symbolizer!
==4065400==WARNING: Failed to use and restart external symbolizer!
    #0 0x5a2da2f06752 in media::AudioBus::AllChannelsSubspan(unsigned long, unsigned long) const ./../../media/base/audio_bus.cc:406:24
    #1 0x5a2da2f05d1b in media::AudioBus::CopyPartialFramesTo(int, int, int, media::AudioBus*) const ./../../media/base/audio_bus.cc:370:39
    #2 0x5a2d8bc9b388 in media::AudioPushFifo::Push(media::AudioBus const&) ./../../media/base/audio_push_fifo.cc:60:17
    #3 0x5a2db1bb09eb in blink::WebAudioMediaStreamSource::ConsumeAudio(WTF::Vector<float const*, 0u, WTF::PartitionAllocator> const&, int) ./../../third_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.cc:78:9
    #4 0x5a2db1bcf4d0 in blink::MediaStreamAudioDestinationHandler::ConsumeAudio(blink::AudioBus*, int) ./../../third_party/blink/renderer/modules/webaudio/media_stream_audio_destination_handler.cc:219:28
    #5 0x5a2db1bced69 in blink::MediaStreamAudioDestinationHandler::Process(unsigned int) ./../../third_party/blink/renderer/modules/webaudio/media_stream_audio_destination_handler.cc:89:3
    #6 0x5a2db1a86696 in blink::AudioHandler::ProcessIfNecessary(unsigned int) ./../../third_party/blink/renderer/modules/webaudio/audio_handler.cc:325:7
    #7 0x5a2db1b788f3 in blink::DeferredTaskHandler::ProcessAutomaticPullNodes(unsigned int) ./../../third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc:198:41
    #8 0x5a2db1c0d370 in blink::RealtimeAudioDestinationHandler::Render(blink::AudioBus*, unsigned int, blink::AudioIOPosition const&, blink::AudioCallbackMetric const&, base::TimeDelta, media::AudioGlitchInfo const&) ./../../third_party/blink/renderer/modules/webaudio/realtime_audio_destination_handler.cc:262:37
    #9 0x5a2db1c1bd0c in blink::AudioDestination::PullFromCallback(blink::AudioBus*, base::TimeDelta) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:672:14
    #10 0x5a2db1c154e0 in blink::AudioDestination::RequestRender(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, base::TimeTicks, bool) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:643:7
    #11 0x5a2db1c148ba in blink::AudioDestination::RequestRenderWait(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, base::TimeTicks) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:559:8
    #12 0x5a2db1c1dcca in Invoke<void (AudioDestination::*)(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, const media::AudioGlitchInfo &, base::TimeTicks), scoped_refptr<blink::AudioDestination>, unsigned int, unsigned int, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo, base::TimeTicks> ./../../base/functional/bind_internal.h:731:12
    #13 0x5a2db1c1dcca in MakeItSo<void (AudioDestination::*)(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, const media::AudioGlitchInfo &, base::TimeTicks), std::__Cr::tuple<scoped_refptr<blink::AudioDestination>, unsigned int, unsigned int, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo, base::TimeTicks> > ./../../base/functional/bind_internal.h:923:12
    #14 0x5a2db1c1dcca in RunImpl<void (AudioDestination::*)(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, const media::AudioGlitchInfo &, base::TimeTicks), std::__Cr::tuple<scoped_refptr<blink::AudioDestination>, unsigned int, unsigned int, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo, base::TimeTicks>, 0UL, 1UL, 2UL, 3UL, 4UL, 5UL, 6UL> ./../../base/functional/bind_internal.h:1060:14
    #15 0x5a2db1c1dcca in base::internal::Invoker<base::internal::FunctorTraits<void (blink::AudioDestination::*&&)(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, base::TimeTicks), scoped_refptr<blink::AudioDestination>&&, unsigned int&&, unsigned int&&, base::TimeDelta&&, base::TimeTicks&&, media::AudioGlitchInfo&&, base::TimeTicks&&>, base::internal::BindState<true, true, false, void (blink::AudioDestination::*)(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, base::TimeTicks), scoped_refptr<blink::AudioDestination>, unsigned int, unsigned int, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo, base::TimeTicks>, void ()>::RunOnce(base::internal::BindStateBase*) ./../../base/functional/bind_internal.h:973:12
    #16 0x5a2d9e3e8da6 in Run ./../../base/functional/callback.h:156:12
    #17 0x5a2d9e3e8da6 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) ./../../base/task/common/task_annotator.cc:209:34
    #18 0x5a2d9e45a768 in RunTask<(lambda at ../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:458:11)> ./../../base/task/common/task_annotator.h:106:5
    #19 0x5a2d9e45a768 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:456:23
    #20 0x5a2d9e45964c in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:330:40
    #21 0x5a2d9e45b49a in non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:0:0
    #22 0x5a2d9e2b4273 in base::MessagePumpDefault::Run(base::MessagePump::Delegate*) ./../../base/message_loop/message_pump_default.cc:42:55
    #23 0x5a2d9e45c04b in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:629:12
    #24 0x5a2d9e36c9af in base::RunLoop::Run(base::Location const&) ./../../base/run_loop.cc:134:14
    #25 0x5a2d99da7576 in blink::scheduler::NonMainThreadImpl::SimpleThreadImpl::Run() ./../../third_party/blink/renderer/platform/scheduler/worker/non_main_thread_impl.cc:187:14
    #26 0x5a2d9e534b49 in base::(anonymous namespace)::ThreadFunc(void*) ./../../base/threading/platform_thread_posix.cc:103:13
    #27 0x5a2d88cf9b86 in asan_thread_start(void*) _asan_rtl_:28

0x706aed7ea2f0 is located 16 bytes inside of 64-byte region [0x706aed7ea2e0,0x706aed7ea320)
freed by thread T0 (chrome) here:
    #0 0x5a2d88d3688d in operator delete(void*) _asan_rtl_:3
    #1 0x5a2da2f00726 in ~vector ./../../third_party/libc++/src/include/__vector/vector.h:257:67
    #2 0x5a2da2f00726 in media::AudioBus::~AudioBus() ./../../media/base/audio_bus.cc:130:1
    #3 0x5a2da2f00853 in media::AudioBus::~AudioBus() ./../../media/base/audio_bus.cc:126:23
    #4 0x5a2d8bc9ae30 in operator() ./../../third_party/libc++/src/include/__memory/unique_ptr.h:76:5
    #5 0x5a2d8bc9ae30 in reset ./../../third_party/libc++/src/include/__memory/unique_ptr.h:287:7
    #6 0x5a2d8bc9ae30 in ~unique_ptr ./../../third_party/libc++/src/include/__memory/unique_ptr.h:256:71
    #7 0x5a2d8bc9ae30 in media::AudioPushFifo::~AudioPushFifo() ./../../media/base/audio_push_fifo.cc:19:31
    #8 0x5a2db1bb00ba in ~WebAudioMediaStreamSource ./../../third_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.cc:29:1
    #9 0x5a2db1bb00ba in blink::WebAudioMediaStreamSource::~WebAudioMediaStreamSource() ./../../third_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.cc:27:57
    #10 0x5a2db1bbd0a5 in operator() ./../../third_party/libc++/src/include/__memory/unique_ptr.h:76:5
    #11 0x5a2db1bbd0a5 in reset ./../../third_party/libc++/src/include/__memory/unique_ptr.h:287:7
    #12 0x5a2db1bbd0a5 in Dispose ./../../third_party/blink/renderer/platform/mediastream/media_stream_source.cc:264:20
    #13 0x5a2db1bbd0a5 in blink::MediaStreamSource::InvokePreFinalizer(cppgc::LivenessBroker const&, void*) ./../../third_party/blink/renderer/platform/mediastream/media_stream_source.h:60:3
    #14 0x5a2d9109b6e9 in operator() ./../../v8/src/heap/cppgc/prefinalizer-handler.cc:71:31
    #15 0x5a2d9109b6e9 in remove_if<std::__Cr::reverse_iterator<std::__Cr::__wrap_iter<cppgc::internal::PreFinalizer *> >, (lambda at ../../v8/src/heap/cppgc/prefinalizer-handler.cc:70:22)> ./../../third_party/libc++/src/include/__algorithm/remove_if.h:32:12
    #16 0x5a2d9109b6e9 in cppgc::internal::PreFinalizerHandler::InvokePreFinalizers() ./../../v8/src/heap/cppgc/prefinalizer-handler.cc:68:7
    #17 0x5a2d910688c7 in cppgc::internal::HeapBase::ExecutePreFinalizers() ./../../v8/src/heap/cppgc/heap-base.cc:169:26
    #18 0x5a2d8efb96e6 in v8::internal::CppHeap::CompactAndSweep() ./../../v8/src/heap/cppgc-js/cpp-heap.cc:990:51
    #19 0x5a2d8f0f1f05 in v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) ./../../v8/src/heap/heap.cc:2299:32
    #20 0x5a2d8f1416fb in v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_0::operator()() const ./../../v8/src/heap/heap.cc:1670:7
    #21 0x5a2d8f140ecc in void heap::base::Stack::SetMarkerAndCallbackImpl<v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_0>(heap::base::Stack*, void*, void const*) ./../../v8/src/heap/base/stack.h:174:5
    #22 0x5a2d910c1c12 in PushAllRegistersAndIterateStack push_registers_asm.cc:0:0
    #23 0x5a2d8f0e59cc in SetMarkerIfNeededAndCallback<(lambda at ../../v8/src/heap/heap.cc:1638:40)> ./../../v8/src/heap/base/stack.h:76:7
    #24 0x5a2d8f0e59cc in v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) ./../../v8/src/heap/heap.cc:1638:11
    #25 0x5a2d8f0eb2a2 in CollectAllGarbage ./../../v8/src/heap/heap.cc:1269:3
    #26 0x5a2d8f0eb2a2 in v8::internal::Heap::HandleExternalMemoryInterrupt() ./../../v8/src/heap/heap.cc:1436:5
    #27 0x5a2d8f9d372e in CreateExtension ./../../v8/src/objects/js-array-buffer.cc:261:20
    #28 0x5a2d8f9d372e in v8::internal::JSArrayBuffer::Setup(v8::internal::SharedFlag, v8::internal::ResizableFlag, std::__Cr::shared_ptr<v8::internal::BackingStore>, v8::internal::Isolate*) ./../../v8/src/objects/js-array-buffer.cc:119:3
    #29 0x5a2d8f03de0d in v8::internal::Factory::NewJSArrayBuffer(std::__Cr::shared_ptr<v8::internal::BackingStore>, v8::internal::AllocationType) ./../../v8/src/heap/factory.cc:3504:11
    #30 0x5a2d90f06220 in v8::internal::WasmMemoryObject::New(v8::internal::Isolate*, int, int, v8::internal::SharedFlag, v8::internal::wasm::AddressType) ./../../v8/src/wasm/wasm-objects.cc:1000:33
    #31 0x5a2d90ea7dc9 in WebAssemblyMemoryImpl ./../../v8/src/wasm/wasm-js.cc:1632:8
    #32 0x5a2d90ea7dc9 in v8::internal::wasm::WebAssemblyMemory(v8::FunctionCallbackInfo<v8::Value> const&) ./../../v8/src/wasm/wasm-js.cc:3215:1
    #33 0x5a2d8ea4fc02 in v8::internal::FunctionCallbackArguments::CallOrConstruct(v8::internal::Tagged<v8::internal::FunctionTemplateInfo>, bool) ./../../v8/src/api/api-arguments-inl.h:93:3
    #34 0x5a2d8ea4df9a in v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::DirectHandle<v8::internal::HeapObject>, v8::internal::DirectHandle<v8::internal::FunctionTemplateInfo>, v8::internal::DirectHandle<v8::internal::Object>, unsigned long*, int) ./../../v8/src/builtins/builtins-api.cc:104:16
    #35 0x5a2d8ea4c06f in v8::internal::Builtin_Impl_HandleApiConstruct(v8::internal::BuiltinArguments, v8::internal::Isolate*) ./../../v8/src/builtins/builtins-api.cc:135:3
    #36 0x5a2d92ff2fb5 in Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit setup-isolate-deserialize.cc:0:0
    #37 0x5a2d92f48aa4 in Builtins_JSBuiltinsConstructStub setup-isolate-deserialize.cc:0:0
    #24 0x5a2de008dbc4  ([anon:v8]+0x8dbc4)
    #25 0x5a2de0085664  ([anon:v8]+0x85664)
    #40 0x5a2d92f4971b in Builtins_JSEntryTrampoline setup-isolate-deserialize.cc:0:0
    #41 0x5a2d92f4946a in Builtins_JSEntry setup-isolate-deserialize.cc:0:0
    #42 0x5a2d8ee48571 in Call ./../../v8/src/execution/simulator.h:212:12
    #43 0x5a2d8ee48571 in v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) ./../../v8/src/execution/execution.cc:440:22
    #44 0x5a2d8ee46f89 in v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::DirectHandle<v8::internal::Object>, v8::internal::DirectHandle<v8::internal::Object>, v8::base::Vector<v8::internal::DirectHandle<v8::internal::Object> const>) ./../../v8/src/execution/execution.cc:530:10

previously allocated by thread T26 (Semi-Realtime A) here:
    #0 0x5a2d88d3602d in operator new(unsigned long) _asan_rtl_:3
    #1 0x5a2da2effb92 in __libcpp_operator_new<unsigned long> ./../../third_party/libc++/src/include/__new/allocate.h:37:10
    #2 0x5a2da2effb92 in __libcpp_allocate<base::span<float, 18446744073709551615UL, float *> > ./../../third_party/libc++/src/include/__new/allocate.h:64:28
    #3 0x5a2da2effb92 in allocate ./../../third_party/libc++/src/include/__memory/allocator.h:105:14
    #4 0x5a2da2effb92 in __allocate_at_least<std::__Cr::allocator<base::span<float, 18446744073709551615UL, float *> > > ./../../third_party/libc++/src/include/__memory/allocate_at_least.h:41:19
    #5 0x5a2da2effb92 in __split_buffer ./../../third_party/libc++/src/include/__split_buffer:325:25
    #6 0x5a2da2effb92 in std::__Cr::vector<base::span<float, 18446744073709551615ul, float*>, std::__Cr::allocator<base::span<float, 18446744073709551615ul, float*>>>::reserve(unsigned long) ./../../third_party/libc++/src/include/__vector/vector.h:1110:49
    #7 0x5a2da2efe575 in media::AudioBus::BuildChannelData(int, base::span<float, 18446744073709551615ul, float*>) ./../../media/base/audio_bus.cc:325:17
    #8 0x5a2da2efddf6 in media::AudioBus::AudioBus(int, int) ./../../media/base/audio_bus.cc:84:3
    #9 0x5a2da2f0089e in media::AudioBus::Create(int, int) ./../../media/base/audio_bus.cc:133:31
    #10 0x5a2d8bc9b244 in media::AudioPushFifo::Push(media::AudioBus const&) ./../../media/base/audio_push_fifo.cc:43:20
    #11 0x5a2db1bb09eb in blink::WebAudioMediaStreamSource::ConsumeAudio(WTF::Vector<float const*, 0u, WTF::PartitionAllocator> const&, int) ./../../third_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.cc:78:9
    #12 0x5a2db1bcf4d0 in blink::MediaStreamAudioDestinationHandler::ConsumeAudio(blink::AudioBus*, int) ./../../third_party/blink/renderer/modules/webaudio/media_stream_audio_destination_handler.cc:219:28
    #13 0x5a2db1bced69 in blink::MediaStreamAudioDestinationHandler::Process(unsigned int) ./../../third_party/blink/renderer/modules/webaudio/media_stream_audio_destination_handler.cc:89:3
    #14 0x5a2db1a86696 in blink::AudioHandler::ProcessIfNecessary(unsigned int) ./../../third_party/blink/renderer/modules/webaudio/audio_handler.cc:325:7
    #15 0x5a2db1b788f3 in blink::DeferredTaskHandler::ProcessAutomaticPullNodes(unsigned int) ./../../third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc:198:41
    #16 0x5a2db1c0d370 in blink::RealtimeAudioDestinationHandler::Render(blink::AudioBus*, unsigned int, blink::AudioIOPosition const&, blink::AudioCallbackMetric const&, base::TimeDelta, media::AudioGlitchInfo const&) ./../../third_party/blink/renderer/modules/webaudio/realtime_audio_destination_handler.cc:262:37
    #17 0x5a2db1c1bd0c in blink::AudioDestination::PullFromCallback(blink::AudioBus*, base::TimeDelta) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:672:14
    #18 0x5a2db1c154e0 in blink::AudioDestination::RequestRender(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, base::TimeTicks, bool) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:643:7
    #19 0x5a2db1c148ba in blink::AudioDestination::RequestRenderWait(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, base::TimeTicks) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:559:8
    #20 0x5a2db1c1dcca in Invoke<void (AudioDestination::*)(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, const media::AudioGlitchInfo &, base::TimeTicks), scoped_refptr<blink::AudioDestination>, unsigned int, unsigned int, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo, base::TimeTicks> ./../../base/functional/bind_internal.h:731:12
    #21 0x5a2db1c1dcca in MakeItSo<void (AudioDestination::*)(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, const media::AudioGlitchInfo &, base::TimeTicks), std::__Cr::tuple<scoped_refptr<blink::AudioDestination>, unsigned int, unsigned int, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo, base::TimeTicks> > ./../../base/functional/bind_internal.h:923:12
    #22 0x5a2db1c1dcca in RunImpl<void (AudioDestination::*)(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, const media::AudioGlitchInfo &, base::TimeTicks), std::__Cr::tuple<scoped_refptr<blink::AudioDestination>, unsigned int, unsigned int, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo, base::TimeTicks>, 0UL, 1UL, 2UL, 3UL, 4UL, 5UL, 6UL> ./../../base/functional/bind_internal.h:1060:14
    #23 0x5a2db1c1dcca in base::internal::Invoker<base::internal::FunctorTraits<void (blink::AudioDestination::*&&)(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, base::TimeTicks), scoped_refptr<blink::AudioDestination>&&, unsigned int&&, unsigned int&&, base::TimeDelta&&, base::TimeTicks&&, media::AudioGlitchInfo&&, base::TimeTicks&&>, base::internal::BindState<true, true, false, void (blink::AudioDestination::*)(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, base::TimeTicks), scoped_refptr<blink::AudioDestination>, unsigned int, unsigned int, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo, base::TimeTicks>, void ()>::RunOnce(base::internal::BindStateBase*) ./../../base/functional/bind_internal.h:973:12
    #24 0x5a2d9e3e8da6 in Run ./../../base/functional/callback.h:156:12
    #25 0x5a2d9e3e8da6 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) ./../../base/task/common/task_annotator.cc:209:34
    #26 0x5a2d9e45a768 in RunTask<(lambda at ../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:458:11)> ./../../base/task/common/task_annotator.h:106:5
    #27 0x5a2d9e45a768 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:456:23
    #28 0x5a2d9e45964c in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:330:40
    #29 0x5a2d9e45b49a in non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:0:0
    #30 0x5a2d9e2b4273 in base::MessagePumpDefault::Run(base::MessagePump::Delegate*) ./../../base/message_loop/message_pump_default.cc:42:55
    #31 0x5a2d9e45c04b in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:629:12
    #32 0x5a2d9e36c9af in base::RunLoop::Run(base::Location const&) ./../../base/run_loop.cc:134:14
    #33 0x5a2d99da7576 in blink::scheduler::NonMainThreadImpl::SimpleThreadImpl::Run() ./../../third_party/blink/renderer/platform/scheduler/worker/non_main_thread_impl.cc:187:14
    #34 0x5a2d9e534b49 in base::(anonymous namespace)::ThreadFunc(void*) ./../../base/threading/platform_thread_posix.cc:103:13
    #35 0x5a2d88cf9b86 in asan_thread_start(void*) _asan_rtl_:28

Thread T26 (Semi-Realtime A) created by T0 (chrome) here:
    #0 0x5a2d88ce0381 in ___interceptor_pthread_create _asan_rtl_:3
    #1 0x5a2d9e534138 in base::(anonymous namespace)::CreateThread(unsigned long, bool, base::PlatformThreadBase::Delegate*, base::PlatformThreadHandle*, base::ThreadType, base::MessagePumpType) ./../../base/threading/platform_thread_posix.cc:151:13
    #2 0x5a2d9e4d8f1c in base::SimpleThread::StartAsync() ./../../base/threading/simple_thread.cc:55:13
    #3 0x5a2d99da4f7a in blink::NonMainThread::CreateThread(blink::ThreadCreationParams const&) ./../../third_party/blink/renderer/platform/scheduler/worker/non_main_thread_impl.cc:41:11
    #4 0x5a2dae30a5da in blink::WorkerBackingThread::WorkerBackingThread(blink::ThreadCreationParams const&) ./../../third_party/blink/renderer/core/workers/worker_backing_thread.cc:125:23
    #5 0x5a2db1c40850 in make_unique<blink::WorkerBackingThread, const blink::ThreadCreationParams &, 0> ./../../third_party/libc++/src/include/__memory/unique_ptr.h:754:30
    #6 0x5a2db1c40850 in blink::WorkletThreadHolder<blink::SemiRealtimeAudioWorkletThread>::EnsureInstance(blink::ThreadCreationParams const&) ./../../third_party/blink/renderer/core/workers/worklet_thread_holder.h:36:9
    #7 0x5a2db1c41a77 in EnsureSharedBackingThread ./../../third_party/blink/renderer/modules/webaudio/semi_realtime_audio_worklet_thread.cc:24:3
    #8 0x5a2db1c41a77 in blink::SemiRealtimeAudioWorkletThread::SemiRealtimeAudioWorkletThread(blink::WorkerReportingProxy&) ./../../third_party/blink/renderer/modules/webaudio/semi_realtime_audio_worklet_thread.cc:53:5
    #9 0x5a2db1b02498 in make_unique<blink::SemiRealtimeAudioWorkletThread, blink::WorkerReportingProxy &, 0> ./../../third_party/libc++/src/include/__memory/unique_ptr.h:754:30
    #10 0x5a2db1b02498 in CreateWorkletThreadWithConstraints ./../../third_party/blink/renderer/modules/webaudio/audio_worklet_messaging_proxy.cc:136:10
    #11 0x5a2db1b02498 in blink::AudioWorkletMessagingProxy::CreateWorkerThread() ./../../third_party/blink/renderer/modules/webaudio/audio_worklet_messaging_proxy.cc:117:10
    #12 0x5a2dae301725 in blink::ThreadedMessagingProxyBase::InitializeWorkerThread(std::__Cr::unique_ptr<blink::GlobalScopeCreationParams, std::__Cr::default_delete<blink::GlobalScopeCreationParams>>, std::__Cr::optional<blink::WorkerBackingThreadStartupData> const&, std::__Cr::optional<base::TokenType<blink::DedicatedWorkerTokenTypeMarker> const> const&, std::__Cr::unique_ptr<blink::WorkerDevToolsParams, std::__Cr::default_delete<blink::WorkerDevToolsParams>>) ./../../third_party/blink/renderer/core/workers/threaded_messaging_proxy_base.cc:77:20
    #13 0x5a2db1b085c8 in blink::ThreadedWorkletMessagingProxy::Initialize(blink::WorkerClients*, blink::WorkletModuleResponsesMap*, std::__Cr::optional<blink::WorkerBackingThreadStartupData> const&, mojo::StructPtr<blink::mojom::blink::WorkletGlobalScopeCreationParams>) ./../../third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc:161:3
    #14 0x5a2db1aff34d in blink::AudioWorklet::CreateGlobalScope() ./../../third_party/blink/renderer/modules/webaudio/audio_worklet.cc:81:10
    #15 0x5a2dae34ba0f in blink::Worklet::FetchAndInvokeScript(blink::KURL const&, blink::V8RequestCredentials::Enum, blink::WorkletPendingTasks*) ./../../third_party/blink/renderer/core/workers/worklet.cc:170:24
    #16 0x5a2dae34c9a9 in Invoke<void (Worklet::*)(const blink::KURL &, blink::V8RequestCredentials::Enum, blink::WorkletPendingTasks *), cppgc::internal::BasicPersistent<blink::Worklet, cppgc::internal::StrongPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy>, blink::KURL, blink::V8RequestCredentials::Enum, cppgc::internal::BasicPersistent<blink::WorkletPendingTasks, cppgc::internal::StrongPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy> > ./../../base/functional/bind_internal.h:731:12
    #17 0x5a2dae34c9a9 in MakeItSo<void (Worklet::*)(const blink::KURL &, blink::V8RequestCredentials::Enum, blink::WorkletPendingTasks *), std::__Cr::tuple<cppgc::internal::BasicPersistent<blink::Worklet, cppgc::internal::StrongPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy>, blink::KURL, blink::V8RequestCredentials::Enum, cppgc::internal::BasicPersistent<blink::WorkletPendingTasks, cppgc::internal::StrongPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy> > > ./../../base/functional/bind_internal.h:923:12
    #18 0x5a2dae34c9a9 in RunImpl<void (Worklet::*)(const blink::KURL &, blink::V8RequestCredentials::Enum, blink::WorkletPendingTasks *), std::__Cr::tuple<cppgc::internal::BasicPersistent<blink::Worklet, cppgc::internal::StrongPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy>, blink::KURL, blink::V8RequestCredentials::Enum, cppgc::internal::BasicPersistent<blink::WorkletPendingTasks, cppgc::internal::StrongPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy> >, 0UL, 1UL, 2UL, 3UL> ./../../base/functional/bind_internal.h:1060:14
    #19 0x5a2dae34c9a9 in base::internal::Invoker<base::internal::FunctorTraits<void (blink::Worklet::*&&)(blink::KURL const&, blink::V8RequestCredentials::Enum, blink::WorkletPendingTasks*), cppgc::internal::BasicPersistent<blink::Worklet, cppgc::internal::StrongPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy>&&, blink::KURL&&, blink::V8RequestCredentials::Enum&&, cppgc::internal::BasicPersistent<blink::WorkletPendingTasks, cppgc::internal::StrongPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy>&&>, base::internal::BindState<true, true, false, void (blink::Worklet::*)(blink::KURL const&, blink::V8RequestCredentials::Enum, blink::WorkletPendingTasks*), cppgc::internal::BasicPersistent<blink::Worklet, cppgc::internal::StrongPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy>, blink::KURL, blink::V8RequestCredentials::Enum, cppgc::internal::BasicPersistent<blink::WorkletPendingTasks, cppgc::internal::StrongPersistentPolicy, cppgc::internal::IgnoreLocationPolicy, cppgc::internal::DisabledCheckingPolicy>>, void ()>::RunOnce(base::internal::BindStateBase*) ./../../base/functional/bind_internal.h:973:12
    #20 0x5a2d9e3e8da6 in Run ./../../base/functional/callback.h:156:12
    #21 0x5a2d9e3e8da6 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) ./../../base/task/common/task_annotator.cc:209:34
    #22 0x5a2d9e45a768 in RunTask<(lambda at ../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:458:11)> ./../../base/task/common/task_annotator.h:106:5
    #23 0x5a2d9e45a768 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:456:23
    #24 0x5a2d9e45964c in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:330:40
    #25 0x5a2d9e45b49a in non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:0:0
    #26 0x5a2d9e2b4273 in base::MessagePumpDefault::Run(base::MessagePump::Delegate*) ./../../base/message_loop/message_pump_default.cc:42:55
    #27 0x5a2d9e45c04b in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) ./../../base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:629:12
    #28 0x5a2d9e36c9af in base::RunLoop::Run(base::Location const&) ./../../base/run_loop.cc:134:14
    #29 0x5a2db61dd704 in content::RendererMain(content::MainFunctionParams) ./../../content/renderer/renderer_main.cc:369:16
    #30 0x5a2d9b145945 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:781:14
    #31 0x5a2d9b148345 in content::ContentMainRunnerImpl::Run() ./../../content/app/content_main_runner_impl.cc:1155:10
    #32 0x5a2d9b14290b in content::RunContentProcess(content::ContentMainParams, content::ContentMainRunner*) ./../../content/app/content_main.cc:359:36
    #33 0x5a2d9b142e2b in content::ContentMain(content::ContentMainParams) ./../../content/app/content_main.cc:372:10
    #34 0x5a2d88d3793f in ChromeMain ./../../chrome/app/chrome_main.cc:222:12
    #35 0x740afb82a1c9 in __libc_init_first ??:?
    #36 0x740afb82a28a in __libc_start_main ??:0:0
    #37 0x5a2d88c5c029 in _start ??:0:0

SUMMARY: AddressSanitizer: heap-use-after-free (/mnt/hdd/projects/fuzzframe/gen/browser/chrome/asan-linux-release-1444497/chrome+0x299bd752) (BuildId: 87a681a21b42e59d)
Shadow bytes around the buggy address:
  0x706aed7ea000: fd fd fd fd fa fa f7 fa fd fd fd fd fd fd fd fd
  0x706aed7ea080: fa fa f7 fa fd fd fd fd fd fd fd fd fa fa f7 fa
  0x706aed7ea100: fd fd fd fd fd fd fd fa fa fa f7 fa fd fd fd fd
  0x706aed7ea180: fd fd fd fd fa fa f7 fa 00 00 00 00 00 00 00 00
  0x706aed7ea200: fa fa f7 fa fd fd fd fd fd fd fd fa fa fa f7 fa
=>0x706aed7ea280: fd fd fd fd fd fd fd fd fa fa f7 fa fd fd[fd]fd
  0x706aed7ea300: fd fd fd fd fa fa f7 fa fd fd fd fd fd fd fd fd
  0x706aed7ea380: fa fa f7 fa fd fd fd fd fd fd fd fd fa fa f7 fa
  0x706aed7ea400: fd fd fd fd fd fd fd fa fa fa f7 fa fd fd fd fd
  0x706aed7ea480: fd fd fd fd fa fa f7 fa fd fd fd fd fd fd fd fd
  0x706aed7ea500: fa fa f7 fa fd fd fd fd fd fd fd fd fa fa f7 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

==4065400==ADDITIONAL INFO

==4065400==Note: Please include this section with the ASan report.
Task trace:
    #0 0x5a2db1c12bf6 in blink::AudioDestination::Render(base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, media::AudioBus*) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:176:34

Command line: `/proc/self/exe --type=renderer --crashpad-handler-pid=4063554 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/mnt/hdd/projects/fuzzframe/gen/profiles/axozvv_g --change-stack-guard-on-fork=enable --no-sandbox --autoplay-policy=no-user-gesture-required --enable-experimental-web-platform-features --enable-blink-test-features --file-url-path-alias=/gen=/mnt/hdd/projects/fuzzframe/gen/browser/chrome/asan-linux-release-1444497/gen --no-zygote --remote-debugging-port=0 --use-cmd-decoder=passthrough --use-fake-ui-for-media-stream --enable-gpu-benchmarking --ozone-platform=headless --disable-gpu-compositing --lang=en-US --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=28 --time-ticks-at-unix-epoch=-1744620123386165 --launch-time-ticks=383119095541 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4833047310778064916,10982801936508415139,262144 --enable-features=BlockInsecurePrivateNetworkRequests,BlockInsecurePrivateNetworkRequestsFromPrivate,BlockInsecurePrivateNetworkRequestsFromUnknown,CookieSameSiteConsidersRedirectChain,CreateImageBitmapOrientationNone,CriticalClientHint,DocumentPictureInPictureAPI,DocumentPolicyIncludeJSCallStacksInCrashReports,DocumentPolicyNegotiation,EnableCanvas2DLayers,ExperimentalContentSecurityPolicyFeatures,OriginIsolationHeader,PartitionedPopins,PrivateNetworkAccessRespectPreflightResults,SchemefulSameSite,StorageAccessHeaders,ThirdPartyStoragePartitioning --disable-features=PaintHolding --variations-seed-version --enable-logging --v=0`

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.

==4065400==END OF ADDITIONAL INFO
==4065400==ABORTING

Reporter credit:

Reporter credit: Huang Xilin of Ant Group Light-Year Security Lab

Additional Data

Category: Security
Chrome Channel: Dev
Regression: N/A

The original report as published on the Chromium issue tracker, by Huang Xilin of Ant Group Light-Year Security Lab. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 12 min read.

Context

This report concerns Google Chrome, specifically the WebAudio implementation in Blink. WebAudio lets a page build an audio graph of nodes and render it, and one of the available nodes is the media stream audio destination, which turns the rendered audio into a MediaStream track. Internally that path runs through blink::MediaStreamAudioDestinationHandler, which pulls rendered audio from the graph and hands it to blink::WebAudioMediaStreamSource, which in turn buffers it through media::AudioPushFifo and media::AudioBus.

The report is a crash report for a use-after-free in media::AudioBus. The researcher states plainly that the root cause was not yet known at the time of writing and that the vulnerability is a race condition with a very low probability of being triggered. What the report does provide is the full AddressSanitizer output, which is enough to reason about the lifetime problem.

Setup

The crash was produced on the Dev channel. The report records no regression range (Regression: N/A).

The AddressSanitizer build identifies itself in the summary line as asan-linux-release-1444497, and the crashing process is a renderer. The command line recorded in the report shows the renderer was launched with a set of flags relevant to reproducing audio behaviour, including --autoplay-policy=no-user-gesture-required, --enable-experimental-web-platform-features, --enable-blink-test-features, --use-fake-ui-for-media-stream, --no-sandbox, --no-zygote and --ozone-platform=headless. The full command line is reproduced in the crash state below.

The report does not include a proof of concept. The researcher says they were still trying to reproduce the vulnerability and construct a PoC, and that a more detailed vulnerability analysis would follow.

Finding it

The researcher characterises the bug as a race condition with a very low probability of being triggered, and summarises it as a use-after-free in media::AudioBus. No root cause analysis is offered; the stack backtrace is presented as the material to analyse.

The crash is reported as a tab crash. AddressSanitizer reports a heap-use-after-free:

Text
==4065400==ERROR: AddressSanitizer: heap-use-after-free on address 0x706aed7ea2f0 at pc 0x5a2da2f06753 bp 0x700a511fcc70 sp 0x700a511fcc68
READ of size 8 at 0x706aed7ea2f0 thread T26 (Semi-Realtime A)

The faulting read happens on thread T26, named Semi-Realtime A, which is the semi-realtime audio worklet thread. The freed region is described as follows:

Text
0x706aed7ea2f0 is located 16 bytes inside of 64-byte region [0x706aed7ea2e0,0x706aed7ea320)

Exploitation

The report contains no exploitation steps, no payloads and no reproduction procedure. It states that the researcher was still working on reproducing the vulnerability and building a PoC. What follows is the crash state exactly as recorded, which is the only technical evidence in the report.

Step 1: the read on the semi-realtime thread

The use-after-free read occurs in media::AudioBus::AllChannelsSubspan, reached from CopyPartialFramesTo, then AudioPushFifo::Push, then WebAudioMediaStreamSource::ConsumeAudio. The top of the stack is:

Text
    #0 0x5a2da2f06752 in media::AudioBus::AllChannelsSubspan(unsigned long, unsigned long) const ./../../media/base/audio_bus.cc:406:24
    #1 0x5a2da2f05d1b in media::AudioBus::CopyPartialFramesTo(int, int, int, media::AudioBus*) const ./../../media/base/audio_bus.cc:370:39
    #2 0x5a2d8bc9b388 in media::AudioPushFifo::Push(media::AudioBus const&) ./../../media/base/audio_push_fifo.cc:60:17
    #3 0x5a2db1bb09eb in blink::WebAudioMediaStreamSource::ConsumeAudio(WTF::Vector<float const*, 0u, WTF::PartitionAllocator> const&, int) ./../../third_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.cc:78:9
    #4 0x5a2db1bcf4d0 in blink::MediaStreamAudioDestinationHandler::ConsumeAudio(blink::AudioBus*, int) ./../../third_party/blink/renderer/modules/webaudio/media_stream_audio_destination_handler.cc:219:28
    #5 0x5a2db1bced69 in blink::MediaStreamAudioDestinationHandler::Process(unsigned int) ./../../third_party/blink/renderer/modules/webaudio/media_stream_audio_destination_handler.cc:89:3
    #6 0x5a2db1a86696 in blink::AudioHandler::ProcessIfNecessary(unsigned int) ./../../third_party/blink/renderer/modules/webaudio/audio_handler.cc:325:7
    #7 0x5a2db1b788f3 in blink::DeferredTaskHandler::ProcessAutomaticPullNodes(unsigned int) ./../../third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc:198:41
    #8 0x5a2db1c0d370 in blink::RealtimeAudioDestinationHandler::Render(blink::AudioBus*, unsigned int, blink::AudioIOPosition const&, blink::AudioCallbackMetric const&, base::TimeDelta, media::AudioGlitchInfo const&) ./../../third_party/blink/renderer/modules/webaudio/realtime_audio_destination_handler.cc:262:37
    #9 0x5a2db1c1bd0c in blink::AudioDestination::PullFromCallback(blink::AudioBus*, base::TimeDelta) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:672:14
    #10 0x5a2db1c154e0 in blink::AudioDestination::RequestRender(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, base::TimeTicks, bool) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:643:7
    #11 0x5a2db1c148ba in blink::AudioDestination::RequestRenderWait(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, base::TimeTicks) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:559:8

The rest of the stack below frame #11 is the task runner machinery (base::internal::Invoker, base::TaskAnnotator::RunTaskImpl, ThreadControllerWithMessagePumpImpl, MessagePumpDefault::Run, RunLoop::Run) ending in blink::scheduler::NonMainThreadImpl::SimpleThreadImpl::Run and ThreadFunc. In other words, the audio render callback is being serviced on the semi-realtime thread, and the destination handler is consuming audio into the media stream source when the freed AudioBus is read.

Step 2: the free on the main thread

The region was freed by thread T0 (chrome), the main thread, during garbage collection. The free stack shows the AudioBus being destroyed as part of AudioPushFifo's destruction, which happens when WebAudioMediaStreamSource is destroyed, which happens from MediaStreamSource::Dispose invoked through the cppgc pre-finalizer mechanism during CppHeap::CompactAndSweep:

Text
freed by thread T0 (chrome) here:
    #0 0x5a2d88d3688d in operator delete(void*) _asan_rtl_:3
    #1 0x5a2da2f00726 in ~vector ./../../third_party/libc++/src/include/__vector/vector.h:257:67
    #2 0x5a2da2f00726 in media::AudioBus::~AudioBus() ./../../media/base/audio_bus.cc:130:1
    #3 0x5a2da2f00853 in media::AudioBus::~AudioBus() ./../../media/base/audio_bus.cc:126:23
    #4 0x5a2d8bc9ae30 in operator() ./../../third_party/libc++/src/include/__memory/unique_ptr.h:76:5
    #5 0x5a2d8bc9ae30 in reset ./../../third_party/libc++/src/include/__memory/unique_ptr.h:287:7
    #6 0x5a2d8bc9ae30 in ~unique_ptr ./../../third_party/libc++/src/include/__memory/unique_ptr.h:256:71
    #7 0x5a2d8bc9ae30 in media::AudioPushFifo::~AudioPushFifo() ./../../media/base/audio_push_fifo.cc:19:31
    #8 0x5a2db1bb00ba in ~WebAudioMediaStreamSource ./../../third_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.cc:29:1
    #9 0x5a2db1bb00ba in blink::WebAudioMediaStreamSource::~WebAudioMediaStreamSource() ./../../third_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.cc:27:57
    #10 0x5a2db1bbd0a5 in operator() ./../../third_party/libc++/src/include/__memory/unique_ptr.h:76:5
    #11 0x5a2db1bbd0a5 in reset ./../../third_party/libc++/src/include/__memory/unique_ptr.h:287:7
    #12 0x5a2db1bbd0a5 in Dispose ./../../third_party/blink/renderer/platform/mediastream/media_stream_source.cc:264:20
    #13 0x5a2db1bbd0a5 in blink::MediaStreamSource::InvokePreFinalizer(cppgc::LivenessBroker const&, void*) ./../../third_party/blink/renderer/platform/mediastream/media_stream_source.h:60:3
    #14 0x5a2d9109b6e9 in operator() ./../../v8/src/heap/cppgc/prefinalizer-handler.cc:71:31
    #15 0x5a2d9109b6e9 in remove_if<std::__Cr::reverse_iterator<std::__Cr::__wrap_iter<cppgc::internal::PreFinalizer *> >, (lambda at ../../v8/src/heap/cppgc/prefinalizer-handler.cc:70:22)> ./../../third_party/libc++/src/include/__algorithm/remove_if.h:32:12
    #16 0x5a2d9109b6e9 in cppgc::internal::PreFinalizerHandler::InvokePreFinalizers() ./../../v8/src/heap/cppgc/prefinalizer-handler.cc:68:7
    #17 0x5a2d910688c7 in cppgc::internal::HeapBase::ExecutePreFinalizers() ./../../v8/src/heap/cppgc/heap-base.cc:169:26
    #18 0x5a2d8efb96e6 in v8::internal::CppHeap::CompactAndSweep() ./../../v8/src/heap/cppgc-js/cpp-heap.cc:990:51
    #19 0x5a2d8f0f1f05 in v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) ./../../v8/src/heap/heap.cc:2299:32

The garbage collection was triggered from JavaScript: the stack continues through Heap::CollectGarbage, Heap::HandleExternalMemoryInterrupt, JSArrayBuffer::Setup, Factory::NewJSArrayBuffer, WasmMemoryObject::New, WebAssemblyMemoryImpl and the API call machinery. So the main thread was allocating a WebAssembly memory object, which triggered a GC, which ran the pre-finalizers, which disposed the media stream source and freed the AudioBus.

Step 3: where the freed object was allocated

The allocation stack shows the AudioBus was created inside AudioPushFifo::Push, which calls AudioBus::Create, which constructs an AudioBus and reserves the channel span vector:

Text
previously allocated by thread T26 (Semi-Realtime A) here:
    #0 0x5a2d88d3602d in operator new(unsigned long) _asan_rtl_:3
    #1 0x5a2da2effb92 in __libcpp_operator_new<unsigned long> ./../../third_party/libc++/src/include/__new/allocate.h:37:10
    #2 0x5a2da2effb92 in __libcpp_allocate<base::span<float, 18446744073709551615UL, float *> > ./../../third_party/libc++/src/include/__new/allocate.h:64:28
    #3 0x5a2da2effb92 in allocate ./../../third_party/libc++/src/include/__memory/allocator.h:105:14
    #4 0x5a2da2effb92 in __allocate_at_least<std::__Cr::allocator<base::span<float, 18446744073709551615UL, float *> > > ./../../third_party/libc++/src/include/__memory/allocate_at_least.h:41:19
    #5 0x5a2da2effb92 in __split_buffer ./../../third_party/libc++/src/include/__split_buffer:325:25
    #6 0x5a2da2effb92 in std::__Cr::vector<base::span<float, 18446744073709551615ul, float*>, std::__Cr::allocator<base::span<float, 18446744073709551615ul, float*>>>::reserve(unsigned long) ./../../third_party/libc++/src/include/__vector/vector.h:1110:49
    #7 0x5a2da2efe575 in media::AudioBus::BuildChannelData(int, base::span<float, 18446744073709551615ul, float*>) ./../../media/base/audio_bus.cc:325:17
    #8 0x5a2da2efddf6 in media::AudioBus::AudioBus(int, int) ./../../media/base/audio_bus.cc:84:3
    #9 0x5a2da2f0089e in media::AudioBus::Create(int, int) ./../../media/base/audio_bus.cc:133:31
    #10 0x5a2d8bc9b244 in media::AudioPushFifo::Push(media::AudioBus const&) ./../../media/base/audio_push_fifo.cc:43:20
    #11 0x5a2db1bb09eb in blink::WebAudioMediaStreamSource::ConsumeAudio(WTF::Vector<float const*, 0u, WTF::PartitionAllocator> const&, int) ./../../third_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.cc:78:9

The allocation and the read both happen on thread T26, in the same ConsumeAudio path. The free happens on the main thread.

Step 4: how the semi-realtime thread was created

The thread that crashed was created by the main thread as a semi-realtime audio worklet thread, through SemiRealtimeAudioWorkletThread and WorkletThreadHolder, from AudioWorkletMessagingProxy::CreateWorkerThread during AudioWorklet::CreateGlobalScope:

Text
Thread T26 (Semi-Realtime A) created by T0 (chrome) here:
    #0 0x5a2d88ce0381 in ___interceptor_pthread_create _asan_rtl_:3
    #1 0x5a2d9e534138 in base::(anonymous namespace)::CreateThread(unsigned long, bool, base::PlatformThreadBase::Delegate*, base::PlatformThreadHandle*, base::ThreadType, base::MessagePumpType) ./../../base/threading/platform_thread_posix.cc:151:13
    #2 0x5a2d9e4d8f1c in base::SimpleThread::StartAsync() ./../../base/threading/simple_thread.cc:55:13
    #3 0x5a2d99da4f7a in blink::NonMainThread::CreateThread(blink::ThreadCreationParams const&) ./../../third_party/blink/renderer/platform/scheduler/worker/non_main_thread_impl.cc:41:11
    #4 0x5a2dae30a5da in blink::WorkerBackingThread::WorkerBackingThread(blink::ThreadCreationParams const&) ./../../third_party/blink/renderer/core/workers/worker_backing_thread.cc:125:23
    #5 0x5a2db1c40850 in make_unique<blink::WorkerBackingThread, const blink::ThreadCreationParams &, 0> ./../../third_party/libc++/src/include/__memory/unique_ptr.h:754:30
    #6 0x5a2db1c40850 in blink::WorkletThreadHolder<blink::SemiRealtimeAudioWorkletThread>::EnsureInstance(blink::ThreadCreationParams const&) ./../../third_party/blink/renderer/core/workers/worklet_thread_holder.h:36:9
    #7 0x5a2db1c41a77 in EnsureSharedBackingThread ./../../third_party/blink/renderer/modules/webaudio/semi_realtime_audio_worklet_thread.cc:24:3
    #8 0x5a2db1c41a77 in blink::SemiRealtimeAudioWorkletThread::SemiRealtimeAudioWorkletThread(blink::WorkerReportingProxy&) ./../../third_party/blink/renderer/modules/webaudio/semi_realtime_audio_worklet_thread.cc:53:5

This confirms the two threads involved: the main thread, which runs GC and disposes the media stream source, and the semi-realtime audio worklet thread, which renders audio and reads the AudioBus.

Step 5: the task trace and the build details

The report includes the ASan additional info section, which records the task that was running when the crash occurred:

Text
Task trace:
    #0 0x5a2db1c12bf6 in blink::AudioDestination::Render(base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, media::AudioBus*) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:176:34

The command line of the crashing renderer is recorded in full:

Text
Command line: `/proc/self/exe --type=renderer --crashpad-handler-pid=4063554 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/mnt/hdd/projects/fuzzframe/gen/profiles/axozvv_g --change-stack-guard-on-fork=enable --no-sandbox --autoplay-policy=no-user-gesture-required --enable-experimental-web-platform-features --enable-blink-test-features --file-url-path-alias=/gen=/mnt/hdd/projects/fuzzframe/gen/browser/chrome/asan-linux-release-1444497/gen --no-zygote --remote-debugging-port=0 --use-cmd-decoder=passthrough --use-fake-ui-for-media-stream --enable-gpu-benchmarking --ozone-platform=headless --disable-gpu-compositing --lang=en-US --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=28 --time-ticks-at-unix-epoch=-1744620123386165 --launch-time-ticks=383119095541 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4833047310778064916,10982801936508415139,262144 --enable-features=BlockInsecurePrivateNetworkRequests,BlockInsecurePrivateNetworkRequestsFromPrivate,BlockInsecurePrivateNetworkRequestsFromUnknown,CookieSameSiteConsidersRedirectChain,CreateImageBitmapOrientationNone,CriticalClientHint,DocumentPictureInPictureAPI,DocumentPolicyIncludeJSCallStacksInCrashReports,DocumentPolicyNegotiation,EnableCanvas2DLayers,ExperimentalContentSecurityPolicyFeatures,OriginIsolationHeader,PartitionedPopins,PrivateNetworkAccessRespectPreflightResults,SchemefulSameSite,StorageAccessHeaders,ThirdPartyStoragePartitioning --disable-features=PaintHolding --variations-seed-version --enable-logging --v=0`

The MiraclePtr status is also recorded, and it matters for exploitability:

Text
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.

The summary line and the shadow bytes around the faulting address are included as well:

Text
SUMMARY: AddressSanitizer: heap-use-after-free (/mnt/hdd/projects/fuzzframe/gen/browser/chrome/asan-linux-release-1444497/chrome+0x299bd752) (BuildId: 87a681a21b42e59d)
Shadow bytes around the buggy address:
  0x706aed7ea000: fd fd fd fd fa fa f7 fa fd fd fd fd fd fd fd fd
  0x706aed7ea080: fa fa f7 fa fd fd fd fd fd fd fd fd fa fa f7 fa
  0x706aed7ea100: fd fd fd fd fd fd fd fa fa fa f7 fa fd fd fd fd
  0x706aed7ea180: fd fd fd fd fa fa f7 fa 00 00 00 00 00 00 00 00
  0x706aed7ea200: fa fa f7 fa fd fd fd fd fd fd fd fa fa fa f7 fa
=>0x706aed7ea280: fd fd fd fd fd fd fd fd fa fa f7 fa fd fd[fd]fd
  0x706aed7ea300: fd fd fd fd fa fa f7 fa fd fd fd fd fd fd fd fd
  0x706aed7ea380: fa fa f7 fa fd fd fd fd fd fd fd fd fa fa f7 fa
  0x706aed7ea400: fd fd fd fd fd fd fd fa fa fa f7 fa fd fd fd fd
  0x706aed7ea480: fd fd fd fd fa fa f7 fa fd fd fd fd fd fd fd fd
  0x706aed7ea500: fa fa f7 fa fd fd fd fd fd fd fd fd fa fa f7 fa

The shadow byte legend in the report explains that fd marks a freed heap region and fa a heap left redzone, which is consistent with the faulting address sitting inside a freed allocation.

Root cause

The report does not state a root cause; the researcher explicitly says it was not yet known. What the traces show is a lifetime race between two threads. On the semi-realtime audio worklet thread, WebAudioMediaStreamSource::ConsumeAudio pushes audio into AudioPushFifo, which allocates an AudioBus and then reads from it in the same call path. On the main thread, a garbage collection triggered by a WebAssembly memory allocation runs cppgc pre-finalizers, which dispose the MediaStreamSource and destroy the WebAudioMediaStreamSource and its AudioPushFifo, freeing the AudioBus while the audio thread is still using it.

The report does not identify the root cause or which synchronisation is missing. The report does not identify which reference or which synchronisation is missing.

MiraclePtr did not help here: the report records NOT PROTECTED and states that no raw_ptr<T> access to the region was detected prior to the crash, and that the crash is still exploitable with MiraclePtr.

Impact

The report classifies the issue as a use-after-free in media::AudioBus and records it as a tab crash. The researcher describes it as a race condition with a very low probability of being triggered. No exploitation beyond the crash is demonstrated, and the report does not describe what an attacker could achieve with control of the freed memory.

Fix

Variants to test

These follow from the shape of the bug rather than from anything the report demonstrates:

  1. Other WebAudio nodes that hand buffers to a second thread. A positive result is an ASan heap-use-after-free where the free stack runs through a cppgc pre-finalizer or GC on the main thread and the read stack runs on a worker or audio thread.
  2. Media stream sources disposed during GC while audio is rendering. A positive result is the same split between a main-thread Dispose and an audio-thread ConsumeAudio.
  3. Forcing garbage collection from JavaScript during audio rendering, for example through large WebAssembly memory allocations as in this trace. A positive result is a crash whose free stack includes HandleExternalMemoryInterrupt and CppHeap::CompactAndSweep.
  4. Any object protected only by a pre-finalizer rather than by reference counting across threads. A positive result is a MiraclePtr Status: NOT PROTECTED line in the ASan report alongside a use-after-free.

Hunting notes

This kind of bug tends to sit where an object owned by the main thread is also read by a real-time or semi-realtime thread, and where teardown is driven by garbage collection rather than by explicit synchronisation. The signals worth watching in a crash report are a free stack that runs through cppgc pre-finalizers or Dispose, a read stack on a thread named for audio or real-time work, and a MiraclePtr Status: NOT PROTECTED line. The report itself shows how the researcher presented the case: a complete ASan report with the read, free, allocation and thread-creation stacks, the task trace and the renderer command line, plus an honest statement that the root cause and PoC were still pending.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 26 min read.

What happened, in plain words

A security researcher found a way to make Google Chrome crash in a way that security people call a use-after-free. The crash happens inside the part of Chrome that handles audio on web pages. The researcher reported it as a crash report. The report was filed as a crash report: it contains the full output of a debugging tool called AddressSanitizer, but at the time of writing the researcher did not yet know the underlying cause and did not yet have a reliable way to make the crash happen on demand.

To understand the rest of this article you only need a few ideas, explained as we go. The most important one is the use-after-free itself. Imagine you borrow a library book, write down its shelf position, return the book, and then later walk back to that shelf and try to read it. The book may be gone, or something else may be sitting there now. A program that frees a chunk of memory and then keeps using it has exactly this problem. If an attacker can control what gets placed in that freed memory, they may be able to influence what the program reads or does next.

The second important idea is a race condition. Two parts of a program run at the same time, like two people editing the same shared document without telling each other. If one of them deletes a paragraph while the other is still reading it, the result depends on who is faster. Race conditions are hard to reproduce because the timing has to line up, and this report says the probability of triggering this one is very low.

Context

This report concerns Google Chrome, and specifically a feature called WebAudio. WebAudio is a browser API. An API is a defined set of tools a web page can call to ask the browser to do something, in this case to create and process sound. With WebAudio, a page builds an audio graph: a network of nodes, where each node does something to audio, such as generating a tone, applying an effect, or sending the result somewhere. The browser then renders that graph, meaning it computes the actual audio samples many times per second.

One of the available nodes is the media stream audio destination. A MediaStream is the browser's representation of a live audio or video stream, the same kind of object a webcam or microphone produces. This particular node takes the audio being rendered in the graph and turns it into a MediaStream track, so the page can send it elsewhere, for example into a video call or a recording.

Internally, that path runs through a class called blink::MediaStreamAudioDestinationHandler. Blink is Chrome's rendering engine, the part that turns HTML, CSS and JavaScript into what you see and hear. A class is a blueprint in code that bundles data together with the functions that operate on it. This handler pulls rendered audio from the graph and hands it to blink::WebAudioMediaStreamSource, which buffers it through media::AudioPushFifo and media::AudioBus. A FIFO is a first-in-first-out queue, like a line at a counter: audio goes in at one end and comes out at the other in the same order. An AudioBus is a container for a block of audio samples, the numeric values that represent sound.

The report is a crash report for a use-after-free in media::AudioBus. The researcher states plainly that the root cause was not yet known at the time of writing and that the vulnerability is a race condition with a very low probability of being triggered. What the report does provide is the full AddressSanitizer output, which is enough to reason about the lifetime problem. AddressSanitizer, often shortened to ASan, is a tool built into special debug versions of programs that watches memory use and shouts loudly when a program touches memory it should not.

Setup

The crash was produced on the Dev channel. Chrome ships several channels: Stable is the normal release, Beta is the next one being tested, and Dev is an early build where new code lands first. Bugs found on Dev may not exist in the version most people use. The report records no regression range (Regression: N/A). A regression range is the span of code changes between a version where something worked and a version where it broke, which helps developers find the change that introduced a bug. Here there is none.

The AddressSanitizer build identifies itself in the summary line as asan-linux-release-1444497, and the crashing process is a renderer. Chrome splits its work across processes: the browser process manages windows and tabs, and each tab's page content runs in a renderer process. A crash in a renderer usually takes down just that tab, which is why the report calls this a tab crash. The command line recorded in the report shows the renderer was launched with a set of flags relevant to reproducing audio behaviour, including --autoplay-policy=no-user-gesture-required, --enable-experimental-web-platform-features, --enable-blink-test-features, --use-fake-ui-for-media-stream, --no-sandbox, --no-zygote and --ozone-platform=headless. A command-line flag is an option passed to a program when it starts, like a setting on a washing machine before you press go. The full command line is reproduced in the crash state below.

The report does not include a proof of concept. A proof of concept, or PoC, is a small, reliable recipe, often a snippet of HTML or JavaScript, that demonstrates the bug. The researcher says they were still trying to reproduce the vulnerability and construct a PoC, and that a more detailed vulnerability analysis would follow.

Finding it

The researcher characterises the bug as a race condition with a very low probability of being triggered, and summarises it as a use-after-free in media::AudioBus. No root cause analysis is offered; the stack backtrace is presented as the material to analyse. A stack backtrace, or stack trace, is the list of function calls that led to a particular point in a program, like the list of stations a train passed through before arriving. Reading it from top to bottom tells you what was happening at the moment of the crash and who called whom.

The crash is reported as a tab crash. AddressSanitizer reports a heap-use-after-free:

Text
==4065400==ERROR: AddressSanitizer: heap-use-after-free on address 0x706aed7ea2f0 at pc 0x5a2da2f06753 bp 0x700a511fcc70 sp 0x700a511fcc68
READ of size 8 at 0x706aed7ea2f0 thread T26 (Semi-Realtime A)

Line by line, in plain words:

  • The first line is ASan announcing the problem. heap-use-after-free is the bug class. The heap is the pool of memory a program uses for objects it creates while running, as opposed to the stack, which is short-lived scratch space for function calls. The address 0x706aed7ea2f0 is the memory location involved, written in hexadecimal, a base-16 number system programmers use for memory addresses. pc, bp and sp are the program counter, base pointer and stack pointer, three registers that record where the processor was and how its call stack was laid out. You do not need to read them to follow the story.
  • The second line says the program performed a READ of 8 bytes at that address, on a thread named T26 (Semi-Realtime A). A thread is one sequence of instructions running inside a process; a process can have many threads running at once, like several cooks in one kitchen. This thread's name tells us it is the semi-realtime audio worklet thread, which is the thread Chrome uses to process audio that does not have to meet the strictest real-time deadline. Worklet is the name for a small piece of JavaScript that runs on such a background thread.

The faulting read happens on thread T26, named Semi-Realtime A, which is the semi-realtime audio worklet thread. The freed region is described as follows:

Text
0x706aed7ea2f0 is located 16 bytes inside of 64-byte region [0x706aed7ea2e0,0x706aed7ea320)

This line says the address being read sits 16 bytes into a block of 64 bytes that started at 0x706aed7ea2e0 and ended just before 0x706aed7ea320. In other words, the program was reading from the middle of a small allocation that had already been handed back to the memory manager. The square bracket at the start and the round bracket at the end are a common way of writing a range that includes its start but not its end.

Exploitation

The report contains no exploitation steps, no payloads and no reproduction procedure. A payload here would be the specific input, such as a web page, that triggers the bug. It states that the researcher was still working on reproducing the vulnerability and building a PoC. What follows is the crash state exactly as recorded, which is the only technical evidence in the report.

Step 1: the read on the semi-realtime thread

The use-after-free read occurs in media::AudioBus::AllChannelsSubspan, reached from CopyPartialFramesTo, then AudioPushFifo::Push, then WebAudioMediaStreamSource::ConsumeAudio. The top of the stack is:

Text
    #0 0x5a2da2f06752 in media::AudioBus::AllChannelsSubspan(unsigned long, unsigned long) const ./../../media/base/audio_bus.cc:406:24
    #1 0x5a2da2f05d1b in media::AudioBus::CopyPartialFramesTo(int, int, int, media::AudioBus*) const ./../../media/base/audio_bus.cc:370:39
    #2 0x5a2d8bc9b388 in media::AudioPushFifo::Push(media::AudioBus const&) ./../../media/base/audio_push_fifo.cc:60:17
    #3 0x5a2db1bb09eb in blink::WebAudioMediaStreamSource::ConsumeAudio(WTF::Vector<float const*, 0u, WTF::PartitionAllocator> const&, int) ./../../third_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.cc:78:9
    #4 0x5a2db1bcf4d0 in blink::MediaStreamAudioDestinationHandler::ConsumeAudio(blink::AudioBus*, int) ./../../third_party/blink/renderer/modules/webaudio/media_stream_audio_destination_handler.cc:219:28
    #5 0x5a2db1bced69 in blink::MediaStreamAudioDestinationHandler::Process(unsigned int) ./../../third_party/blink/renderer/modules/webaudio/media_stream_audio_destination_handler.cc:89:3
    #6 0x5a2db1a86696 in blink::AudioHandler::ProcessIfNecessary(unsigned int) ./../../third_party/blink/renderer/modules/webaudio/audio_handler.cc:325:7
    #7 0x5a2db1b788f3 in blink::DeferredTaskHandler::ProcessAutomaticPullNodes(unsigned int) ./../../third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc:198:41
    #8 0x5a2db1c0d370 in blink::RealtimeAudioDestinationHandler::Render(blink::AudioBus*, unsigned int, blink::AudioIOPosition const&, blink::AudioCallbackMetric const&, base::TimeDelta, media::AudioGlitchInfo const&) ./../../third_party/blink/renderer/modules/webaudio/realtime_audio_destination_handler.cc:262:37
    #9 0x5a2db1c1bd0c in blink::AudioDestination::PullFromCallback(blink::AudioBus*, base::TimeDelta) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:672:14
    #10 0x5a2db1c154e0 in blink::AudioDestination::RequestRender(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, base::TimeTicks, bool) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:643:7
    #11 0x5a2db1c148ba in blink::AudioDestination::RequestRenderWait(unsigned long, unsigned long, base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, base::TimeTicks) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:559:8

Each line is one frame of the stack. The number after the # is the frame's position, with #0 being the innermost call, the place where the crash actually happened. The long hexadecimal number is the memory address of the code in that frame. After in comes the function name, including the class it belongs to, separated by ::. The path at the end, such as ./../../media/base/audio_bus.cc:406:24, is the source file and the line and column number where that function's code lives.

Read from the top down, the story is: AllChannelsSubspan was reading channel data from an AudioBus; it was called by CopyPartialFramesTo, which copies part of one audio buffer into another; that was called by AudioPushFifo::Push, which is adding audio to the queue; that was called by WebAudioMediaStreamSource::ConsumeAudio, which is feeding audio into the media stream source; that was called by MediaStreamAudioDestinationHandler::ConsumeAudio, which is the destination node taking audio from the graph; and so on down through the audio rendering machinery. In short, the audio rendering callback was running and the destination handler was consuming audio into the media stream source when the freed AudioBus was read.

The rest of the stack below frame #11 is the task runner machinery (base::internal::Invoker, base::TaskAnnotator::RunTaskImpl, ThreadControllerWithMessagePumpImpl, MessagePumpDefault::Run, RunLoop::Run) ending in blink::scheduler::NonMainThreadImpl::SimpleThreadImpl::Run and ThreadFunc. Task runner machinery is the plumbing that schedules work and runs it on a thread; you can think of it as the conveyor belt that delivers jobs to the worker. In other words, the audio render callback is being serviced on the semi-realtime thread, and the destination handler is consuming audio into the media stream source when the freed AudioBus is read.

Step 2: the free on the main thread

The region was freed by thread T0 (chrome), the main thread, during garbage collection. The main thread is the thread that runs the page's ordinary JavaScript and most of the browser's bookkeeping. Garbage collection is the automatic process by which a program finds memory it no longer needs and reclaims it, like a cleaner clearing tables nobody is sitting at. The free stack shows the AudioBus being destroyed as part of AudioPushFifo's destruction, which happens when WebAudioMediaStreamSource is destroyed, which happens from MediaStreamSource::Dispose invoked through the cppgc pre-finalizer mechanism during CppHeap::CompactAndSweep:

Text
freed by thread T0 (chrome) here:
    #0 0x5a2d88d3688d in operator delete(void*) _asan_rtl_:3
    #1 0x5a2da2f00726 in ~vector ./../../third_party/libc++/src/include/__vector/vector.h:257:67
    #2 0x5a2da2f00726 in media::AudioBus::~AudioBus() ./../../media/base/audio_bus.cc:130:1
    #3 0x5a2da2f00853 in media::AudioBus::~AudioBus() ./../../media/base/audio_bus.cc:126:23
    #4 0x5a2d8bc9ae30 in operator() ./../../third_party/libc++/src/include/__memory/unique_ptr.h:76:5
    #5 0x5a2d8bc9ae30 in reset ./../../third_party/libc++/src/include/__memory/unique_ptr.h:287:7
    #6 0x5a2d8bc9ae30 in ~unique_ptr ./../../third_party/libc++/src/include/__memory/unique_ptr.h:256:71
    #7 0x5a2d8bc9ae30 in media::AudioPushFifo::~AudioPushFifo() ./../../media/base/audio_push_fifo.cc:19:31
    #8 0x5a2db1bb00ba in ~WebAudioMediaStreamSource ./../../third_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.cc:29:1
    #9 0x5a2db1bb00ba in blink::WebAudioMediaStreamSource::~WebAudioMediaStreamSource() ./../../third_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.cc:27:57
    #10 0x5a2db1bbd0a5 in operator() ./../../third_party/libc++/src/include/__memory/unique_ptr.h:76:5
    #11 0x5a2db1bbd0a5 in reset ./../../third_party/libc++/src/include/__memory/unique_ptr.h:287:7
    #12 0x5a2db1bbd0a5 in Dispose ./../../third_party/blink/renderer/platform/mediastream/media_stream_source.cc:264:20
    #13 0x5a2db1bbd0a5 in blink::MediaStreamSource::InvokePreFinalizer(cppgc::LivenessBroker const&, void*) ./../../third_party/blink/renderer/platform/mediastream/media_stream_source.h:60:3
    #14 0x5a2d9109b6e9 in operator() ./../../v8/src/heap/cppgc/prefinalizer-handler.cc:71:31
    #15 0x5a2d9109b6e9 in remove_if<std::__Cr::reverse_iterator<std::__Cr::__wrap_iter<cppgc::internal::PreFinalizer *> >, (lambda at ../../v8/src/heap/cppgc/prefinalizer-handler.cc:70:22)> ./../../third_party/libc++/src/include/__algorithm/remove_if.h:32:12
    #16 0x5a2d9109b6e9 in cppgc::internal::PreFinalizerHandler::InvokePreFinalizers() ./../../v8/src/heap/cppgc/prefinalizer-handler.cc:68:7
    #17 0x5a2d910688c7 in cppgc::internal::HeapBase::ExecutePreFinalizers() ./../../v8/src/heap/cppgc/heap-base.cc:169:26
    #18 0x5a2d8efb96e6 in v8::internal::CppHeap::CompactAndSweep() ./../../v8/src/heap/cppgc-js/cpp-heap.cc:990:51
    #19 0x5a2d8f0f1f05 in v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) ./../../v8/src/heap/heap.cc:2299:32

Again, read from the top down. operator delete is the low-level operation that returns memory to the system. Above it, the destructors run: a destructor is the function that runs when an object is being cleaned up, and its name starts with a tilde, as in ~AudioBus. The ~vector frame is the destruction of a list-like container inside the AudioBus. Then ~AudioBus runs, then a unique_ptr is reset. A unique_ptr is a smart pointer, a small wrapper that owns an object and automatically deletes it when the wrapper itself goes away, so nobody has to remember to do it by hand. Resetting it destroys what it owns. That leads into ~AudioPushFifo, then ~WebAudioMediaStreamSource, then Dispose on the media stream source, then InvokePreFinalizer.

A pre-finalizer is a hook that runs just before the garbage collector finalises an object, giving the object a chance to release resources that live outside the garbage-collected heap. cppgc is Chrome's garbage collector for C++ objects that can be referenced from JavaScript. CompactAndSweep is a phase of garbage collection that tidies up memory and reclaims what is unused. So the chain is: garbage collection ran, it invoked pre-finalizers, one of them disposed the media stream source, that destroyed the WebAudio media stream source and its FIFO, and the FIFO's destruction freed the AudioBus.

The garbage collection was triggered from JavaScript: the stack continues through Heap::CollectGarbage, Heap::HandleExternalMemoryInterrupt, JSArrayBuffer::Setup, Factory::NewJSArrayBuffer, WasmMemoryObject::New, WebAssemblyMemoryImpl and the API call machinery. WebAssembly, or Wasm, is a fast, low-level format that lets web pages run compiled code in the browser. A JSArrayBuffer is a JavaScript object representing a raw block of memory. So the main thread was allocating a WebAssembly memory object, which triggered a GC, which ran the pre-finalizers, which disposed the media stream source and freed the AudioBus.

Step 3: where the freed object was allocated

The allocation stack shows the AudioBus was created inside AudioPushFifo::Push, which calls AudioBus::Create, which constructs an AudioBus and reserves the channel span vector:

Text
previously allocated by thread T26 (Semi-Realtime A) here:
    #0 0x5a2d88d3602d in operator new(unsigned long) _asan_rtl_:3
    #1 0x5a2da2effb92 in __libcpp_operator_new<unsigned long> ./../../third_party/libc++/src/include/__new/allocate.h:37:10
    #2 0x5a2da2effb92 in __libcpp_allocate<base::span<float, 18446744073709551615UL, float *> > ./../../third_party/libc++/src/include/__new/allocate.h:64:28
    #3 0x5a2da2effb92 in allocate ./../../third_party/libc++/src/include/__memory/allocator.h:105:14
    #4 0x5a2da2effb92 in __allocate_at_least<std::__Cr::allocator<base::span<float, 18446744073709551615UL, float *> > > ./../../third_party/libc++/src/include/__memory/allocate_at_least.h:41:19
    #5 0x5a2da2effb92 in __split_buffer ./../../third_party/libc++/src/include/__split_buffer:325:25
    #6 0x5a2da2effb92 in std::__Cr::vector<base::span<float, 18446744073709551615ul, float*>, std::__Cr::allocator<base::span<float, 18446744073709551615ul, float*>>>::reserve(unsigned long) ./../../third_party/libc++/src/include/__vector/vector.h:1110:49
    #7 0x5a2da2efe575 in media::AudioBus::BuildChannelData(int, base::span<float, 18446744073709551615ul, float*>) ./../../media/base/audio_bus.cc:325:17
    #8 0x5a2da2efddf6 in media::AudioBus::AudioBus(int, int) ./../../media/base/audio_bus.cc:84:3
    #9 0x5a2da2f0089e in media::AudioBus::Create(int, int) ./../../media/base/audio_bus.cc:133:31
    #10 0x5a2d8bc9b244 in media::AudioPushFifo::Push(media::AudioBus const&) ./../../media/base/audio_push_fifo.cc:43:20
    #11 0x5a2db1bb09eb in blink::WebAudioMediaStreamSource::ConsumeAudio(WTF::Vector<float const*, 0u, WTF::PartitionAllocator> const&, int) ./../../third_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.cc:78:9

This is the third stack in the report, and it answers a different question: not where the crash happened or where the memory was freed, but where the memory was first created. operator new is the low-level operation that asks the system for memory. The frames above it are the standard library's allocation helpers, then a vector::reserve call. A vector is a growable list; reserve asks it to make room for a certain number of items up front. Then BuildChannelData fills in the per-channel pointers, the AudioBus constructor runs, AudioBus::Create is the factory function that makes one, and AudioPushFifo::Push is the caller. A factory function is simply a function whose job is to create and return a new object.

The allocation and the read both happen on thread T26, in the same ConsumeAudio path. The free happens on the main thread. That split is the heart of the bug: one thread creates and uses the object, another thread destroys it.

Step 4: how the semi-realtime thread was created

The thread that crashed was created by the main thread as a semi-realtime audio worklet thread, through SemiRealtimeAudioWorkletThread and WorkletThreadHolder, from AudioWorkletMessagingProxy::CreateWorkerThread during AudioWorklet::CreateGlobalScope:

Text
Thread T26 (Semi-Realtime A) created by T0 (chrome) here:
    #0 0x5a2d88ce0381 in ___interceptor_pthread_create _asan_rtl_:3
    #1 0x5a2d9e534138 in base::(anonymous namespace)::CreateThread(unsigned long, bool, base::PlatformThreadBase::Delegate*, base::PlatformThreadHandle*, base::ThreadType, base::MessagePumpType) ./../../base/threading/platform_thread_posix.cc:151:13
    #2 0x5a2d9e4d8f1c in base::SimpleThread::StartAsync() ./../../base/threading/simple_thread.cc:55:13
    #3 0x5a2d99da4f7a in blink::NonMainThread::CreateThread(blink::ThreadCreationParams const&) ./../../third_party/blink/renderer/platform/scheduler/worker/non_main_thread_impl.cc:41:11
    #4 0x5a2dae30a5da in blink::WorkerBackingThread::WorkerBackingThread(blink::ThreadCreationParams const&) ./../../third_party/blink/renderer/core/workers/worker_backing_thread.cc:125:23
    #5 0x5a2db1c40850 in make_unique<blink::WorkerBackingThread, const blink::ThreadCreationParams &, 0> ./../../third_party/libc++/src/include/__memory/unique_ptr.h:754:30
    #6 0x5a2db1c40850 in blink::WorkletThreadHolder<blink::SemiRealtimeAudioWorkletThread>::EnsureInstance(blink::ThreadCreationParams const&) ./../../third_party/blink/renderer/core/workers/worklet_thread_holder.h:36:9
    #7 0x5a2db1c41a77 in EnsureSharedBackingThread ./../../third_party/blink/renderer/modules/webaudio/semi_realtime_audio_worklet_thread.cc:24:3
    #8 0x5a2db1c41a77 in blink::SemiRealtimeAudioWorkletThread::SemiRealtimeAudioWorkletThread(blink::WorkerReportingProxy&) ./../../third_party/blink/renderer/modules/webaudio/semi_realtime_audio_worklet_thread.cc:53:5

This fourth stack records the moment the audio thread was born. pthread_create is the operating system call that starts a new thread. The frames above it are Chrome's wrappers around that call, then the worker backing thread, then the worklet thread holder, which keeps a shared instance of the thread around, then the semi-realtime audio worklet thread constructor. A constructor is the function that runs when an object is created, the opposite of a destructor.

This confirms the two threads involved: the main thread, which runs GC and disposes the media stream source, and the semi-realtime audio worklet thread, which renders audio and reads the AudioBus.

Step 5: the task trace and the build details

The report includes the ASan additional info section, which records the task that was running when the crash occurred:

Text
Task trace:
    #0 0x5a2db1c12bf6 in blink::AudioDestination::Render(base::TimeDelta, base::TimeTicks, media::AudioGlitchInfo const&, media::AudioBus*) ./../../third_party/blink/renderer/platform/audio/audio_destination.cc:176:34

A task trace is a short record of the job that was in progress. Here it is a single frame: AudioDestination::Render, the function that produces a block of audio. This tells us the crash happened while the audio destination was rendering, which matches the read stack in step 1.

The command line of the crashing renderer is recorded in full:

Text
Command line: `/proc/self/exe --type=renderer --crashpad-handler-pid=4063554 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/mnt/hdd/projects/fuzzframe/gen/profiles/axozvv_g --change-stack-guard-on-fork=enable --no-sandbox --autoplay-policy=no-user-gesture-required --enable-experimental-web-platform-features --enable-blink-test-features --file-url-path-alias=/gen=/mnt/hdd/projects/fuzzframe/gen/browser/chrome/asan-linux-release-1444497/gen --no-zygote --remote-debugging-port=0 --use-cmd-decoder=passthrough --use-fake-ui-for-media-stream --enable-gpu-benchmarking --ozone-platform=headless --disable-gpu-compositing --lang=en-US --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=28 --time-ticks-at-unix-epoch=-1744620123386165 --launch-time-ticks=383119095541 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4833047310778064916,10982801936508415139,262144 --enable-features=BlockInsecurePrivateNetworkRequests,BlockInsecurePrivateNetworkRequestsFromPrivate,BlockInsecurePrivateNetworkRequestsFromUnknown,CookieSameSiteConsidersRedirectChain,CreateImageBitmapOrientationNone,CriticalClientHint,DocumentPictureInPictureAPI,DocumentPolicyIncludeJSCallStacksInCrashReports,DocumentPolicyNegotiation,EnableCanvas2DLayers,ExperimentalContentSecurityPolicyFeatures,OriginIsolationHeader,PartitionedPopins,PrivateNetworkAccessRespectPreflightResults,SchemefulSameSite,StorageAccessHeaders,ThirdPartyStoragePartitioning --disable-features=PaintHolding --variations-seed-version --enable-logging --v=0`

This is the exact list of options the renderer process was started with. /proc/self/exe is the path to the running program itself on Linux. --type=renderer says this process is a renderer. --user-data-dir points at the profile folder, which holds settings and data for this browser instance. --autoplay-policy=no-user-gesture-required lets audio start without the user clicking anything, which matters for triggering audio code automatically. --use-fake-ui-for-media-stream makes the browser answer media permission prompts automatically, useful for automated testing. --no-sandbox and --no-zygote disable Chrome's process isolation features, which is common in test setups. --ozone-platform=headless runs without a visible display. --enable-features and --disable-features switch experimental browser features on and off. The rest are assorted tuning and debugging options. You do not need to memorise them; the point is that this was an automated, instrumented test environment, not an ordinary user's browser.

The MiraclePtr status is also recorded, and it matters for exploitability:

Text
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 use-after-free bugs harder to exploit by making freed pointers unusable, roughly like invalidating a key card the moment an employee leaves. NOT PROTECTED means this particular memory was not covered by that defence. raw_ptr<T> is the smart pointer type MiraclePtr relies on; the report says no such access to this region was detected before the crash. The conclusion, stated in the report, is that the crash is still exploitable with MiraclePtr in place.

The summary line and the shadow bytes around the faulting address are included as well:

Text
SUMMARY: AddressSanitizer: heap-use-after-free (/mnt/hdd/projects/fuzzframe/gen/browser/chrome/asan-linux-release-1444497/chrome+0x299bd752) (BuildId: 87a681a21b42e59d)
Shadow bytes around the buggy address:
  0x706aed7ea000: fd fd fd fd fa fa f7 fa fd fd fd fd fd fd fd fd
  0x706aed7ea080: fa fa f7 fa fd fd fd fd fd fd fd fd fa fa f7 fa
  0x706aed7ea100: fd fd fd fd fd fd fd fa fa fa f7 fa fd fd fd fd
  0x706aed7ea180: fd fd fd fd fa fa f7 fa 00 00 00 00 00 00 00 00
  0x706aed7ea200: fa fa f7 fa fd fd fd fd fd fd fd fa fa fa f7 fa
=>0x706aed7ea280: fd fd fd fd fd fd fd fd fa fa f7 fa fd fd[fd]fd
  0x706aed7ea300: fd fd fd fd fa fa f7 fa fd fd fd fd fd fd fd fd
  0x706aed7ea380: fa fa f7 fa fd fd fd fd fd fd fd fd fa fa f7 fa
  0x706aed7ea400: fd fd fd fd fd fd fd fa fa fa f7 fa fd fd fd fd
  0x706aed7ea480: fd fd fd fd fa fa f7 fa fd fd fd fd fd fd fd fd
  0x706aed7ea500: fa fa f7 fa fd fd fd fd fd fd fd fd fa fa f7 fa

The summary line repeats the bug class and gives the build path and a BuildId, a unique identifier for that exact compiled binary. The shadow bytes are ASan's own bookkeeping. ASan reserves a small amount of extra memory, the shadow memory, where each byte records the state of eight bytes of real memory. The legend in the report explains the codes: fd marks a freed heap region, fa marks a heap left redzone, which is a guard area around an allocation, and 00 means addressable, normal memory. The arrow => points at the row containing the faulting address, and the square brackets mark the exact byte. Seeing fd all around the faulting address is consistent with the faulting address sitting inside a freed allocation.

Root cause

The report does not state a root cause; the researcher explicitly says it was not yet known. What the traces show is a lifetime race between two threads. On the semi-realtime audio worklet thread, WebAudioMediaStreamSource::ConsumeAudio pushes audio into AudioPushFifo, which allocates an AudioBus and then reads from it in the same call path. On the main thread, a garbage collection triggered by a WebAssembly memory allocation runs cppgc pre-finalizers, which dispose the MediaStreamSource and destroy the WebAudioMediaStreamSource and its AudioPushFifo, freeing the AudioBus while the audio thread is still using it.

The report does not identify the root cause or which synchronisation is missing. Synchronisation here means coordination between threads, such as a lock or a handshake, so that one thread does not pull the rug out from under another. The report does not identify which reference or which synchronisation is missing.

MiraclePtr did not help here: the report records NOT PROTECTED and states that no raw_ptr<T> access to the region was detected prior to the crash, and that the crash is still exploitable with MiraclePtr.

Impact

The report classifies the issue as a use-after-free in media::AudioBus and records it as a tab crash. The researcher describes it as a race condition with a very low probability of being triggered. No exploitation beyond the crash is demonstrated, and the report does not describe what an attacker could achieve with control of the freed memory.

Fix

Variants to test

These follow from the shape of the bug rather than from anything the report demonstrates:

  1. Other WebAudio nodes that hand buffers to a second thread. A positive result is an ASan heap-use-after-free where the free stack runs through a cppgc pre-finalizer or GC on the main thread and the read stack runs on a worker or audio thread.
  2. Media stream sources disposed during GC while audio is rendering. A positive result is the same split between a main-thread Dispose and an audio-thread ConsumeAudio.
  3. Forcing garbage collection from JavaScript during audio rendering, for example through large WebAssembly memory allocations as in this trace. A positive result is a crash whose free stack includes HandleExternalMemoryInterrupt and CppHeap::CompactAndSweep.
  4. Any object protected only by a pre-finalizer rather than by reference counting across threads. Reference counting is a way of tracking how many parts of a program are using an object, so it is only deleted when the count reaches zero. A positive result is a MiraclePtr Status: NOT PROTECTED line in the ASan report alongside a use-after-free.

Hunting notes

This kind of bug tends to sit where an object owned by the main thread is also read by a real-time or semi-realtime thread, and where teardown is driven by garbage collection rather than by explicit synchronisation. The signals worth watching in a crash report are a free stack that runs through cppgc pre-finalizers or Dispose, a read stack on a thread named for audio or real-time work, and a MiraclePtr Status: NOT PROTECTED line. The report itself shows how the researcher presented the case: a complete ASan report with the read, free, allocation and thread-creation stacks, the task trace and the renderer command line, plus an honest statement that the root cause and PoC were still pending.

Glossary

  • API: a defined set of tools a program or web page can call to ask another piece of software to do something.
  • AddressSanitizer (ASan): a debugging tool built into special builds of programs that detects invalid memory use, such as reading memory that has already been freed.
  • AudioBus: a container in Chrome's media code that holds a block of audio samples.
  • AudioPushFifo: a first-in-first-out queue that buffers audio blocks before they are consumed.
  • Blink: Chrome's rendering engine, the component that turns web content into what you see and hear.
  • Bug bounty / VRP: a programme that pays people for finding and reporting security problems in software. VRP stands for Vulnerability Reward Program.
  • BuildId: a unique identifier for one specific compiled build of a program.
  • Class: a blueprint in code that bundles data together with the functions that operate on it.
  • Command-line flag: an option passed to a program when it starts, changing its behaviour.
  • Constructor / destructor: the function that runs when an object is created, and the function that runs when it is cleaned up (its name starts with a tilde).
  • cppgc: Chrome's garbage collector for C++ objects that can be referenced from JavaScript.
  • Dev channel: an early Chrome release channel where new code lands before it reaches most users.
  • Factory function: a function whose job is to create and return a new object.
  • Garbage collection (GC): the automatic process of finding memory a program no longer needs and reclaiming it.
  • Heap: the pool of memory a program uses for objects it creates while running.
  • Hexadecimal: a base-16 number system commonly used to write memory addresses.
  • JSArrayBuffer: a JavaScript object representing a raw block of memory.
  • MediaStream: the browser's representation of a live audio or video stream, such as from a camera or microphone.
  • MiraclePtr: a Chrome defence that makes freed pointers unusable, making use-after-free bugs harder to exploit.
  • Payload: the specific input, such as a web page, that triggers a bug.
  • PoC (proof of concept): a small, reliable recipe that demonstrates a bug.
  • Pre-finalizer: a hook that runs just before the garbage collector finalises an object, letting it release resources outside the garbage-collected heap.
  • Process: a running instance of a program with its own memory; Chrome uses separate processes for the browser and for page content.
  • Race condition: a bug where the outcome depends on the timing of two things happening at once.
  • raw_ptr: a smart pointer type used by Chrome's MiraclePtr defence.
  • Reference counting: tracking how many parts of a program use an object so it is only deleted when the count reaches zero.
  • Regression range: the span of code changes between a version where something worked and one where it broke.
  • Renderer: the Chrome process that runs a tab's page content.
  • Shadow memory / shadow bytes: extra memory ASan keeps to record the state of real memory, byte by byte.
  • Smart pointer (unique_ptr): a small wrapper that owns an object and deletes it automatically when the wrapper goes away.
  • Stack backtrace / stack trace: the list of function calls that led to a particular point in a program.
  • Synchronisation: coordination between threads, such as a lock, so they do not interfere with each other.
  • Tab crash: a crash that takes down one tab's renderer process rather than the whole browser.
  • Task trace: a short record of the job that was running when a crash occurred.
  • Thread: one sequence of instructions running inside a process; a process can have many threads at once.
  • Use-after-free: a bug where a program keeps using memory after it has been freed, which can lead to crashes or, in the worst case, exploitation.
  • Vector: a growable list-like container in code.
  • WebAssembly (Wasm): a fast, low-level format that lets web pages run compiled code in the browser.
  • WebAudio: a browser API that lets a page build and process an audio graph.
  • Worklet: a small piece of JavaScript that runs on a background thread, such as an audio thread.

More by Huang Xilin

View all

8 more disclosed reports, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

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