Use after free in Cast (CVE-2025-8578)
A use-after-free occurs in the Cast mirroring service when an audio capture error callback passes a string_view to a function after the underlying string has been destroyed. An attacker could potentially trigger this by causing an audio capture error, leading to memory corruption.
- Fix shipped in 58 days
VULNERABILITY DETAILS
The issue is reported via a GWP-ASan cab.
Allocation stack trace size: 27 Deallocation stack trace size: 23 Allocation address: 6ec00e5efa0 Allocation size: 60 Error type: Use After Free Region start: 6ec00003000 Region size: 1041000 Allocator Type: Malloc GWP-ASan Mode: Classic Allocation Thread ID: 5288
Allocation Stack Trace:
0 0x7fff548de0f5 [msedge!base::debug::CollectStackTrace at base/debug/stack_trace_win.cc:326] 1 0x7fff548de0b5 [msedge!gwp_asan::internal::AllocationInfo::GetStackTrace at components/gwp_asan/common/allocation_info.cc:27] 2 0x7fff53cba3b9 [msedge!gwp_asan::internal::GuardedPageAllocator::Allocate at components/gwp_asan/client/guarded_page_allocator.cc:324] 3 0x7fff51de7326 [msedge!gwp_asan::internal::`anonymous namespace'::AllocFn at components/gwp_asan/client/sampling_malloc_shims.cc:56] 4 0x7fff52ff1fdf [msedge!malloc at base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_override_ucrt_symbols_win.h:94] 5 0x7fff55d50817 [msedge!operator new at vctools/crt/vcstartup/src/heap/new_scalar.cpp:36] 6 0x7fff548c2ed9 [msedge!base::StrCat at base/strings/strcat.cc:15] 7 0x7fff5e6e26bc [msedge!mirroring::OpenscreenSessionHost::AudioCapturingCallback::OnCaptureError at components/mirroring/service/openscreen_session_host.cc:237] 8 0x7fff56a3b988 [msedge!media::AudioInputDevice::DetectedDeadInputStream at media/audio/audio_input_device.cc:378] 9 0x7fff5486b125 [msedge!base::RepeatingCallback<void ()>::Run at base/functional/callback.h:345] 10 0x7fff56a38f20 [msedge!media::AliveChecker::CheckIfAlive at media/audio/alive_checker.cc:143] 11 0x7fff54c8f898 [msedge!base::RepeatingTimer::RunUserTask at base/timer/timer.cc:215] 12 0x7fff52171c4f [msedge!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork at base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:332] 13 0x7fff52fc358f [msedge!base::MessagePumpDefault::Run at base/message_loop/message_pump_default.cc:43] 14 0x7fff53d1418e [msedge!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run at base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:634] 15 0x7fff53d12a5f [msedge!base::RunLoop::Run at base/run_loop.cc:139] 16 0x7fff56156e81 [msedge!content::UtilityMain at content/utility/utility_main.cc:626] 17 0x7fff51edb917 [msedge!content::RunOtherNamedProcessTypeMain at content/app/content_main_runner_impl.cc:791] 18 0x7fff51eda690 [msedge!content::ContentMainRunnerImpl::Run at content/app/content_main_runner_impl.cc:1171] 19 0x7fff51ed9cfa [msedge!content::RunContentProcess at content/app/content_main.cc:419] 20 0x7fff51ed8fda [msedge!content::ContentMain at content/app/content_main.cc:432] 21 0x7fff51ed8969 [msedge!ChromeMain at chrome/app/chrome_main.cc:340] 22 0x7ff635e17ce6 [msedge_exe!MainDllLoader::Launch at chrome/app/main_dll_loader_win.cc:241] 23 0x7ff635e15597 [msedge_exe!wWinMain at chrome/app/chrome_exe_main_win.cc:804] 24 0x7ff635ef94c2 [msedge_exe!__scrt_common_main_seh at vctools/crt/vcstartup/src/startup/exe_common.inl:288] 25 0x7fffd8eb259d [kernel32!BaseThreadInitThunk at clientcore/base/win32/client/thread.c:75] 26 0x7fffda7eaf58 [ntdll!RtlUserThreadStart at minkernel/ntdll/rtlstrt.c:1166]
Deallocation Thread ID: 5288
Deallocation Stack Trace:
0 0x7fff548de0f5 [msedge!base::debug::CollectStackTrace at base/debug/stack_trace_win.cc:326] 1 0x7fff548de0b5 [msedge!gwp_asan::internal::AllocationInfo::GetStackTrace at components/gwp_asan/common/allocation_info.cc:27] 2 0x7fff53d54451 [msedge!gwp_asan::internal::GuardedPageAllocator::Deallocate at components/gwp_asan/client/guarded_page_allocator.cc:364] 3 0x7fff5e6e272a [msedge!mirroring::OpenscreenSessionHost::AudioCapturingCallback::OnCaptureError at components/mirroring/service/openscreen_session_host.cc:243] 4 0x7fff56a3b988 [msedge!media::AudioInputDevice::DetectedDeadInputStream at media/audio/audio_input_device.cc:378] 5 0x7fff5486b125 [msedge!base::RepeatingCallback<void ()>::Run at base/functional/callback.h:345] 6 0x7fff56a38f20 [msedge!media::AliveChecker::CheckIfAlive at media/audio/alive_checker.cc:143] 7 0x7fff54c8f898 [msedge!base::RepeatingTimer::RunUserTask at base/timer/timer.cc:215] 8 0x7fff52171c4f [msedge!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork at base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:332] 9 0x7fff52fc358f [msedge!base::MessagePumpDefault::Run at base/message_loop/message_pump_default.cc:43] 10 0x7fff53d1418e [msedge!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run at base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:634] 11 0x7fff53d12a5f [msedge!base::RunLoop::Run at base/run_loop.cc:139] 12 0x7fff56156e81 [msedge!content::UtilityMain at content/utility/utility_main.cc:626] 13 0x7fff51edb917 [msedge!content::RunOtherNamedProcessTypeMain at content/app/content_main_runner_impl.cc:791] 14 0x7fff51eda690 [msedge!content::ContentMainRunnerImpl::Run at content/app/content_main_runner_impl.cc:1171] 15 0x7fff51ed9cfa [msedge!content::RunContentProcess at content/app/content_main.cc:419] 16 0x7fff51ed8fda [msedge!content::ContentMain at content/app/content_main.cc:432] 17 0x7fff51ed8969 [msedge!ChromeMain at chrome/app/chrome_main.cc:340] 18 0x7ff635e17ce6 [msedge_exe!MainDllLoader::Launch at chrome/app/main_dll_loader_win.cc:241] 19 0x7ff635e15597 [msedge_exe!wWinMain at chrome/app/chrome_exe_main_win.cc:804] 20 0x7ff635ef94c2 [msedge_exe!__scrt_common_main_seh at vctools/crt/vcstartup/src/startup/exe_common.inl:288] 21 0x7fffd8eb259d [kernel32!BaseThreadInitThunk at clientcore/base/win32/client/thread.c:75] 22 0x7fffda7eaf58 [ntdll!RtlUserThreadStart at minkernel/ntdll/rtlstrt.c:1166]
Posted from:
msedge!mirroring::OpenscreenSessionHost::StartCapturingAudio+0x7e (00007fff5e6de894) [D:\a\_work\e\src\components\mirroring\service\openscreen_session_host.cc @ 1126] task backtrace: [1] msedge!media::AliveChecker::Start+0x85 (00007fff56a38de1) [D:\a_work\e\src\media\audio\alive_checker.cc @ 97]
[2] msedge!media::AliveChecker::Start+0x85 (00007fff56a38de1) [D:\a\_work\e\src\media\audio\alive_checker.cc @ 97] [3] msedge!media::AliveChecker::Start+0x85 (00007fff56a38de1) [D:\a_work\e\src\media\audio\alive_checker.cc @ 97]
[4] msedge!mojo::core::ipcz_driver::MojoTrap::TrapEventHandler+0x6ae (00007fff`548a172e) [D:\a_work\e\src\mojo\core\ipcz_driver\mojo_trap.cc @ 400]
@$task_trace()
The task was posted from msedge!mirroring::OpenscreenSessionHost::StartCapturingAudio
audio_capturing_callback_ = std::make_unique<AudioCapturingCallback>( base::BindPostTaskToCurrentDefault(base::BindRepeating( &AudioRtpStream::InsertAudio, audio_stream_->AsWeakPtr())), base::BindPostTaskToCurrentDefault(base::BindOnce( &OpenscreenSessionHost::ReportAndLogError, weak_factory_.GetWeakPtr(), SessionError::AUDIO_CAPTURE_ERROR)), observer_);
Based on the allocation and deallocation stack the error_message is destructed which is being passed as a string_view to .
void OnCaptureError(media::AudioCapturerSource::ErrorCode code, const std::string& message) override { std::string error_message = base::StrCat( {"AudioCaptureError occurred, code: ", base::NumberToString(static_cast<int>(code)), ", message: ", message}); if (!error_callback_.is_null()) { std::move(error_callback_).Run(error_message); } }
The error_message is passed as a string_view to ReportAndLogError as message which is already destructed.
0:000> dq 0x000006ec00e5efa0 --------> message
000006ec00e5efa0 ???????????????? ???????????????? 000006ec00e5efb0 ???????????????? ????????????????
000006ec00e5efc0 ???????????????? ???????????????? 000006ec00e5efd0 ???????????????? ????????????????
000006ec00e5efe0 ???????????????? ???????????????? 000006ec00e5eff0 ???????????????? ????????????????
000006ec00e5f000 ???????????????? ???????????????? 000006ec00e5f010 ???????????????? ????????????????
0:000> dq 0x000006ec022f1900 -----> OpenscreenSessionHost
000006ec022f1900 00007fff5fad7df0 00007fff5fad7e10 000006ec022f1910 00007fff5fad7e30 1264a8c000000002
000006ec022f1920 00000000007fff55 0000000400000000 000006ec022f1930 0032746f6f74686b 0000000000000000
000006ec022f1940 0700000000000000 000006ec0220a670 000006ec022f1950 0000000000000024 8000000000000028
000006ec022f1960 312d7265646e6573 0000003130343335 000006ec022f1970 0d00000000000000 00000000ffffff00
void OpenscreenSessionHost::ReportAndLogError(SessionError error, std::string_view message) { base::UmaHistogramEnumeration("MediaRouter.MirroringService.SessionError", error); logger_.LogError(error, message);
This could be caused if the error_callback_ was posted on a different thread due to the usage of BindPostTaskToCurrentDefault
VERSION Chrome Version: M137 Operating System: Windows
REPRODUCTION CASE This is a GWP-ASan bug. Attached the details above.
FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION Type of crash: [tab, browser, etc.] Crash State: [see link above: stack trace with symbols, registers, exception record] Client ID (if relevant): [see link above]
CREDIT INFORMATION Externally reported security bugs may appear in Chrome release notes. If this bug is included, how would you like to be credited? Reporter credit: Fayez
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the error callback is posted to a different thread, so the local string is destroyed before the callback runs and reads it as a string_view.
Impact
Could lead to memory corruption and potentially arbitrary code execution, though the report only shows a crash.
What the attacker needed
Trigger audio capture error in Cast
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A use-after-free is a memory safety bug where a program keeps using a piece of memory after it has been freed. Here, a temporary string holding an error message is destroyed before another function tries to read it, which can crash the browser or potentially be exploited.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.