CVE-2026-13944
Overview
Files Changed
content/browser/web_contents/web_contents_view_mac.mm
Patch
From e17437f50ac32f82f2b827de858588812bd3508f Mon Sep 17 00:00:00 2001 From: Avi Drissman <[email protected]> Date: Thu, 14 May 2026 18:39:02 -0700 Subject: [PATCH] Provide the correct filename for drag and drop When a user drops a file from a website into the Finder, it's possible that there is an existing file with the name in the drop location. In that case, while fulfilling the file drop promise, the function WebContentsViewMac::DragPromisedFileTo() will use the helper function content::CreateFileForDrop() to generate a new filename that is derived from the dropped filename, so there will be no conflict. This new file path is then returned to the caller. Psych! The out-parameter is set to the new filename, but then overwritten at the end of the function by the original value. The comment explaining this is double nonsense: it says that the value might have been overwritten, but the parameter is passed in by value, so it couldn't have been overwritten, and the value assigned is the old, incorrect value. Solve this by just removing this incorrect code. Fixed: 513224212 Link: https://chromium-review.googlesource.com/id/I5aaab231312ac4630c9a7220f04ce0c26a6a6964 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7849762 Auto-Submit: Avi Drissman <[email protected]> Commit-Queue: Bryan Oltman <[email protected]> Reviewed-by: Bryan Oltman <[email protected]> Cr-Commit-Position: refs/heads/main@{#1630982} --- diff --git a/content/browser/web_contents/web_contents_view_mac.mm b/content/browser/web_contents/web_contents_view_mac.mm index 712da37..2651e3e5 100644 --- a/content/browser/web_contents/web_contents_view_mac.mm +++ b/content/browser/web_contents/web_contents_view_mac.mm @@ -647,10 +647,6 @@ base::BindOnce(&PromiseWriterHelper, drop_data, std::move(file))); } - // The DragDownloadFile constructor may have altered the value of - // |*out_file_path| if, say, an existing file at the drop site has the same - // name. Return the actual name that was used to write the file. - *out_file_path = file_path; return true; }
Original Bug Report
Potential local file disclosure via drag-and-drop filename collision on macOS
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 Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A logic error in Chrome’s macOS drag-and-drop implementation causes the browser to return the original suggested filename to the OS even when a filename collision occurs and a suffixed file was created. This leads to drop target applications receiving and potentially processing or uploading pre-existing local files instead of the dragged content.
Affected files:
content/browser/web_contents/web_contents_view_mac.mmcontent/app_shim_remote_cocoa/web_drag_source_mac.mmcontent/browser/download/drag_download_util.cc
Estimated timestamp from git blame: 2019-03-05
Summary
In Chrome for macOS, a logic bug in the handling of ‘promised’ files during drag-and-drop operations leads to an incorrect file path being returned to the drop target application. When a filename collision occurs at the drop destination, Chrome correctly creates a new file with a suffixed name (e.g., file-1.ext) to avoid overwriting existing data. However, it incorrectly reports the original, pre-collision path (file.ext) to the receiving application. This can cause the drop target to process a pre-existing local file instead of the dragged web content.
Root Cause Analysis
The issue is located in WebContentsViewMac::DragPromisedFileTo within content/browser/web_contents/web_contents_view_mac.mm.
// content/browser/web_contents/web_contents_view_mac.mm
bool WebContentsViewMac::DragPromisedFileTo(
..., const base::FilePath& file_path, ...,
base::FilePath* out_file_path) {
*out_file_path = file_path; // (1)
...
base::File file(content::CreateFileForDrop(out_file_path)); // (2)
...
// The DragDownloadFile constructor may have altered the value of
// |*out_file_path| if, say, an existing file at the drop site has the same
// name. Return the actual name that was used to write the file.
*out_file_path = file_path; // (3) BUG
return true;
}
- At step (1), the output path is initialized to the requested path.
- At step (2),
content::CreateFileForDrop(incontent/browser/download/drag_download_util.cc) checks if a file exists at the destination. If it does, it generates a suffixed name (e.g.,file-1.ext), creates that file, and updates the pointerout_file_pathto the new path. - At step (3), line 653 explicitly overwrites
*out_file_pathwith the originalfile_pathprovided by the caller. This directly contradicts the preceding comment and ensures that the pre-collision path is returned to the Mojo caller (WebDragSourcein the app shim process).
WebDragSource then returns this incorrect path to the macOS system (AppKit), which provides it to the drop target application.
Potential Impact
An attacker (or a compromised renderer) can specify a suggested filename for a drag-and-drop operation using the downloadurl metadata. If a user drags this content to a directory already containing a file with that name, the drop target application will receive the path to the user’s pre-existing local file.
If the drop target is an application that immediately processes or uploads the file (such as an email client, a chat application, or a cloud storage upload field), the user may unintentionally disclose the contents of a local file to a third party. While the attacker does not receive the file directly, they can target high-probability filenames (e.g., Resume.pdf, id_card.png, passwords.csv) to increase the likelihood of a collision.
Suggested Reproduction Steps
Note: These steps are based on code analysis and have not been verified with a functional PoC.
- On macOS, ensure a file named
target_file.pdfexists in the Downloads folder. - Open Chrome and visit a page that initiates a drag-and-drop download using
dataTransfer.setData('downloadurl', ...)with the suggested nametarget_file.pdf. - Drag the item from the web page into the Downloads folder.
- Observe that Chrome creates
target_file-1.pdfin that folder (containing the dragged content). - If the drop target is another application (e.g., dragging into a website’s upload area in a different browser window or an electron app), check which file is processed. Due to the bug, the application is likely to receive the path to the original
target_file.pdfinstead oftarget_file-1.pdf.
Suggested Fix
Remove line 653 in content/browser/web_contents/web_contents_view_mac.mm to allow the updated out_file_path from CreateFileForDrop to be returned to the caller:
- *out_file_path = file_path;
Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e
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.