Use after free in Accessibility (CVE-2024-1673)
A use-after-free vulnerability exists in Chrome's accessibility component where a raw pointer to a render frame could be accessed after the frame was deleted, triggered by navigating back and forth. An attacker could potentially exploit this to cause memory corruption, though the report does not demonstrate full exploitation.
Originally disclosed on Chrome VRP
- Fix shipped in 41 days
Steps to reproduce the problem:
- download asan-linux-release-1245721.zip and unzip
- run chrome
chrome --user-data-dir=/tmp/noexist123 --no-sandboxand openchrome-untrusted://read-anything-side-panel.top-chrome/ - go back and go forward several times to trigger the UAF
Note that this function needs to download a screen_ai library, and it's path is /path/to/user-data/screen_ai/XXXX, if you don't have it, please wait until it is downloaded.
Problem Description:
- Analysis
There is a raw_ptr render_frame_[1] in the class AXTreeDistiller, which could be deleted before the ScreenAIServiceReady, causing UAF.
void AXTreeDistiller::ScreenAIServiceReady() {
if (main_content_extractor_.is_bound()) {
return;
}
render_frame_->GetBrowserInterfaceBroker()->GetInterface(
main_content_extractor_.BindNewPipeAndPassReceiver());
main_content_extractor_.set_disconnect_handler(
base::BindOnce(&AXTreeDistiller::OnMainContentExtractorDisconnected,
weak_ptr_factory_.GetWeakPtr()));
}
- Bisect
The use of render_frame_ is introduced in this commit: https://chromium-review.googlesource.com/c/chromium/src/+/3620253 , and it is used in the constructor of AXTreeDistiller. This is introduced in Chrome stable 103.0.5060.53
The render_frame_ is moved to a stand alone function ScreenAIServiceReady in this commit: https://chromium-review.googlesource.com/c/chromium/src/+/4262827, and it in introduced in Chrome stable 112.0.5615.49
- Suggested Patch
Maybe you could use a weak_ptr to ensure the lifetime of render_frame_.
Additional Comments:
**Chrome version: ** 110.0.0.0 **Channel: ** Not sure
OS: Linux
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
What the attacker needed
Chrome version with accessibility feature; Ability to navigate back and forward; Screen AI library downloaded
The fix
The report suggests using a weak pointer to ensure the lifetime of `render_frame_` is properly managed.
How it was found
- Download and unzip the provided ASAN build.
- Run Chrome with a fresh user data directory and no sandbox, then open the specified chrome-untrusted URL.
- Navigate back and forward several times to trigger the use-after-free.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A use-after-free happens when a program keeps a reference to memory that has already been freed, and later uses it. Here, a pointer to a web page frame was kept after the frame was destroyed, so when a background service became ready, it tried to use the freed frame. This could let an attacker corrupt memory or crash 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.