Skip to content
Business logic Advisory Advanced CVE-2026-121237

Improper state validation in FileSystem (CVE-2026-121237)

Chrome's File System Access after-write check can be bypassed when a popup closes itself right after starting writer.close(), because the delayed UI-thread check can no longer reconstruct the popup's context and treats the result as UNKNOWN, which is mapped to allow. An attacker could then commit bytes that a blocking Safe Browsing verdict would otherwise have stopped.

Dwij Mehta Follow

Originally disclosed on Chrome VRP

Bounty$1,000 Medium View original
  • Fix shipped in 7 months

Report description

Popup teardown bypasses Chrome File System Access after-write checks


Bug location

Where do you want to report your vulnerability?

Chrome VRP – Report security issues affecting the Chrome browser. See program rules

Which URL (or repository) have you found the vulnerability in?

https://chromium.googlesource.com/chromium/src/+/2097a6d96e291bc93050efc9efe506c8e9d1b8b8


The problem

Please describe the technical details of the vulnerability

Vulnerability Description FileSystemWritableFileStream.close() can bypass Chrome's File System Access after-write protection when the popup that initiated the write tears itself down after close() starts but before the delayed UI-thread check reconstructs its missing context.

The issue is a lifetime and context-reconstruction flaw in the after-write pipeline:

  1. Blink sends the browser-side close IPC and returns a pending promise.
  2. FileSystemAccessFileWriterImpl::CloseImpl() marks close as pending and starts FileSystemAccessSafeMoveHelper.
  3. If the popup disconnects after that point, FileSystemAccessFileWriterImpl::OnDisconnect() does not abort the in-flight close path once is_close_pending() is true.
  4. FileSystemAccessSafeMoveHelper creates a FileSystemAccessWriteItem, but it does not snapshot the already-known browser_context or web_contents. It keeps file metadata, frame URL, outermost frame id, and related fields instead.
  5. ChromeFileSystemAccessPermissionContext::PerformAfterWriteChecks() defers the actual decision to a later UI-thread task.
  6. When that delayed task runs, PopulateFileSystemAccessWriteItemContext() tries to reconstruct context from frame_id.child_id.
  7. If the popup renderer is already gone, RenderProcessHost::FromID(...) is null, so the callback is invoked with DownloadCheckResult::UNKNOWN and returns early.
  8. That early UNKNOWN happens before either the forced-verdict branch or the normal Safe Browsing path can produce a blocking verdict, because both paths first call PopulateFileSystemAccessWriteItemContext().
  9. InterpretSafeBrowsingResult() maps UNKNOWN to allow.
  10. FileSystemAccessSafeMoveHelper::DidAfterWriteCheck(kAllow) then moves the swap file into the final destination and commits attacker-controlled bytes.

This is not a case where Chrome ignores a later-delivered real block verdict. If kBlock reaches DidAfterWriteCheck(), the write is aborted correctly. The flaw is that popup teardown can convert a pending after-write check into UNKNOWN, and UNKNOWN is currently treated as allow.

Attack Preconditions

  • The attacker can run script in a popup that uses the File System Access API.
  • The victim approves a destination file via showSaveFilePicker().
  • The popup can terminate itself or otherwise lose its renderer after starting writer.close() but before the delayed after-write task executes.
  • The pending after-write check is one that would otherwise block, such as a dangerous Safe Browsing verdict.

Reproduction Steps / POC

Target / product information:

  • Product: Chromium / Chrome browser
  • Verified revision: 2097a6d96e291bc93050efc9efe506c8e9d1b8b8
  • Binary used for validation: out/Test/chrome
  • PoC files: run_poc.sh, verify_fsa_after_write_puppeteer.js

Reproduction steps:

  1. Run the attached PoC against the tested Chromium binary:
