QR code scanner allows opening non-HTTP URLs
Categories
(Fenix :: General, defect)
Tracking
(firefox94 wontfix, firefox95 wontfix, firefox96 fixed)
People
(Reporter: jwkbugzilla, Assigned: royang)
Details
(Keywords: sec-moderate, Whiteboard: [adv-main96+])
Attachments
(2 files, 2 obsolete files)
6.12 KB,
patch
|
csadilek
:
review+
|
Details | Diff | Splinter Review |
285 bytes,
text/plain
|
Details |
As implemented right now, QR code scanner imposes no restrictions on the URL scheme. As I understand the logic under https://github.com/mozilla-mobile/fenix/blob/d702af5a536f3a0040980acbaba4b0ca40c9c06e/app/src/main/java/org/mozilla/fenix/search/SearchDialogFragment.kt#L423, the same restrictions are imposed here as on manually entered URLs. This means no javascript:
URLs, but privileged URLs like about:config
are allowed. These pages are considered not safe to be opened by websites due to potential vulnerabilities, but QR codes can currently open them.
There is also lack of URL normalization (see bug 1691472), so the confirmation message displayed cannot be considered sufficient protection.
Comment 1•4 years ago
|
||
I thought this was already a bug we fixed once?! maybe that was fennec and we reproduced the bug in fenix.
most of our about: urls are safe enough, but there are a couple (and always risks for more) that take parameters that would allow for mischief. Also same for resource: urls.
Reporter | ||
Comment 2•4 years ago
|
||
I did test resource:
URLs, they don’t load here (and neither when entered manually).
Comment 3•4 years ago
•
|
||
I did test resource: URLs, they don’t load here (and neither when entered manually).
Yes, we block loads of resource://
, content://
and file://
URIs in general: https://github.com/mozilla-mobile/android-components/blob/master/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineSession.kt#L152
So those shouldn't load via the QR scanner either. We should still limit to just http(s) for the scanner.
Comment 5•3 years ago
•
|
||
OK I verified that using LOAD_FLAGS_EXTERNAL
fixes this problem (and a host of other ones). Unfortunately, EXTERNAL
is not the default as I thought. We maybe should consider switching the default so you have to pass in LOAD_FLAGS_INTERNAL
for example for internal page loads, instead of the other way around.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 6•3 years ago
|
||
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 7•3 years ago
|
||
Comment 8•3 years ago
|
||
Comment 9•3 years ago
|
||
If you pass the external flag you shouldn't be able to load javascript:
URIs, so the http/https check is redundant (mentioning in case you see something else in your testing).
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 10•3 years ago
|
||
Comment 11•3 years ago
|
||
If you pass the external flag you shouldn't be able to load
javascript:
URIs, so the http/https check is redundant (mentioning in case you see something else in your testing).
Yes, the external flag is working fine and already landed. So the page load is already prevented. This patch here is to improve the user experience, as we would otherwise still open a tab for those invalid URLs...not load it but still display it.
Comment 12•3 years ago
|
||
Assignee | ||
Comment 13•3 years ago
•
|
||
Fix merged in Fenix Nightly with https://github.com/mozilla-mobile/fenix/pull/22268
Assignee | ||
Updated•3 years ago
|
Updated•3 years ago
|
Comment 14•3 years ago
|
||
Is this something we wanted to backport to v95 or should it ride 96?
Assignee | ||
Comment 15•3 years ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM] from comment #14)
Is this something we wanted to backport to v95 or should it ride 96?
This will just ride the v96 train. The critical fix is already in v94 and v95. This fix is just UI feedback to the user. Thanks,
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Comment 16•3 years ago
|
||
Updated•3 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Description
•