Insufficient data validation in Mojo (CVE-2024-9369)
A compromised renderer could send a crafted Mojo message with a small fragment size, causing an out-of-bounds write in the broker process when ipcz locks the fragment. This could lead to memory corruption and potentially code execution in the browser process.
Originally disclosed on Chrome VRP
- Fix shipped in 13 days
Steps to reproduce the problem
- Apply
renderer.diffas a compromised renderer in the latest dev branch (commit fe006cb71900560b8fefb24b70b5ef49c583f36d). - Build chrome with asan, and run chrome directly.
gn gen out/ReleaseAsan --args="is_debug=false symbol_level=2 is_asan=true enable_nacl=false is_component_build=true"
autoninja -C out/ReleaseAsan chrome
./out/ReleaseAsan/chrome
- Out-of-bounds writing occurs in broker process, see
asan.log
Problem Description
In ipcz, Router::Deserialize is responsible for handling HandleType::kPortal messages. It uses BufferPool::GetFragment to create a fragment from the description of the messages.
Breakpoint 0 hit
mojo_core_embedder_internal!ipcz::Fragment::MappedFromDescriptor+0x1d:
00007fff`9465ddad 4d399080000000 cmp qword ptr [r8+80h],r10 ds:00000254`3bd70d18=0000000000020000
0:013> dt descriptor
Local var @ rdx Type ipcz::FragmentDescriptor*
+0x000 buffer_id_ : ipcz::StrongAlias<ipcz::BufferIdTag,unsigned long long>
+0x008 offset_ : 0x17d00
+0x00c size_ : 0x100
offset_ and size_ are transmitted from client processes, such as renderer, via mojo pipe. In the renderer.diff, offset_ and size_ correspond to idata[6] and idata[7] respectively.
The callstack when creating a fragment:
0:016> k
# Child-SP RetAddr Call Site
00 000000ac`e4ffc2e8 00007ffe`e9b49dc4 mojo_core_embedder_internal!ipcz::Fragment::MappedFromDescriptor [F:\Chromium\src\third_party\ipcz\src\ipcz\fragment.cc @ 18]
01 000000ac`e4ffc2f0 00007ffe`e9bc470e mojo_core_embedder_internal!ipcz::BufferPool::GetFragment+0x1a4 [F:\Chromium\src\third_party\ipcz\src\ipcz\buffer_pool.cc @ 33]
02 000000ac`e4ffc3b0 00007ffe`e9be9e76 mojo_core_embedder_internal!ipcz::NodeLinkMemory::GetFragment+0x2e [F:\Chromium\src\third_party\ipcz\src\ipcz\node_link_memory.cc @ 290]
03 000000ac`e4ffc400 00007ffe`e9b9f12a mojo_core_embedder_internal!ipcz::Router::Deserialize+0x4d6 [F:\Chromium\src\third_party\ipcz\src\ipcz\router.cc @ 748]
04 000000ac`e4ffca70 00007ffe`e9bd2fe5 mojo_core_embedder_internal!ipcz::NodeLink::OnAcceptParcel+0x2aa [F:\Chromium\src\third_party\ipcz\src\ipcz\node_link.cc @ 559]
05 000000ac`e4ffcca0 00007ffe`e9bd1e5e mojo_core_embedder_internal!ipcz::msg::NodeMessageListener::DispatchMessage+0x1c5 [F:\Chromium\src\third_party\ipcz\src\ipcz\node_messages_generator.h @ 357]
06 000000ac`e4ffccf0 00007ffe`e9bd2625 mojo_core_embedder_internal!ipcz::msg::NodeMessageListener::OnMessage+0x1e [F:\Chromium\src\third_party\ipcz\src\ipcz\node_messages_generator.h @ 10]
BufferPool::GetFragment performs a check to make sure (offset_ + size_) < mapping.size_, but it does not verify if size_ is greater than a minimum value.
And then out-of-bound writing occurs when ipcz tries to lock that fragment:
00 (Inline Function) --------`-------- mojo_core_embedder_internal!std::__Cr::__cxx_atomic_compare_exchange_weak [F:\Chromium\src\third_party\libc++\src\include\__atomic\cxx_atomic_impl.h @ 400]
01 (Inline Function) --------`-------- mojo_core_embedder_internal!std::__Cr::__atomic_base<unsigned int,0>::compare_exchange_weak [F:\Chromium\src\third_party\libc++\src\include\__atomic\atomic_base.h @ 93]
02 00000081`8c5fe458 00007fff`354e5b06 mojo_core_embedder_internal!ipcz::RouterLinkState::SetSideStable+0x16 [F:\Chromium\src\third_party\ipcz\src\ipcz\router_link_state.cc @ 50]
03 00000081`8c5fe460 00007fff`354e9387 mojo_core_embedder_internal!ipcz::Router::Flush+0x806 [F:\Chromium\src\third_party\ipcz\src\ipcz\router.cc @ 1487]
04 00000081`8c5fe800 00007fff`354d2283 mojo_core_embedder_internal!ipcz::Router::Deserialize+0x7d7 [F:\Chromium\src\third_party\ipcz\src\ipcz\router.cc @ 802]
The vulnerability is present in ipcz, a core inter-process communication module used by Chrome. We assess it as being of high severity and exploitable.
Summary
Out-of-bounds write in ipcz while deserializing message
Custom Questions
Type of crash:
browser
Reporter credit:
Xiantong Hou and Pisanbao of Wuheng Lab
Additional Data
Category: Security
Chrome Channel: Dev
Regression: N/A
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 buffer pool check only verifies that offset plus size is within the mapping, but does not ensure the size is large enough for the fragment's internal state, leading to an out-of-bounds write when locking the fragment.
Impact
The vulnerability is assessed as high severity and exploitable, potentially allowing a compromised renderer to cause memory corruption in the browser process.
What the attacker needed
Compromised renderer; crafted Mojo message
How it was found
- Apply the provided renderer.diff to a compromised renderer in the latest dev branch.
- Build Chrome with AddressSanitizer enabled.
- Run Chrome and trigger the out-of-bounds write in the broker process.
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.
Chrome uses a system called Mojo to let different parts of the browser talk to each other. A bug in that system let a malicious part (like a compromised web page renderer) send a message that made the main browser process write data outside its intended memory area, which can crash or take over the browser.
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.