Bash
./run_poc.sh /path/to/out/Test/chrome /path/to/node_modules/puppeteer-core
  1. The PoC starts a local HTTP server and runs two scenarios against the same browser binary:
    • stay: the popup remains alive and awaits writer.close()
    • close: the popup calls writer.close() and immediately closes itself
  2. Chromium is launched with the built-in test switches used to make the after-write decision deterministic:
    • --disable-popup-blocking
    • --codex-test-fsa-after-write-verdict=dangerous
    • --codex-test-fsa-after-write-delay-ms=3000
  3. In the baseline stay case, writer.close() is blocked and the destination file remains empty.
  4. In the close case, the popup renderer disappears before the delayed after-write task reconstructs context, the result is downgraded to UNKNOWN, and the file is committed with attacker-controlled contents.

Important PoC note:

  • On the validated build, the opener page is served from http://127.0.0.1:<port>/ and the popup is opened from http://localhost:<same-port>/popup?... on the same loopback server.
  • When I changed the popup URL to 127.0.0.1 as well, the bypass stopped reproducing and the file stayed empty.
  • My inference is that this host split helps move the popup into a renderer/process configuration where the late RenderProcessHost::FromID(frame_id.child_id) lookup fails.
  • This appears to be a reliable trigger detail for the PoC, not the root cause. The root cause is still the late context reconstruction plus UNKNOWN -> allow.

Observed reproduction output:

Text
Redacted sample log from a successful run:

Using chrome: out/Test/chrome
Serving opener on 127.0.0.1:<ephemeral-port> and popup on localhost:<same-port>
Destination file: <temporary-output-file>

Stay scenario:
{
  "result": {
    "mode": "stay",
    "type": "result",
    "ok": false,
    "name": "AbortError",
    "message": "Blocked by Safe Browsing."
  },
  "fileContents": ""
}

Close scenario:
{
  "fileContents": "PAYLOAD-CLOSE\n"
}

Result: bypass reproduced.

Impact analysis

A malicious website that can execute script in a popup can exploit this issue after the victim grants the normal File System Access file-selection permission via showSaveFilePicker().

The impact is a security-feature bypass and integrity issue in Chrome's File System Access protection flow. Data that Chrome's after-write checking path should block can still be written to the final user-selected destination if the attacker tears down the popup during the close flow. In the validated PoC, a write that is blocked when the popup stays alive is committed successfully when the popup closes immediately after starting writer.close().

This does not require winning a race against a later-delivered block verdict. The issue is that context loss during popup teardown downgrades a pending blocking check into UNKNOWN, and UNKNOWN is currently interpreted as allow.


The cause

What version of Chrome have you found the security issue in?

Chromium 148.0.7767.0

Is the security issue related to a crash?

No, it is not related to a crash.

Choose the type of vulnerability

Exploit Mitigation Bypass

How would you like to be publicly acknowledged for your report?

Dwij Mehta

The original report as published on the Chromium issue tracker, by Dwij Mehta. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 7 min read.

Context

Chrome's File System Access API lets a page ask the user to pick a destination file through showSaveFilePicker() and then write to it through a FileSystemWritableFileStream. Because the bytes land in a real file on the user's disk, Chrome runs an after-write check before the swap file is moved into the final destination. That check is where Safe Browsing verdicts and other policy decisions are applied, and a blocking verdict is supposed to stop the commit.

The report describes a bypass of that after-write protection in the FileSystem component, filed through the Chrome VRP against Chromium revision [redacted]. The researcher is Dwij Mehta, the issue is classified as an exploit mitigation bypass (improper state validation), and it was validated on Chromium 148.0.7767.0. It is not a crash.

The claim is narrow and specific: FileSystemWritableFileStream.close() can bypass the after-write protection when the popup that initiated the write tears itself down after close() starts but before the delayed UI-thread check reconstructs its missing context. The author is explicit that this is not a case of Chrome ignoring a real block verdict that arrives late. If kBlock reaches DidAfterWriteCheck(), the write is aborted correctly. The flaw is that popup teardown turns a pending check into UNKNOWN, and UNKNOWN is treated as allow.

Setup

