This is a reasonable question to ask, because it's not immediately apparent why merely letting websites openingopen arbitrary file URLs is bad in the same way that letting websites readingread arbitrary file URLs is bad. Here's a summary:
A malicious website can read arbitrary files on disk by opening a
file://
URL if thefile://
URL points to a malicious HTML file on disk. Browsers and other applications sometimes cache untrusted HTML as a file on disk.Browsers don't always perfectly enforce the same-origin policy, and bugs in the same-origin policy can allow arbitrary file access if all
file://
URLs are considered to have the same origin.Some
file://
URLs can cause malicious effects just by allowing the browser to open them.
Here's the short answerlong-winded explanation with quoted sources:
So, to summarize:
Local files have greater privileges than remote files, so allowing remote Javascript to open local Javascript can allow for privilege escalation.
Browsers don't always perfectly enforce the same-origin policy, and bugs in the same-origin policy can allow arbitrary file access if all
file://
URLs are considered to have the same origin.Some
file://
URLs can cause malicious effects just by allowing the browser to open them.