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

Inappropriate implementation in Chrome for iOS (CVE-2026-17822)

A time-of-check to time-of-use race condition in Chrome for iOS download finalisation allows two concurrent downloads with the same server-chosen filename to resolve to the same destination path, so one file silently overwrites the other. An attacker could exploit this to substitute a legitimate downloaded file with a malicious one.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 2 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 in the finalization of iOS downloads within Chrome. Due to path resolution and file moving being split across non-atomic operations and multiple thread hops, concurrent downloads with identical server-chosen names can select the same target path. Consequently, one download can silently overwrite the other via POSIX rename semantics, leading to content substitution.

Affected files:

  • ios/chrome/browser/download/model/download_file_service.mm
  • ios/chrome/browser/download/model/download_manager_tab_helper.mm
  • ios/chrome/browser/download/model/download_directory_util.mm
  • ios/chrome/browser/download/model/download_file_service_factory.mm

Estimated timestamp from git blame: 2025-04-16

Potential Security Vulnerability: TOCTOU in iOS Download Finalization

We have identified a potential Time-of-Check to Time-of-Use (TOCTOU) vulnerability in the download finalization pipeline of Chrome on iOS. When multiple downloads with identical server-specified filenames complete concurrently in different tabs, they can resolve to the exact same destination file path. Due to POSIX rename() semantics, the second file move silently overwrites the first, leading to silent content substitution.

Root Cause Analysis

When a download completes on iOS Chrome, DownloadManagerTabHelper drives finalization using a series of asynchronous callbacks hopping between the main thread and the background sequenced runner file_task_runner_ belonging to the profile's DownloadFileService instance.

Specifically, the path-uniquification step checks for destination existence using base::PathExists, but it does not reserve or lock the path. Because the pipeline is split across five thread hops before the actual move occurs, a significant race window exists:

  1. Main Thread: OnDownloadUpdated(kComplete) $\rightarrow$ MaybeMoveDownloadToDownloadsDirectory initiates filename resolution via ResolveAvailableFilePath(user_download_path, base_file_name) (ios/chrome/browser/download/model/download_manager_tab_helper.mm, line 402).
  2. Hop 1 (Main Thread $\rightarrow$ Background Runner): ResolveAvailableFilePath posts FindAvailableDownloadFilePath to file_task_runner_.
  3. Background Runner: FindAvailableDownloadFilePath (ios/chrome/browser/download/model/download_file_service.mm, line 125) checks if /Documents/file_name.pdf exists. Since it does not exist yet, it returns this path.
  4. Hop 2 (Background Runner $\rightarrow$ Main Thread): Returns to main thread callback UseAvailableUserDocumentsPath (line 308).
  5. Main Thread: UseAvailableUserDocumentsPath stores the target path in task_final_file_path_ and calls CheckFileExists to ensure the source temporary file still exists (line 317).
  6. Hop 3 (Main Thread $\rightarrow$ Background Runner): CheckFileExists posts a task to the background runner.
  7. Background Runner: Evaluates base::PathExists(source_path).
  8. Hop 4 (Background Runner $\rightarrow$ Main Thread): Returns to main thread callback MoveToUserDocumentsIfFileExists.
  9. Main Thread: Calls MoveDownloadFile (line 332).
  10. Hop 5 (Main Thread $\rightarrow$ Background Runner): Posts DoMoveFileOnBackgroundThread to file_task_runner_.
  11. Background Runner: Runs DoMoveFileOnBackgroundThread (line 100), calling base::Move which uses rename() under the hood on POSIX (base/files/file_util_posix.cc, line 1496).

If two concurrent tabs download files that resolve to the same server-chosen name, both will execute the FindAvailableDownloadFilePath check (Step 3) before either has executed the actual move (Step 11). Thus, both will independently resolve to the same destination path, and the second move operation will silently overwrite the first.

Potential Attack Scenario

An attacker could potentially exploit this behavior via the following steps:

  1. The attacker hosts a page that concurrently initiates two downloads: a victim-requested download of a legitimate file (e.g., invoice.pdf from victim.com) and an attacker-controlled file with the same filename (invoice.pdf from attacker.com).
  2. Due to the multi-hop timing window, both downloads resolve to /Documents/invoice.pdf during path resolution.
  3. The attacker's download completes and moves into place, or completes second and overwrites the legitimate file's content.
  4. The legitimate download's UI card shows completion and points to /Documents/invoice.pdf as its target. When the user taps "Open" or shares the file from the trusted context, they will access the attacker's payload instead.

Note: These are suggested/potential steps; our tooling does not currently have the ability to execute code to produce an active Proof of Concept.

Suggested Fix

To remediate this issue, path resolution and file moving should be performed atomically on the background thread. Alternatively, when FindAvailableDownloadFilePath determines a path is available, it should immediately reserve it (e.g., by creating an empty placeholder file using O_CREAT | O_EXCL flags) before returning the path to the main thread. This ensures that any subsequent path-existence checks for concurrent downloads will detect the conflict and select a unique filename (e.g., invoice (1).pdf).

Evaluated with Chrome root at commit: 5133b93d189b383c37805b1cf3a9d2dbfe8d7379


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 path-uniquification check and the file move are not atomic and are separated by multiple thread hops, so two concurrent downloads can both see the same path as available and then both move to it.

Impact

An attacker could cause a user to open or share a malicious file instead of the legitimate file they intended to download, leading to content substitution.

What the attacker needed

Victim visits attacker's page; two concurrent downloads with same filename; user opens or shares the downloaded file

The fix

Path resolution and file moving should be performed atomically on the background thread, or the path should be immediately reserved (e.g., by creating an empty placeholder file with exclusive create flags) before returning it to the main thread.

How it was found

  1. The attacker hosts a page that concurrently initiates two downloads: a legitimate file and an attacker-controlled file with the same filename.
  2. Both downloads resolve to the same destination path during path resolution due to the multi-hop timing window.
  3. The attacker's download completes and moves into place, or completes second and overwrites the legitimate file's content.
  4. The legitimate download's UI card shows completion and points to the overwritten file; when the user opens or shares it, they access the attacker's payload.

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 download a file, the browser checks if a file with that name already exists and then later moves the new file into place. If two downloads happen at the same time, both can check before either moves, so they pick the same name and one overwrites the other. An attacker could use this to replace a file you downloaded from a trusted site with their own malicious file.

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.