The preconditions listed in the report are:

  • The attacker can run script in a popup that uses the File System Access API.
  • The victim approves a destination file via showSaveFilePicker().
  • The popup can terminate itself, or otherwise lose its renderer, after starting writer.close() but before the delayed after-write task executes.
  • The pending after-write check is one that would otherwise block, such as a dangerous Safe Browsing verdict.

Target and tooling details from the report:

Item Value
Product Chromium / Chrome browser
Verified revision [redacted]
Binary used for validation out/Test/chrome
Chrome version Chromium 148.0.7767.0
PoC files run_poc.sh, verify_fsa_after_write_puppeteer.js
Automation puppeteer-core

The PoC drives the browser with Puppeteer and launches Chromium with built-in test switches that make the after-write decision deterministic:

  • --disable-popup-blocking
  • --codex-test-fsa-after-write-verdict=dangerous
  • --codex-test-fsa-after-write-delay-ms=3000

The first switch disables popup blocking. The second forces the after-write verdict to a dangerous value, so the check should block. The third delays the after-write task by 3000 ms.

Finding it

The report describes the after-write pipeline: the context needed to make the decision is not captured when the write is queued. Instead, it is reconstructed later, on the UI thread, from a frame id. If the popup renderer is gone by then, the reconstruction fails and the code takes an early return that produces DownloadCheckResult::UNKNOWN. That early return happens before either the forced-verdict branch or the normal Safe Browsing path can produce a blocking verdict, because both of those paths first call PopulateFileSystemAccessWriteItemContext(). InterpretSafeBrowsingResult() then maps UNKNOWN to allow, and the swap file is moved into the final destination.

The asymmetry is clear: the same write is blocked when the popup stays alive, and committed when the popup closes immediately after starting writer.close(). The author also noticed that the bypass depended on how the popup was hosted, which is discussed under exploitation.

Exploitation

Step 1: run the PoC

The PoC is run against the tested Chromium binary with the path to puppeteer-core:

Bash
./run_poc.sh /path/to/out/Test/chrome /path/to/node_modules/puppeteer-core

The script starts a local HTTP server and runs two scenarios against the same browser binary:

  • stay: the popup remains alive and awaits writer.close()
  • close: the popup calls writer.close() and immediately closes itself

Chromium is launched with the three test switches listed above, so the verdict is forced to dangerous and the after-write task is delayed by 3000 ms.

Step 2: baseline, popup stays alive

In the stay case, writer.close() is blocked and the destination file remains empty. The observed output is:

Text
Stay scenario:
{
  "result": {
    "mode": "stay",
    "type": "result",
    "ok": false,
    "name": "AbortError",
    "message": "Blocked by Safe Browsing."
  },
  "fileContents": ""
}

The promise rejects with AbortError and the message Blocked by Safe Browsing., and fileContents is empty. This is the behaviour the protection is supposed to produce.

Step 3: popup tears itself down

In the close case, the popup calls writer.close() and immediately closes itself. The popup renderer disappears before the delayed after-write task reconstructs context, the result is downgraded to UNKNOWN, and the file is committed with attacker-controlled contents:

Text
Close scenario:
{
  "fileContents": "PAYLOAD-CLOSE\n"
}

The same write that was blocked in the baseline is now present in the destination file. The full run ends with:

Text
Result: bypass reproduced.

Step 4: the host split detail

On the validated build, the opener page is served from http://[redacted]:<port>/ and the popup is opened from http://localhost:<same-port>/popup?... on the same loopback server. When the researcher changed the popup URL to [redacted] as well, the bypass stopped reproducing and the file stayed empty.

The author's inference is that this host split helps move the popup into a renderer or process configuration where the late RenderProcessHost::FromID(frame_id.child_id) lookup fails. The report treats this as a reliable trigger detail for the PoC, not the root cause. The root cause remains the late context reconstruction plus UNKNOWN -> allow.

Root cause

