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

Race condition in FileSystem (CVE-2026-79155)

A temporary download file's path is re-opened without O_NOFOLLOW after the safe file descriptor is discarded, so a compromised sandboxed child process sharing the temp directory could swap the file for a symbolic link. The browser process would then follow the link and truncate or overwrite a victim-owned file with downloaded content, potentially leading to code execution outside the sandbox.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 3 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 TOCTOU vulnerability in RemoteToLocalSyncer::DownloadFile on macOS allows a compromised sandboxed process to achieve arbitrary file truncation and write operations at browser-process privilege. This occurs because the browser process discards the safe file descriptor of a generated temporary file, subsequently re-opening the path without O_NOFOLLOW. Consequently, a compromised child process with write permissions to the shared temporary directory could swap the file for a symbolic link during the network download round-trip.

Affected files:

  • chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc
  • google_apis/common/base_requests.cc
  • chrome/browser/sync_file_system/sync_file_system_service.cc

Estimated timestamp from git blame: 2013-11-12

Detailed Description

A potential Time-of-Check to Time-of-Use (TOCTOU) vulnerability has been identified in the RemoteToLocalSyncer::DownloadFile function on macOS. The issue stems from the way temporary download files are managed and subsequently populated with network data.

Potential Vulnerability Mechanism

  1. Temporary File Creation and FD Discarding: RemoteToLocalSyncer::DownloadFile creates a temporary file under the system temporary directory (which resolves to _CS_DARWIN_USER_TEMP_DIR via NSTemporaryDirectory() on macOS) by calling CreateTemporaryFile:

    C++
    // chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc
    storage::ScopedFile file = CreateTemporaryFile(...);
    base::FilePath path = file.path();
    

    The underlying implementation in base::CreateTemporaryFileInDir generates the path, invokes mkstemp(), and immediately closes the safe file descriptor, returning only the raw path to the caller.

  2. Network Process Round-Trip and Path Re-opening: The naked file path is passed to the Drive download stack (drive_service()->DownloadFile). The UrlFetchRequestBase streams the download via the network service. When data is received, the browser process re-opens the file path on its blocking task runner using the base::File::FLAG_CREATE_ALWAYS flag:

    C++
    // google_apis/common/base_requests.cc
    download_data->output_file.Initialize(
        download_data->output_file_path,
        base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
    
  3. Unsafe POSIX open() Flags: In base/files/file_posix.cc, FLAG_CREATE_ALWAYS is translated to O_CREAT | O_TRUNC (with O_WRONLY), but does not include O_NOFOLLOW:

    C++
    if (flags & FLAG_CREATE_ALWAYS) {
      open_flags = O_CREAT | O_TRUNC;
    }
    

Potential Attack Path (Theoretical Analysis)

Because the automated security tooling does not have the capability to execute code or verify runtime behavior, the following is a theoretical sequence of steps an attacker might follow to exploit this behavior:

  1. An attacker first obtains code execution within a sandboxed child process (such as the Network Process or GPU Process) on macOS.
  2. Both the unsandboxed browser process and the sandboxed child processes share access to the per-user temporary directory (_CS_DARWIN_USER_TEMP_DIR). The child processes have file-write* permissions (which allow unlink and symlink operations) on this directory.
  3. The attacker monitors the temporary directory for files conforming to the temporary template (e.g., .<bundle-id>.XXXXXX).
  4. Upon detection, the attacker unlinks the temporary file and creates a symbolic link at that path pointing to a sensitive file owned by the victim (for example, ~/.zshrc).
  5. When the browser process receives the download data stream, it opens the path via open(). Without O_NOFOLLOW, the kernel follows the symbolic link, leading to the truncation and overwrite of the target user file (~/.zshrc) with the downloaded content.

If the attacker controls the downloaded content (which is the case if they have compromised the Network Process and can spoof or modify response streams), they can achieve arbitrary code execution outside of the sandbox upon the next shell initiation.

Suggested Fix

To resolve this potential vulnerability, the file descriptor returned by the temporary file creation function should be retained and passed directly to the writer, avoiding any name-based re-opening. Alternatively, if name-based re-opening is necessary, the file must be opened using safety flags such as O_NOFOLLOW or the directory must be exclusive to the browser process and inaccessible to sandboxed child processes.

Evaluated with Chrome root at commit: b2fea2e31df308d0f04e4ae47def4c4f939ee141


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 temporary file's descriptor is closed and the path is later re-opened with O_CREAT | O_TRUNC but without O_NOFOLLOW, creating a time-of-check to time-of-use gap in a directory writable by sandboxed child processes.

Impact

If the attacker also controls the downloaded content, they could overwrite a user file and gain code execution outside the sandbox on the next shell start; the report notes this is a theoretical analysis that was not executed or verified.

What the attacker needed

Code execution in a sandboxed child process; macOS; shared writable temp directory; attacker controls download content

The fix

The file descriptor from temporary file creation should be kept and passed to the writer instead of re-opening by name, or the re-open should use O_NOFOLLOW and a directory not accessible to sandboxed processes.

How it was found

  1. Obtain code execution in a sandboxed child process on macOS.
  2. Rely on shared write access to the per-user temporary directory to unlink and symlink files.
  3. Watch the temporary directory for files matching the temporary template.
  4. Replace a detected temporary file with a symbolic link to a sensitive victim file.
  5. Wait for the browser process to open the path and follow the link, truncating and overwriting the target with downloaded content.

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 creates a temporary file, it normally keeps a handle to it so it can be sure it is writing to the same file later. Here the browser closed that handle and only remembered the file's name, then re-opened it by name after a network download. A symbolic link is a shortcut file that points at another file; if an attacker can replace the temporary file with such a shortcut, the browser writes through it into a file the attacker chose.

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.