Race condition in FileSystem (CVE-2026-93380)
A race condition in the File System Access API allows a compromised renderer to bypass Safe Browsing checks by writing a malicious payload after an empty file has been hashed but before it is moved to its final location. An attacker could deliver malware to a user-approved location.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 6 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 without the security team.
Overview: A potential Time-of-Check Time-of-Use (TOCTOU) race condition exists in FileSystemAccessFileWriterImpl when handling Mojo IPCs from a compromised renderer. An attacker can initiate a Safe Browsing hash check on an empty file while asynchronously writing a malicious payload to it before the file is finalized. This completely bypasses the Safe Browsing after-write protection, allowing malware delivery to user-approved locations.
Affected files:
content/browser/file_system_access/file_system_access_file_writer_impl.cccontent/browser/file_system_access/file_system_access_safe_move_helper.ccchrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
Estimated timestamp from git blame: 2025-08-22
Vulnerability Summary
There is a potential Time-of-Check Time-of-Use (TOCTOU) race condition in FileSystemAccessFileWriterImpl that allows a compromised renderer to bypass Safe Browsing "after-write" checks.
When a renderer calls Close(), the browser immediately initiates a Safe Browsing check (computing the file's hash) via FileSystemAccessSafeMoveHelper. However, CloseImpl does not wait for pending Write operations to complete. By sending a Write IPC with an open but empty Mojo data pipe immediately followed by a Close IPC, an attacker can trick the browser into calculating a safe hash for an empty file. While the Safe Browsing network request is in flight, the attacker can stream a malicious payload into the data pipe, writing it to the swap file. When the "SAFE" verdict for the empty file returns, the now-malicious swap file is moved to its final destination.
Note: These steps are based on static code analysis by an AI tooling agent; we do not yet have a working proof-of-concept to run.
Potential Attacker Steps
- Compromise Renderer: An attacker gains code execution in the renderer process (e.g., via a v8 exploit).
- Obtain Write Access: The renderer triggers a
showSaveFilePicker()prompt. The user approves it, granting write access to a target location (e.g.,C:\Users\User\Downloads\target.exe). - Create Empty Data Pipe: The compromised renderer creates a Mojo data pipe. It deliberately keeps the producer handle open but writes zero bytes into it.
- Send Write IPC: The renderer sends a
Write(offset=0, stream=<data_pipe_consumer>)IPC toFileSystemAccessFileWriterImpl. - Write Dispatch: In the browser,
WriteImpldispatches aWriteStreamoperation to the IO thread. Thestorage::FileWriterDelegatefinds the pipe empty, returnsMOJO_RESULT_SHOULD_WAIT, and arms amojo::SimpleWatcherto wait for data. The swap file on disk is still 0 bytes. - Send Close IPC (The Race): Immediately after the
WriteIPC, the renderer sends aClose()IPC. - Premature Hash Calculation:
CloseImplexecutes on the UI thread. It fails to check for pending writes and immediately startsFileSystemAccessSafeMoveHelper. On the IO thread,HashCalculatoropens the 0-byte swap file, computes an empty hash, and sends it to Safe Browsing. - Payload Delivery: While the Safe Browsing network request is pending, the renderer writes its malicious executable payload into the open Mojo data pipe.
- Write Completion: The
FileWriterDelegate's watcher fires, reads the malicious payload, and writes it directly to the active swap file. - Bypass Success: The Safe Browsing service evaluates the empty hash and returns a "SAFE" verdict.
FileSystemAccessSafeMoveHelperproceeds to move the swap file (which now contains malware) to the user's final chosen destination.
Relevant Code
content/browser/file_system_access/file_system_access_file_writer_impl.cc:242-273-CloseImplstartsFileSystemAccessSafeMoveHelperwithout checking or waiting for pendingWriteStatecompletions.content/browser/file_system_access/file_system_access_safe_move_helper.cc:70-144-HashCalculatorconcurrently reads the file while theFileWriterDelegatemight still be asynchronously waiting for Mojo data.
Suggested Fix
Modify FileSystemAccessFileWriterImpl to track the number of active, pending write and truncate operations. CloseImpl should not synchronously instantiate and start FileSystemAccessSafeMoveHelper if there are pending operations. Instead, it should set a flag or callback and defer the Safe Browsing checks and the subsequent swap file replacement until the last pending write operation successfully completes (i.e., when DidWrite is called with complete=true and the pending operation count reaches zero).
Evaluated with Chrome root at commit: ff3d2b74fa39431785bd60e51463b08fcc71ee33
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.
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 CloseImpl method starts the Safe Browsing check without waiting for pending write operations to complete, allowing a write to occur after the hash is computed.
Impact
A compromised renderer could bypass Safe Browsing after-write protection and deliver malware to a user-approved location.
What the attacker needed
Compromised renderer; user approves save file prompt
The fix
The fix should make CloseImpl wait for all pending write operations to complete before starting the Safe Browsing check and moving the file.
How it was found
- Compromise the renderer process to gain code execution.
- Trigger a save file picker and get user approval for write access.
- Create a Mojo data pipe and keep the producer handle open without writing data.
- Send a Write IPC with the empty data pipe.
- Immediately send a Close IPC to start the Safe Browsing check.
- While the check is pending, write the malicious payload into the data 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 file through a web app, the browser checks it for malware. This report found a timing flaw: the browser can check an empty file, then the attacker quickly writes malware into it before the check finishes, so the malware gets saved without being scanned. It requires the attacker to already control the web page's code and the user to approve a save.
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.