The report lays out the sequence as a lifetime and context-reconstruction flaw in the after-write pipeline:

  1. Blink sends the browser-side close IPC and returns a pending promise.
  2. FileSystemAccessFileWriterImpl::CloseImpl() marks close as pending and starts FileSystemAccessSafeMoveHelper.
  3. If the popup disconnects after that point, FileSystemAccessFileWriterImpl::OnDisconnect() does not abort the in-flight close path once is_close_pending() is true.
  4. FileSystemAccessSafeMoveHelper creates a FileSystemAccessWriteItem, but it does not snapshot the already-known browser_context or web_contents. It keeps file metadata, frame URL, outermost frame id, and related fields instead.
  5. ChromeFileSystemAccessPermissionContext::PerformAfterWriteChecks() defers the actual decision to a later UI-thread task.
  6. When that delayed task runs, PopulateFileSystemAccessWriteItemContext() tries to reconstruct context from frame_id.child_id.
  7. If the popup renderer is already gone, RenderProcessHost::FromID(...) is null, so the callback is invoked with DownloadCheckResult::UNKNOWN and returns early.
  8. That early UNKNOWN happens before either the forced-verdict branch or the normal Safe Browsing path can produce a blocking verdict, because both paths first call PopulateFileSystemAccessWriteItemContext().
  9. InterpretSafeBrowsingResult() maps UNKNOWN to allow.
  10. FileSystemAccessSafeMoveHelper::DidAfterWriteCheck(kAllow) then moves the swap file into the final destination and commits attacker-controlled bytes.

The disconnect handler does not abort the in-flight close once is_close_pending() is true, and the decision path treats a missing context as UNKNOWN rather than as a block. The author stresses that a real kBlock reaching DidAfterWriteCheck() is handled correctly; the problem is the conversion of a pending check into UNKNOWN and the mapping of UNKNOWN to allow.

Impact

A malicious website that can execute script in a popup can exploit this after the victim grants the normal File System Access file-selection permission via showSaveFilePicker(). The impact is a security-feature bypass and an integrity issue in Chrome's File System Access protection flow: data that the after-write checking path should block can still be written to the final user-selected destination if the attacker tears down the popup during the close flow.

In the validated PoC, a write that is blocked when the popup stays alive is committed successfully when the popup closes immediately after starting writer.close(). The author notes that this does not require winning a race against a later-delivered block verdict; the downgrade to UNKNOWN is what does the work.

Fix

The report does not describe a fix or a patch. What it points at is the design decision it identifies as the root cause: the after-write check reconstructs context late from frame_id.child_id instead of snapshotting the already-known browser_context and web_contents when the FileSystemAccessWriteItem is created, and a failed reconstruction yields UNKNOWN, which InterpretSafeBrowsingResult() maps to allow. Whether the fix snapshots the context, aborts the close path on disconnect, or treats UNKNOWN as a block is not stated in the report.

  • Snapshot versus reconstruction: look for other deferred checks that rebuild context from a frame or process id on a later task instead of capturing it at queue time. A positive result is a check that changes outcome when the originating frame or renderer is torn down before the task runs.
  • UNKNOWN handling: enumerate every place a result enum is mapped to a decision and check what UNKNOWN maps to. A positive result is an UNKNOWN that resolves to allow on a path that is supposed to block.
  • Disconnect during pending close: test other writer or stream implementations where OnDisconnect() has an is_close_pending() style guard. A positive result is a commit that survives the disconnect when the same write is blocked while the renderer stays alive.
  • Host split trigger: reproduce the PoC with the opener and popup on different loopback hostnames and then on the same one. A positive result is the bypass reproducing only in the split configuration, which points at a process or renderer placement dependency in the late lookup.
  • Timing window: vary the delay between writer.close() and popup teardown, and vary the after-write delay. A positive result is a window in which the teardown lands after the close is marked pending but before the delayed task runs.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 15 min read.

What happened, in plain words

Chrome has a feature that lets a website save a file to your computer, but only after you personally pick where the file should go. Before Chrome actually puts the bytes into that file, it runs a safety check. If the check says the content is dangerous, Chrome is supposed to throw the write away and leave your file empty.

