This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients martin.panter, ned.deily, orsenthil, yao zhihua
Date 2018-03-12.00:35:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1520814901.81.0.467229070634.issue32993@psf.upfronthosting.co.za>
In-reply-to
Content
Hi Yao, I tend to agree with Ned. The support for “file:” URLs is by design. I don’t see any security problems. I suggest to close this.

In Issue 11662, it was decided that a web server redirecting to a “file:” URL was a security problem. This is because the mechanism that follows the redirect is automatic, and the target of the redirect is under the control of the remote server, not the local user or program. But other parts of the Python library still support “file:” URLs without causing any problems. Those URLs are under control of the caller, like in your “poc.py” file.

The /etc/passwd file may be readable by ordinary users. But /etc/shadow may require special permission to read, because it holds password hashes. Or it may not exist under that name, depending on the OS. If a web application calls “urllib.request.urlopen”, I think it is up to the application to validate the URL it passes. It may want to deny or limit access to specific directories, URL schemes, host names, etc. It is not up to Python to make those decisions.

When I tried your “webbrowser.open” demonstration, it made Firefox offer to “download” (i.e. copy) the “ls” executable file. I think this is normal behaviour, and does not indicate a security problem. A plausible use-case would be opening a local README.html file distributed with a program in a web browser.
History
Date User Action Args
2018-03-12 00:35:01martin.pantersetrecipients: + martin.panter, orsenthil, ned.deily, yao zhihua
2018-03-12 00:35:01martin.pantersetmessageid: <1520814901.81.0.467229070634.issue32993@psf.upfronthosting.co.za>
2018-03-12 00:35:01martin.panterlinkissue32993 messages
2018-03-12 00:35:01martin.pantercreate