Skip to content
Race condition Advisory Advanced CVE-2026-130987

Race condition in Downloads (CVE-2026-130987)

A time-of-check to time-of-use flaw in the 'Save Page As' feature allows a compromised renderer to append malicious data to a saved file after the antivirus scan has started but before it finishes, bypassing the scan. An attacker could thus deliver a malicious file that appears to have passed the OS quarantine check.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 8 months

Project Fortify, an experimental security project, has identified the following potential security issue.

Overview: A Time-of-Check to Time-of-Use (TOCTOU) vulnerability exists in the "Save Page As" feature. A compromised renderer can bypass OS-level antivirus quarantine checks by appending malicious data to a saved file after it has signaled completion but before the asynchronous AV scan finishes.

Affected files:

  • content/browser/download/save_file_manager.cc
  • content/browser/download/save_package.cc
  • content/browser/download/save_file.h
  • content/browser/download/save_package_serialization_handler.cc

Estimated timestamp from git blame: 2025-10-22

Summary

A logic flaw in the serialization process of "Save Page As" (Complete HTML) leads to a potential write-after-quarantine Time-of-Check to Time-of-Use (TOCTOU) vulnerability. A compromised renderer can exploit this by sending a Done() signal to initiate the asynchronous antivirus scan (via the OS Quarantine Service) and subsequently sending malicious data via DidReceiveData(). Because the browser does not ignore further data or close the file handle during the quarantine window, the malicious data is appended to the file while or after it is scanned, effectively bypassing the security check.

Technical Details

  1. Persistent Communication Channel: When a user saves a page, the browser initiates serialization and creates a Mojo receiver for FrameHTMLSerializerHandler using mojo::MakeSelfOwnedReceiver in SavePackage::GetSerializedHtmlWithLocalLinksForFrame. When the renderer calls Done(), SavePackageSerializationHandler::Done() is executed. It runs the completion callback but does not close the Mojo pipe or invalidate the data callback. This allows a compromised renderer to continue calling DidReceiveData().

  2. Asynchronous Quarantine and Weak Guards: Upon receiving the Done() signal, SavePackage::OnDidFinishedSerializingHtmlData posts a task to SaveFileManager::SaveFinished. This method calls SaveFile::RunQuarantineCallback(), initiating an asynchronous quarantine process (e.g., IAttachmentExecute::Save() on Windows).

    During this asynchronous scan:

    • The SaveFile object remains active in SaveFileManager::save_file_map_.
    • SaveFile::InProgress() remains true because Close() is only called in SaveCompleted after the quarantine resolves.
    • In SavePackage::OnDidReceiveSerializedHtmlData, the UI thread state save_item->state() is still IN_PROGRESS.
  3. The TOCTOU Race: Because the file remains open and the state checks still pass, any DidReceiveData() calls arriving during the quarantine window are successfully written to disk via SaveFileManager::UpdateSaveProgress and AppendDataToFile. The malicious payload is appended to the file while or after the AV scanner reads the benign prefix, allowing the attacker to bypass the scan.

Potential Attacker Steps

Note: These steps are suggested based on code analysis; our tooling has not executed a live proof-of-concept.

  1. An attacker compromises a renderer process.
  2. The user is tricked into saving the webpage (e.g., via Ctrl+S).
  3. The browser requests the serialized HTML from the compromised renderer.
  4. The renderer sends a benign HTML payload via DidReceiveData(benign_data).
  5. The renderer sends the Done() signal, prompting the browser to begin the OS-level antivirus scan on the file.
  6. Immediately after, the renderer sends DidReceiveData(malicious_data) over the still-open Mojo pipe.
  7. The browser appends the malicious data to the file while the AV scan is occurring on the benign prefix.
  8. The AV scan completes with a safe verdict, and the browser finalizes the file, leaving the user with a malicious file that bypassed scanning.

Suggested Fix

Modify SavePackageSerializationHandler to ignore data received after Done() is called. For example, explicitly clear or check the did_serialize_data_callback_:

C++
void SavePackageSerializationHandler::DidReceiveData(
    const std::string& data_buffer) {
  if (!did_serialize_data_callback_) return;
  did_serialize_data_callback_.Run(data_buffer);
}

void SavePackageSerializationHandler::Done() {
  if (!done_callback_) return;
  std::move(done_callback_).Run();
  did_serialize_data_callback_.Reset(); // Prevent further writes
}

Alternatively, SavePackage::OnDidReceiveSerializedHtmlData could check if the item is already waiting for quarantine, or the Mojo receiver could be explicitly closed upon Done().

Evaluated with Chrome root at commit: 876d480da1f794d87813cfa2e6ff4fcf9771e939


Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.

The original report as published on the Chromium issue tracker. 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

The browser does not stop accepting data from the renderer after the renderer signals that serialization is done, so data sent during the asynchronous antivirus scan is still written to the file.

Impact

A compromised renderer could bypass the OS antivirus quarantine check and cause the user to save a malicious file that appears to have been scanned and found safe.

What the attacker needed

Compromised renderer process; user saves the page (e.g., Ctrl+S)

The fix

The browser should ignore any data received after the Done() signal, for example by resetting the data callback or closing the Mojo receiver.

How it was found

  1. An attacker compromises a renderer process.
  2. The user is tricked into saving the webpage (e.g., via Ctrl+S).
  3. The browser requests the serialized HTML from the compromised renderer.
  4. The renderer sends a benign HTML payload via DidReceiveData(benign_data).
  5. The renderer sends the Done() signal, prompting the browser to begin the OS-level antivirus scan on the file.
  6. Immediately after, the renderer sends DidReceiveData(malicious_data) over the still-open Mojo pipe.

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 save a web page, the browser writes the file and then asks the operating system's antivirus to check it. The browser keeps the file open during that check, so a malicious part of the browser can sneak extra bad content into the file after the check has already looked at the safe beginning. This means the antivirus says the file is safe, but it actually contains harmful data.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.