This report shows a way around that safety check. A malicious page opens a small popup window, gets you to approve a save location, starts writing, and then makes the popup vanish at exactly the right moment. When the popup is gone, Chrome can no longer work out the details it needs to make the safety decision, so it ends up with an answer of "unknown". And "unknown" is currently treated the same as "allowed". The dangerous file gets written anyway.

The researcher is Dwij Mehta. The issue was filed through the Chrome VRP, which is Google's bug bounty programme for Chrome: a scheme where people who find security problems report them and can receive a reward. It was validated on Chromium 148.0.7767.0, at revision [redacted]. It is not a crash.

A few words you will meet throughout, explained once here:

  • API (Application Programming Interface): a set of commands a program offers so other programs can use it. Think of a restaurant menu: you do not go into the kitchen, you order from the list and the kitchen does the work.
  • File System Access API: the menu Chrome offers to websites for reading and writing real files on your disk, always with your permission.
  • Renderer: the part of the browser that runs a web page's code. Each tab or popup usually gets its own, kept separate from the rest of the browser so a bad page cannot easily damage anything else.
  • UI thread: the browser's main worker that handles things the user can see and interact with. Work sent there happens in order, one task at a time.
  • Verdict: the safety decision, for example "block this" or "allow this".
  • Exploit mitigation bypass: a weakness that does not break anything by itself but gets around a protection that was put in place to stop attacks.

The claim in the report is narrow. It is not that Chrome ignores a real "block" answer that arrives late. If a block verdict reaches the final decision point, the write is correctly aborted. The flaw is that tearing down the popup turns a still-pending check into "unknown", and "unknown" is treated as permission to go ahead.

Context

When a page uses the File System Access API, it first calls showSaveFilePicker(). That is the moment you see the normal save dialog and choose a destination file yourself. Only after you approve does the page get a FileSystemWritableFileStream, an object it can push bytes into.

Because those bytes end up in a real file on your disk, Chrome does not write straight to the destination. It writes to a temporary file first, sometimes called a swap file, and runs an after-write check. That check is where Safe Browsing verdicts and other policy decisions are applied. Safe Browsing is Google's service that flags dangerous content. If the verdict is "block", the temporary file is supposed to be discarded and the destination stays untouched.

The report describes a bypass of exactly that protection, in the FileSystem component of Chromium (the open-source project Chrome is built from).

Setup

The report lists four preconditions, meaning things that must be true before the attack works:

  • The attacker can run script in a popup that uses the File System Access API.
  • The victim approves a destination file via showSaveFilePicker().
  • The popup can terminate itself, or otherwise lose its renderer, after starting writer.close() but before the delayed after-write task executes.
  • The pending after-write check is one that would otherwise block, such as a dangerous Safe Browsing verdict.

In plain terms: the bad page needs a popup it controls, you need to click through the normal save dialog, the popup needs to be able to close itself at the right moment, and the content being written needs to be something the safety check would normally stop.

Target and tooling details from the report:

Item Value
Product Chromium / Chrome browser
Verified revision [redacted]
Binary used for validation out/Test/chrome
Chrome version Chromium 148.0.7767.0
PoC files run_poc.sh, verify_fsa_after_write_puppeteer.js
Automation puppeteer-core

A revision is a specific saved state of the source code, identified by a long string of letters and numbers. A binary is the compiled program you actually run. A PoC, short for proof of concept, is a small demonstration that proves the problem is real. Puppeteer is a tool that drives a browser automatically, like a robot pressing buttons, so the test can run without a human.

The PoC launches Chromium with built-in test switches that make the after-write decision predictable:

  • --disable-popup-blocking
  • --codex-test-fsa-after-write-verdict=dangerous
  • --codex-test-fsa-after-write-delay-ms=3000

A switch (also called a flag) is an extra instruction typed on the command line when starting a program, changing how it behaves. These three are test-only switches built into this Chromium build:

  1. --disable-popup-blocking disables popup blocking.
  2. --codex-test-fsa-after-write-verdict=dangerous forces the after-write verdict to a dangerous value, so the check should block.
  3. --codex-test-fsa-after-write-delay-ms=3000 inserts a 3000 millisecond (three second) delay before the after-write task runs.

