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

Race condition in Core (CVE-2026-91743)

A time-of-check to time-of-use race exists when Chromium creates a temporary swap file for a renderer on macOS: the file is created securely but then closed and reopened by path without protection against symbolic links. A compromised child process with write access to the shared temporary directory could theoretically replace the file with a symlink and cause the browser to truncate and write to an arbitrary file, potentially escaping the sandbox.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 4 months

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 on macOS during the creation of swap files for renderer processes. By racing the browser's insecure close-and-reopen file creation sequence in the shared temporary directory, a compromised child process with write permissions could theoretically swap the temporary file with a symbolic link. This could allow the child process to truncate and write to arbitrary files with browser-process privileges, bypassing the sandbox.

Affected files:

  • content/browser/renderer_host/render_process_host_impl.cc

Estimated timestamp from git blame: 2020-04-23

Detailed Analysis

During renderer process initialization, RenderProcessHostImpl::ProvideSwapFileForRenderer() prepares a temporary swap file on a background thread pool task (content/browser/renderer_host/render_process_host_impl.cc, line 6363):

C++
void RenderProcessHostImpl::ProvideSwapFileForRenderer() {
  if (GetBrowserContext()->IsOffTheRecord()) return;
  ...
  base::ThreadPool::PostTaskAndReplyWithResult(
      FROM_HERE, {base::MayBlock()}, base::BindOnce([]() {
        base::FilePath path;
        if (!base::CreateTemporaryFile(&path))            // (A) mkstemp -> CLOSE FD
          return base::File();
        int flags = base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_READ |
                    base::File::FLAG_WRITE | base::File::FLAG_DELETE_ON_CLOSE;
        flags = base::File::AddFlagsForPassingToUntrustedProcess(flags);
        return base::File(base::FilePath(path), flags);   // (B) Reopen BY PATH
      }),
      ...);
}

There are two combined weaknesses in this sequence on macOS/POSIX platforms:

  1. Discarding the Secure File Descriptor: base::CreateTemporaryFile() invokes CreateTemporaryFileInDir(), which creates the file securely via mkstemp() but immediately closes the file descriptor before returning, leaving only the randomized path (base/files/file_util_posix.cc, lines 862–867).
  2. Reopening by Path without O_NOFOLLOW: The file is subsequently reopened on the worker thread using base::File(base::FilePath(path), flags). When mapping FLAG_CREATE_ALWAYS to POSIX flags in DoInitialize() (base/files/file_posix.cc, line 562), Chromium uses O_CREAT | O_TRUNC | O_RDWR but does not append O_NOFOLLOW or implement checks to prevent following symbolic links. Consequently, opening the path will traverse symbolic links.

Potential Attack Scenario / Path to Sandbox Escape

Because the browser's temporary directory (NSTemporaryDirectory()) is shared and accessible to other sandboxed child processes (such as the GPU or Network processes) under the parameter darwin-user-temp-dir, a compromised child process could theoretically execute the following steps to exploit this race condition:

  1. Setup Directory Monitor: The compromised child process monitors the temporary directory for newly created temporary files matching the Chrome template (e.g., .org.chromium.Chromium.XXXXXX).
  2. Trigger Creation: The attacker triggers a new renderer launch (e.g., via a controlled frame navigation).
  3. Race the File Path: As soon as the browser creates the temporary file and closes its file descriptor in Step A, the attacker deletes (unlink()) the empty file and quickly replaces it with a symbolic link pointing to a sensitive file in the user's home directory (e.g., ~/Library/LaunchAgents/pwn.plist).
  4. Insecure Reopen: When the browser thread executes Step B, the POSIX open() call follows the symlink, truncating the user's target file (pwn.plist) to 0 bytes due to the O_TRUNC flag.
  5. Write Execution: The resulting file descriptor is passed via the Mojo IPC interface blink.mojom.DiskAllocator::ProvideTemporaryFile to the renderer. An attacker with control over the renderer process can write arbitrary content through the descriptor, populating the target file (e.g., with a launch configuration payload) to execute code outside the sandbox.

Note: These steps are based on static code analysis. Our tooling does not currently have the capability to execute code or verify this dynamic race window on a live macOS target.

Suggested Remediation

To eliminate the path-based TOCTOU entirely, the browser should avoid closing and reopening the file by path. Instead, it should use base::CreateAndOpenTemporaryFileInDir() to atomically create and obtain the open file handle in one step, and then immediately unlink the file from the filesystem.

This secure pattern is already implemented in services/webnn/host/weights_file_provider.cc:

C++
  base::FilePath path;
  base::File swap_file = base::CreateAndOpenTemporaryFileInDir(
      temp_dir, &path,
      base::File::FLAG_WIN_TEMPORARY | base::File::FLAG_WIN_NO_EXECUTE);
  if (swap_file.IsValid()) {
#if BUILDFLAG(IS_WIN)
    swap_file.DeleteOnClose(true);
#else
    base::DeleteFile(path); // Unlink immediately on POSIX
#endif
  }

On macOS and other POSIX-compatible operating systems, unlinking the file path immediately after creation ensures no other process can access or hijack the path, while leaving the file descriptor open, valid, and safe to pass to the renderer.

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

Likely the temporary file is created with mkstemp but its descriptor is closed, and the file is then reopened by path without O_NOFOLLOW, allowing a symbolic link to be followed.

Impact

A compromised child process could theoretically truncate and write to arbitrary files with browser-process privileges, potentially bypassing the sandbox, though the report notes the race has not been verified dynamically.

What the attacker needed

MacOS; compromised child process with temp dir write access; attacker can trigger renderer launch; race window must be won

The fix

The browser should atomically create and open the temporary file, then immediately unlink it on POSIX so the path cannot be hijacked.

How it was found

  1. The compromised child process monitors the shared temporary directory for new files matching the Chrome template.
  2. The attacker triggers a new renderer launch, for example through a controlled frame navigation.
  3. After the browser creates the temporary file and closes its descriptor, the attacker deletes the file and replaces it with a symbolic link to a sensitive file.
  4. When the browser reopens the path, the open call follows the symlink and truncates the target file.
  5. The resulting descriptor is passed to the renderer, which can write arbitrary content to the target file.

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 a program needs a temporary file, it should create it and keep it open, because closing it and reopening it by name gives other programs a chance to swap the file for a link to somewhere else. Here, Chromium creates the file safely but then closes it and reopens it by path, so a malicious program running alongside it could replace the file with a symbolic link (a shortcut to another file). If that happens, the browser might overwrite a file it should not touch, which could let the attacker run code outside the browser's protective 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.