Insufficient validation of untrusted input in UI (CVE-2026-7992)
Chromium failed to escape the percent character in URLs when creating Linux desktop shortcuts, allowing an attacker to inject the %c field code. A crafted page title with double quotes could break out of shell quoting and inject arbitrary command-line flags, potentially leading to sandbox escape and remote code execution.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 34 days
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: When creating a desktop shortcut on Linux, Chromium fails to escape the % character in the URL used for the .desktop file's Exec key. An attacker can craft a URL containing the %c XDG field code and a specially crafted page title with double quotes to break out of shell quoting. When the user launches the shortcut, the Linux desktop environment expands %c to the malicious title, allowing the injection of arbitrary command-line flags (e.g., --gpu-launcher) and leading to a potential sandbox escape and RCE.
Affected files:
chrome/browser/shell_integration_linux.cc
Estimated timestamp from git blame: 2024-05-01
Description
In chrome/browser/shell_integration_linux.cc, the function GetDesktopFileContentsForUrlShortcut constructs the contents of a .desktop file for a web page. The page's URL is included in the Exec key, and the page's title is used for the Name key.
While the URL is quoted using QuoteCommandLineForDesktopFileExec, the % character is not escaped. According to the XDG Desktop Entry Specification, %c is a field code that expands to the Name of the application (the page title). Notably, another function in the exact same file, SetActionsForDesktopApplication, correctly anticipates this by explicitly escaping % as %% (see chrome/browser/shell_integration_linux.cc:251), but this protection is missing in the URL-shortcut path.
Impact
Because field code expansion happens before shell argument parsing in standard Linux launchers (like those using GLib's g_shell_parse_argv), an attacker can supply a title containing double quotes to break out of the URL's quoting context. This allows the injection of arbitrary Chromium command-line flags. By injecting flags such as --gpu-launcher, an attacker can achieve a potential sandbox escape and Remote Code Execution (RCE) with the user's privileges.
Potential Reproduction Steps
(Note: These are suggested steps to trigger the vulnerability, as our automated tooling cannot run local exploit code to provide a verified working proof of concept.)
- Host a malicious page at
https://evil.example/?q=%c. The inclusion of the?character is required because it forces Chromium'sQuoteArgForDesktopFileExecto wrap the URL in double quotes. - Set the document title to
A" --gpu-launcher="xcalc" "B. - Convince a Linux user to visit the page and select Save and Share -> Create Shortcut... from the Chrome menu.
- When the user accepts the prompt, Chromium writes the
.desktopfile to disk. Because%is unescaped, theExecline will look similar to:Exec=/opt/google/chrome/chrome --profile-directory=Default "https://evil.example/?q=%c" - When the victim launches the shortcut from their application menu, the Linux launcher expands the
%cmacro using theNamekey (the attacker's title). The expanded execution string becomes:... "https://evil.example/?q=A" --gpu-launcher="xcalc" "B" - The launcher parses the string into an argument array. The injected double quotes perfectly close the URL's quotes, causing
--gpu-launcher=xcalcto be parsed as a separate, distinct command-line flag. - Chromium launches, and the unsandboxed browser process applies the
--gpu-launcherflag, executingxcalc(or any other attacker-specified binary/script) outside the sandbox.
Suggested Fix
Apply the same % escaping logic used in SetActionsForDesktopApplication to GetDesktopFileContentsForUrlShortcut. Specifically, before the URL is appended to the base::CommandLine and passed to QuoteCommandLineForDesktopFileExec, you should escape % characters:
std::string launch_url_str = url.spec();
// Escape % as %% to prevent XDG field code expansion.
RE2::GlobalReplace(&launch_url_str, "%", "%%");
This ensures that literal % characters in the URL are parsed correctly by the Linux desktop environment and not interpreted as field codes.
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 URL-shortcut creation code did not escape the percent character, so the XDG field code %c expanded to the attacker-controlled page title before shell argument parsing.
Impact
An attacker could potentially escape the sandbox and execute arbitrary code with the user's privileges, though the report notes the reproduction steps are suggested and not verified.
What the attacker needed
Linux desktop environment; victim visits malicious page; victim creates a shortcut; victim launches the shortcut
The fix
The fix should escape percent characters in the URL before it is written to the desktop file, using the same logic already present in another function in the same file.
How it was found
- Host a malicious page whose URL contains a percent-c field code and whose title includes double quotes and a command-line flag.
- Convince a Linux user to visit the page and choose the option to create a shortcut.
- The user accepts the prompt and Chromium writes a .desktop file with the unescaped URL.
- When the user launches the shortcut, the Linux launcher expands the field code using the malicious title.
- The injected double quotes break out of the URL quoting, so the extra flag is parsed as a separate command-line argument.
- Chromium starts with the injected flag, which can execute an attacker-specified program outside the sandbox.
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 web page as a desktop shortcut on Linux, Chromium writes a small file that tells the system how to open that page. The report says Chromium did not properly clean up special characters in the web address, so a malicious page could trick the system into running extra commands when you click the shortcut. This could let an attacker run their own programs on your computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.