Finding it

The report describes the after-write pipeline: the information needed to make the safety decision is not captured when the write is queued. Instead it is rebuilt later, on the UI thread, from a frame id. A frame id is a number that identifies a particular page or sub-page inside the browser.

If the popup's renderer is gone by the time the rebuild happens, the rebuild fails, and the code takes an early exit that produces DownloadCheckResult::UNKNOWN. That early exit happens before either the forced-verdict branch or the normal Safe Browsing path can produce a blocking verdict, because both of those paths first call PopulateFileSystemAccessWriteItemContext(). Then InterpretSafeBrowsingResult() maps UNKNOWN to allow, and the temporary file is moved into the final destination.

The asymmetry is clear: the very same write is blocked when the popup stays alive, and committed when the popup closes immediately after starting writer.close(). The author also noticed the bypass depended on how the popup was hosted, which is covered under exploitation.

Exploitation

Step 1: run the PoC

The PoC is run against the tested Chromium binary, with the path to puppeteer-core as the second argument:

Bash
./run_poc.sh /path/to/out/Test/chrome /path/to/node_modules/puppeteer-core

Line by line:

  • ./run_poc.sh runs a shell script in the current folder. A shell script is a text file of commands the computer executes in order.
  • /path/to/out/Test/chrome is where the Chromium program to be tested lives. The /path/to/ part is a placeholder for wherever it actually sits on the tester's machine.
  • /path/to/node_modules/puppeteer-core is where the Puppeteer library is installed, so the script can drive the browser.

The script starts a local HTTP server and runs two scenarios against the same browser binary:

  • stay: the popup remains alive and awaits writer.close()
  • close: the popup calls writer.close() and immediately closes itself

A local HTTP server is a small web server running on the tester's own machine, serving pages to the browser as if it were a real website. Running two scenarios against the same binary is a controlled comparison: the only difference between them is whether the popup stays or goes, so any difference in outcome can be attributed to that.

Chromium is launched with the three test switches listed above, so the verdict is forced to dangerous and the after-write task is delayed by 3000 ms.

Step 2: baseline, popup stays alive

In the stay case, writer.close() is blocked and the destination file remains empty. The observed output is:

Text
Stay scenario:
{
  "result": {
    "mode": "stay",
    "type": "result",
    "ok": false,
    "name": "AbortError",
    "message": "Blocked by Safe Browsing."
  },
  "fileContents": ""
}

Line by line:

  • Stay scenario: is a label printed by the script so you know which of the two runs follows.
  • "mode": "stay" records which scenario produced this result.
  • "type": "result" says this block is the outcome of the operation.
  • "ok": false means the write did not succeed.
  • "name": "AbortError" is the kind of error the page received. An error name is a short label the browser uses to say what went wrong.
  • "message": "Blocked by Safe Browsing." is the human-readable explanation: the safety check stopped it.
  • "fileContents": "" shows the destination file is empty, because nothing was committed.

This is the behaviour the protection is supposed to produce. It is the baseline: proof that, under normal conditions, the block works.

Step 3: popup tears itself down

In the close case, the popup calls writer.close() and immediately closes itself. The popup renderer disappears before the delayed after-write task rebuilds its context, the result is downgraded to UNKNOWN, and the file is committed with attacker-controlled contents:

Text
Close scenario:
{
  "fileContents": "PAYLOAD-CLOSE\n"
}

Line by line:

  • Close scenario: labels the second run.
  • "fileContents": "PAYLOAD-CLOSE\n" shows what ended up in the destination file. PAYLOAD-CLOSE is the attacker's marker text, and \n is a newline character. The file is no longer empty.

The same write that was blocked in the baseline is now present in the destination file. The full run ends with:

Text
Result: bypass reproduced.

That final line is the script's own summary: the protection was bypassed.

Step 4: the host split detail

