Skip to content
Memory corruption Advisory Advanced CVE-2024-9126

Use after free in Internals (CVE-2024-9126)

A use-after-free existed in Chrome's net-export UI on iOS: closing the page before the asynchronous file-path callback ran deleted the message handler, which the callback still referenced. An attacker who could get a user to trigger the send-email flow and close the page could cause a crash in the browser process.

lime Follow

Originally disclosed on Chrome VRP

Bounty$1,000 Medium View original
  • Fix shipped in 34 days
# Steps to reproduce the problem
step to repro:
1. navigate to chrome://net-export
2. click send email and close the site.

# Problem Description
0. In classic mode, closing WebContents before the callback is run will cause the NetExportMessageHandler to be deleted. Then lead to UAF.

```cpp
void NetExportMessageHandler::OnSendNetLog(const base::Value::List& list) {
  DCHECK_CURRENTLY_ON(web::WebThread::UI);
  file_writer_->GetFilePathToCompletedLog(base::BindOnce(
      &NetExportMessageHandler::SendEmail, base::Unretained(this))); //<-- unretained(this) 
}cc
```

1. 

```cpp
void NetExportFileWriter::GetFilePathToCompletedLog(
    FilePathCallback path_callback) const {
  DCHECK(thread_checker_.CalledOnValidThread());
  if (!(log_exists_ && state_ == STATE_NOT_LOGGING)) {
    base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
        FROM_HERE, base::BindOnce(std::move(path_callback), base::FilePath()));
    return;
  }

  DCHECK(file_task_runner_);
  DCHECK(!log_path_.empty());

  file_task_runner_->PostTaskAndReplyWithResult(
      FROM_HERE, base::BindOnce(&GetPathIfExists, log_path_),
      std::move(path_callback)); // 将会进�
�这里
}
```

[0]. https://source.chromium.org/chromium/chromium/src/+/main:ios/chrome/browser/webui/ui_bundled/net_export/net_export_ui.mm;l=159;drc=3e02eb658e84b46ebb53667e0a1cb52fe53b5f87;bpv=0;bpt=1
[1]. https://source.chromium.org/chromium/chromium/src/+/main:components/net_log/net_export_file_writer.cc;l=277;drc=3e02eb658e84b46ebb53667e0a1cb52fe53b5f87;bpv=0;bpt=1

bitset:
This problem has existed for a long time and was first introduced: https://source.chromium.org/chromium/chromium/src/+/5f9f7f0695a6c3bc37a1525f04436ee79a8c2179

# Summary
AddressSanitizer: heap-use-after-free on NetExportMessageHandler::SendEmail

# Custom Questions
#### Type of crash: 
browser

#### Crash state: 
see uaf5-asan.log

# Additional Data
Category: Security \
Chrome Channel: Not sure \
Regression: N/A

The original report as published on the Chromium issue tracker, by lime(@limeSec_) and fmyy(@binary_fmyy) From TIANGONG Team of Legendsec at QI-ANXIN Group. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 callback was bound with base::Unretained(this), so it did not keep the handler alive and could run after the handler was destroyed when the WebContents closed.

Impact

Could crash the browser process through a heap use-after-free, as shown by the AddressSanitizer report; the text does not claim code execution.

What the attacker needed

User opens chrome://net-export; user triggers send email and closes page

How it was found

  1. Open the net-export internal page.
  2. Trigger the send-email action and close the page before the callback completes.

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.

When you ask Chrome to email a network log, it starts a slow background task and keeps a pointer to the object that will handle the result. If you close the page before that task finishes, the object is destroyed but the pointer is still used, so the program touches freed memory. This is called a use-after-free and usually crashes 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.

More by lime

View all

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