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

Race in Network (CVE-2026-11677)

A time-of-check to time-of-use race in SimpleURLLoader's temporary file handling on macOS lets a compromised network service replace a temporary file with a symbolic link before the browser re-opens it. The browser then follows the link and overwrites arbitrary files with browser privileges, potentially escaping the sandbox.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 13 days

Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A potential Time-of-Check to Time-of-Use (TOCTOU) vulnerability exists in SimpleURLLoader's temporary file creation mechanism on macOS. A compromised, sandboxed network service process can exploit a race condition in the shared temporary directory to swap a temporary file with a symbolic link. Because the browser process re-opens the file path without symbolic link protection, it may follow the link and overwrite arbitrary files with browser process privileges.

Affected files:

  • services/network/public/cpp/simple_url_loader.cc

Estimated timestamp from git blame: 2017-10-18

Summary

A potential Time-of-Check to Time-of-Use (TOCTOU) vulnerability has been identified in the temporary file writing logic of SimpleURLLoader (services/network/public/cpp/simple_url_loader.cc). When downloading to a temporary file, the code generates and closes a temporary file, and subsequently re-opens the path. On macOS, both the unsandboxed browser process and the sandboxed network service process share access to the same temporary directory, creating a race window where a compromised network service can replace the temporary file with a symbolic link, resulting in an arbitrary file write under browser privileges (sandbox escape).

Vulnerability Analysis

In services/network/public/cpp/simple_url_loader.cc, within FileWriter::StartWritingOnFileSequence (lines 1023-1036):

C++
bool have_path = !create_temp_file_;
if (!have_path) {
  DCHECK(create_temp_file_);
  have_path = base::CreateTemporaryFile(&path_);   // (1) Creates the file and immediately closes its file descriptor
  if (have_path)
    owns_file_ = true;
}

if (have_path) {
  file_.Initialize(
      path_, base::File::FLAG_WRITE | base::File::FLAG_CREATE_ALWAYS);
                                                   // (2) Re-opens the file by path
}
  1. Step 1 (base::CreateTemporaryFile): The helper base::CreateTemporaryFile (defined in base/files/file_util.cc, line 395) resolves the temporary directory and calls mkstemp via CreateAndOpenFdForTemporaryFileInDir. It immediately closes the returned file descriptor, leaving only the generated path string in path_ (e.g., /private/var/folders/.../T/.com.google.Chrome.XXXXXX).

  2. Step 2 (file_.Initialize): The browser process re-opens this path on a background thread using file_.Initialize with base::File::FLAG_WRITE | base::File::FLAG_CREATE_ALWAYS. On POSIX platforms (including macOS), FLAG_CREATE_ALWAYS maps directly to O_CREAT | O_TRUNC (in base/files/file_posix.cc, lines 573-577). Crucially, the flag map does not employ O_NOFOLLOW or check whether the target is a symbolic link.

Sandbox Context (macOS)

Although the Network Service is sandboxed, its macOS Seatbelt profile (sandbox/policy/mac/network.sb, lines 50-53) explicitly permits read and write access to the per-user temporary directory:

SCHEME
(allow file-read* file-write*
  (subpath (param darwin-user-cache-dir))
  (subpath (param darwin-user-temp-dir))
)

The parameter darwin-user-temp-dir is retrieved in the browser process via confstr(_CS_DARWIN_USER_TEMP_DIR, ...) and passed during the launching of the child process. Therefore, both the unsandboxed browser process (running SimpleURLLoader's file sequence) and the sandboxed network process share access to the exact same temporary directory path.

Potential Exploitation Scenario

Based on static analysis, a compromised network process could potentially execute the following steps to escape the sandbox:

  1. Monitoring: The compromised network process monitors the darwin-user-temp-dir for the creation of temporary files adhering to the pattern .com.google.Chrome.XXXXXX.
  2. The Race: Immediately after base::CreateTemporaryFile is called and closes its file descriptor (Step 1), but before the browser process calls file_.Initialize (Step 2), the attacker deletes the empty temporary file via unlink().
  3. Symlink Placement: The attacker creates a symbolic link at that exact path pointing to a highly sensitive destination in the user's home directory (e.g., ~/Library/LaunchAgents/persistence.plist or ~/.zshrc).
  4. Overwrite: When the browser process calls file_.Initialize, the open call follows the symbolic link, truncating the targeted plist or shell script, and writes the incoming network payload directly into it.
  5. Retry Mitigation: If the attacker misses the tight race window, they can abort the loader from the network side with net::ERR_NETWORK_CHANGED. This triggers SimpleURLLoader's retry mechanism (frequently used by components like the ExtensionDownloader), giving the attacker multiple attempts to win the race.

Note: These are potential/suggested exploitation steps derived from static code and sandbox profile tracing, as our current tooling does not have the capability to execute code or verify runtime behavior.

Suggested Fix

Avoid closing and re-opening the file by path. Instead of calling base::CreateTemporaryFile and then file_.Initialize, utilize an API that keeps the file descriptor open upon creation, such as base::CreateAndOpenTemporaryFileInDir. This ensures that the browser retains exclusive and safe access to the file handle created atomically by mkstemp without leaving a path open to TOCTOU manipulation.

Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8


Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:

  • If you are familiar with the severity guidelines, you may adjust the severity.
  • If this is a false positive, and there's no work to be done, please close as WAI.
  • If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.

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 code creates a temporary file, closes its file descriptor, and later re-opens the same path without using O_NOFOLLOW or checking for symbolic links, leaving a race window.

Impact

A compromised network service could overwrite arbitrary files with browser privileges, potentially escaping the sandbox, though the report notes this is based on static analysis and has not been verified at runtime.

What the attacker needed

Compromised network service process; macOS platform; shared temporary directory access; win the race window

The fix

The code should keep the file descriptor open from creation instead of closing and re-opening by path, for example by using an API that atomically creates and opens the temporary file.

How it was found

  1. The compromised network process monitors the shared temporary directory for new temporary files matching the browser's naming pattern.
  2. After the browser creates and closes the temporary file, the attacker deletes it before the browser re-opens it.
  3. The attacker creates a symbolic link at the same path pointing to a sensitive file in the user's home directory.
  4. When the browser re-opens the path, it follows the link, truncates the target file, and writes the downloaded content into it.
  5. If the race is missed, the attacker can abort the download with a network error to trigger a retry and try again.

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 the browser downloads something to a temporary file, it first creates the file, closes it, and later opens it again by its name. A malicious program running in a restricted part of the browser can quickly swap that file for a shortcut (a symbolic link) pointing to an important file. When the browser opens the name again, it follows the shortcut and overwrites the important file, which can let the attacker run code outside the sandbox.

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.