On the validated build, the opener page is served from http://[redacted]:<port>/ and the popup is opened from http://localhost:<same-port>/popup?... on the same loopback server. When the researcher changed the popup URL to [redacted] as well, the bypass stopped reproducing and the file stayed empty.

Some background helps here. [redacted] and localhost both point at your own machine, the so-called loopback address, but they are different hostnames. A port is a numbered door on a machine that a server listens on, and <port> is a placeholder for whichever number the script picked. The opener is the page that opens the popup.

The author's inference is that this host split helps move the popup into a renderer or process configuration where the late RenderProcessHost::FromID(frame_id.child_id) lookup fails. In plain words: the host split may place the popup in a renderer or process configuration where the late lookup comes up empty. The report treats this as a reliable trigger detail for the PoC, not the root cause. The root cause remains the late context rebuild plus UNKNOWN -> allow.

Root cause

The report lays out the sequence as a lifetime and context-reconstruction flaw in the after-write pipeline. "Lifetime" here means how long an object or process stays alive; "context" means the surrounding information needed to make a decision, such as which browser profile and which page the write belongs to.

  1. Blink sends the browser-side close IPC and returns a pending promise. Blink is the part of Chrome that turns web page code into browser actions. An IPC (inter-process communication) is a message passed between separate parts of the browser. A promise is a placeholder object a page gets back immediately, which will later resolve to success or failure.
  2. FileSystemAccessFileWriterImpl::CloseImpl() marks close as pending and starts FileSystemAccessSafeMoveHelper. The :: notation means "this function belongs to this class", a class being a bundle of related code.
  3. If the popup disconnects after that point, FileSystemAccessFileWriterImpl::OnDisconnect() does not abort the in-flight close path once is_close_pending() is true. In other words, the disconnect handler deliberately leaves an already-started close alone.
  4. FileSystemAccessSafeMoveHelper creates a FileSystemAccessWriteItem, but it does not snapshot the already-known browser_context or web_contents. It keeps file metadata, frame URL, outermost frame id, and related fields instead. To snapshot means to copy a value at that moment so it cannot change later. browser_context is the browser profile context and web_contents is the page object; both were known at this point but were not copied.
  5. ChromeFileSystemAccessPermissionContext::PerformAfterWriteChecks() defers the actual decision to a later UI-thread task. Deferring means putting the work on a queue to run later rather than right now.
  6. When that delayed task runs, PopulateFileSystemAccessWriteItemContext() tries to rebuild context from frame_id.child_id. child_id identifies the particular frame within the process.
  7. If the popup renderer is already gone, RenderProcessHost::FromID(...) is null, so the callback is invoked with DownloadCheckResult::UNKNOWN and returns early. RenderProcessHost is the browser-side handle for a renderer process; FromID looks one up by number, and null means nothing was found.
  8. That early UNKNOWN happens before either the forced-verdict branch or the normal Safe Browsing path can produce a blocking verdict, because both paths first call PopulateFileSystemAccessWriteItemContext().
  9. InterpretSafeBrowsingResult() maps UNKNOWN to allow.
  10. FileSystemAccessSafeMoveHelper::DidAfterWriteCheck(kAllow) then moves the swap file into the final destination and commits attacker-controlled bytes.

The existing defences did not stop it for two reasons: the disconnect handler deliberately leaves an in-flight close alone once is_close_pending() is true, and the decision path treats a missing context as UNKNOWN rather than as a block. The author stresses that a real kBlock reaching DidAfterWriteCheck() is handled correctly. The problem is the conversion of a pending check into UNKNOWN and the mapping of UNKNOWN to allow.

Impact

A malicious website that can execute script in a popup can exploit this after the victim grants the normal File System Access file-selection permission via showSaveFilePicker(). The impact is a security-feature bypass and an integrity issue in Chrome's File System Access protection flow. Integrity here means the file's contents can be changed when they should not be. Data that the after-write checking path should block can still be written to the final user-selected destination if the attacker tears down the popup during the close flow.

