Spoof URL by connecting to an invalid port with a setTimeout call in the originating tab
Categories
(Fenix :: General, defect)
Tracking
(firefox83 wontfix, firefox84 fixed, firefox85 fixed)
People
(Reporter: u635660, Unassigned)
References
Details
(Keywords: csectype-spoof, sec-moderate, Whiteboard: [adv-main84+])
Attachments
(2 files, 2 obsolete files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36
Steps to reproduce:
go to https://servicenger.com/t.html
click me
click ok
and then Facebook is spoofed
Actual results:
facebook.com is spoofed
Expected results:
it should not spoof
Comment 2•4 years ago
|
||
Amedyne can we find someone who knows the toolbar to look at this?
I can't reproduce this on GVE, and in fact we never get a facebook.com
URL at all in onLocationChange()
. It's critical that Fenix only displays URLs delivered via onLocationChange()
in the toolbar.
Sorry, we do eventually get a https://www.facebook.com:1234/
in onLocationChange()
once the connection times out and we get an error. That's expected.
Comment 6•4 years ago
|
||
I'm looking into it
Updated•4 years ago
|
Comment 7•4 years ago
•
|
||
First, we are getting an OPEN WindowRequest
, which adds a new tab and dispatches an AddTabAction
through the SessionManager
. The AddTabAction
uses toTabSessionState
which codifies the initial URL (the Facebook URL) as the tab truth in the ContentState
.
It then selects that tab, and since the tab has been selected and state changed, the ToolbarPresenter
renders the new URL.
I propose removing the Android-Components Session
initialUrl
argument altogether, because it sounds like we should never be trusting URLs we pass in from our side. We should trust the onLocationChange
callbacks after attempting a load of the initial URL.
Adding Sebastian from AC for feedback.
Comment 8•4 years ago
|
||
This seems to be related to us hiding the initial load of about:blank
, that Gecko does:
https://github.com/mozilla-mobile/android-components/blob/master/components/browser/engine-gecko-nightly/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineSession.kt#L436-L441
We did this to workaround issues with about:blank
appearing briefly in the toolbar, looking like a UI glitch.
In this situation here, the page actually injects content into that about:blank
page and the load of facebook.com:1234
takes quite a while to timeout. If we'd stop suppressing the about:blank
update then Fenix would behave like desktop and we'd display about:blank
in the URL bar until the timeout, where we switch to facebook.com:1234
and show the error page. However that would potentially re-introduce the UI glitch. Unfortunately we do not seem to be able to distinguish between the initial about:blank
load and the state where there's actually content getting injected. As a potential workaround for this we could try disabling the about:blank
check for sessions that have a parent. That may be the smallest possible patch?
(In reply to Emily Kager [:ekager] from comment #7)
I propose removing the Android-Components
Session
initialUrl
argument altogether, because it sounds like we should never be trusting URLs we pass in from our side. We should trust theonLocationChange
callbacks after attempting a load of the initial URL.
Separating the "initial url to load" from the "content url" is an option too. But it will have a ripple effect on a lot of things and potentially cause regressions. I would like to look at all the options before this "heart surgery". :)
I started to look into Fennec source.. it doesn't reproduce in Fennec and we always have a URL for the tab - without the UI glitch happening afaik. Curious how this was solved there.
Comment 9•4 years ago
|
||
If we'd stop suppressing the about:blank update then Fenix would behave like desktop and we'd display about:blank in the URL bar until the timeout, where we switch to facebook.com:1234 and show the error page.
There are some edge cases where this does introduce other undesired behaviors (like showing about:blank
when manually entering a URL and staying on about:blank
when stopping the load).
Comment 10•4 years ago
|
||
There might be an easier solution after all. This problem only exists when opening a new window (link with a target), where we set the URL of the new tab to the given URL immediately. There's absolutely no need to do this, since we are not initiating the load - Gecko(View) does it.
Christian wrote WindowFeature and we looked at the various scenarios and this seems to be a viable option. I'll attach a patch for discussion.
Comment 11•4 years ago
|
||
Updated•4 years ago
|
Updated•4 years ago
|
Comment 12•4 years ago
|
||
Preserving testcase in case the reporter's server goes away.
Updated•4 years ago
|
Comment hidden (obsolete) |
Updated•4 years ago
|
Comment 15•4 years ago
|
||
Comment 16•4 years ago
|
||
Updated•4 years ago
|
Updated•4 years ago
|
Updated•2 years ago
|
Description
•