In the validated PoC, a write that is blocked when the popup stays alive is committed successfully when the popup closes immediately after starting writer.close(). The author notes that this does not require winning a race against a later-delivered block verdict. A race would mean trying to be faster than the check; here the downgrade to UNKNOWN is what does the work, so timing against the verdict is not the mechanism.

Fix

The report does not describe a fix or a patch. What it points at is the design decision it identifies as the root cause: the after-write check rebuilds context late from frame_id.child_id instead of snapshotting the already-known browser_context and web_contents when the FileSystemAccessWriteItem is created, and a failed rebuild yields UNKNOWN, which InterpretSafeBrowsingResult() maps to allow. Whether the fix snapshots the context, aborts the close path on disconnect, or treats UNKNOWN as a block is not stated in the report.

  • Snapshot versus reconstruction: look for other deferred checks that rebuild context from a frame or process id on a later task instead of capturing it at queue time. A positive result is a check that changes outcome when the originating frame or renderer is torn down before the task runs.
  • UNKNOWN handling: enumerate every place a result enum is mapped to a decision and check what UNKNOWN maps to. An enum is a fixed list of named values, like a set of labelled buttons. A positive result is an UNKNOWN that resolves to allow on a path that is supposed to block.
  • Disconnect during pending close: test other writer or stream implementations where OnDisconnect() has an is_close_pending() style guard. A positive result is a commit that survives the disconnect when the same write is blocked while the renderer stays alive.
  • Host split trigger: reproduce the PoC with the opener and popup on different loopback hostnames and then on the same one. A positive result is the bypass reproducing only in the split configuration, which points at a process or renderer placement dependency in the late lookup.
  • Timing window: vary the delay between writer.close() and popup teardown, and vary the after-write delay. A positive result is a window in which the teardown lands after the close is marked pending but before the delayed task runs.

Glossary

  • API: a set of commands one program offers so other programs can use it, like a menu you order from.
  • After-write check: the safety check Chrome runs on written bytes before moving them from a temporary file into the destination file.
  • Binary: the compiled program you actually run.
  • Blink: the part of Chrome that turns web page code into browser actions.
  • Browser context: the browser profile context a page belongs to.
  • Bug bounty: a programme that rewards people for reporting security problems.
  • Chrome VRP: Google's Vulnerability Reward Program for Chrome.
  • Class: a bundle of related code and the functions that belong to it.
  • Context: the surrounding information needed to make a decision, such as which profile and page a write belongs to.
  • CVSS: a standard scoring system for the severity of security issues; the platform records no score for this report.
  • Deferred task: work put on a queue to run later rather than immediately.
  • Enum: a fixed list of named values.
  • Exploit mitigation bypass: a weakness that gets around a protection meant to stop attacks, without breaking anything by itself.
  • File System Access API: the Chrome feature that lets websites read and write real files with the user's permission.
  • Frame id: a number identifying a particular page or sub-page inside the browser.
  • Integrity: the property that data has not been changed when it should not have been.
  • IPC: inter-process communication, a message passed between separate parts of the browser.
  • Local HTTP server: a small web server running on the tester's own machine.
  • Loopback address: an address such as [redacted] or localhost that points back at your own machine.
  • Opener: the page that opens a popup.
  • PoC: proof of concept, a small demonstration that proves a problem is real.
  • Port: a numbered door on a machine that a server listens on.
  • Promise: a placeholder object returned immediately that later resolves to success or failure.
  • Puppeteer: a tool that drives a browser automatically.
  • Renderer: the part of the browser that runs a page's code, usually one per tab or popup.
  • Revision: a specific saved state of source code, identified by a long string.
  • Safe Browsing: Google's service that flags dangerous content.
  • Severity: how serious an issue is judged to be; recorded here as medium.
  • Shell script: a text file of commands the computer executes in order.
  • Snapshot: a copy of a value taken at a moment in time so it cannot change later.
  • Swap file: the temporary file Chrome writes to before committing to the final destination.
  • Switch (flag): an extra instruction on the command line that changes how a program behaves.
  • Verdict: the safety decision, for example block or allow.
  • Web contents: the browser-side object representing a page.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.