Closed Bug 1373582 Opened 7 years ago Closed 7 years ago

Firefox applies HSTS to ftp and "upgrades" it to https

Categories

(Core Graveyard :: Networking: FTP, defect)

53 Branch
defect
Not set
normal

Tracking

(firefox56 fixed)

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: tom, Assigned: dragana)

Details

(Whiteboard: [necko-next])

Attachments

(2 files, 2 obsolete files)

User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0
Build ID: 20170526184742

Steps to reproduce:

Visited https://sourceware.org/ and then tried to download ftp://sourceware.org/pub/valgrind/valgrind-3.13.0.tar.bz2.


Actual results:

The browser tried to load https://sourceware.org/pub/valgrind/valgrind-3.13.0.tar.bz2 instead, which is not a functional link.


Expected results:

It should have loaded ftp://sourceware.org/pub/valgrind/valgrind-3.13.0.tar.bz2 as requested.
Further tested by using "forget this site" on sourceware.org, after which the ftp link works correctly until I visit https://sourceware.org/ again.

All using the Fedora build of Firefox 53.0.3 on Fedora 25.
Attached image screenshot.jpg
WFM with FF54 on Win 7.

Are you able to reproduce it with a new profile?
https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles
Flags: needinfo?(tom)
Component: Untriaged → Location Bar
I am able to reproduce it with a clean profile yes. I started firefox with a new, clean, profile and loaded the ftp link then the https link and then when I tried to load the ftp link again it converted it to https and 404ed.
WFM with FF53.0.2 on Fedora 25.
Tom, are you using some outgoing web proxy by any chance?
Yes I am, and disabling it stops this happening ;-)
Flags: needinfo?(tom)
Just a warning - the https version of the link now works because sourceware.org have mapped that directory to the web root.
So this is apparently not a ff issue, but some proxies might not implement HSTS correctly?

Note that since a short while ago sourceware now mirrors ftp://sourceware.org/pub/ at https://sourceware.org/pub/ to help people that get such incorrect redirects (making it not a good example of this bug anymore).
No it's still a bug I think, it's just that because it is proxied firefox is seeing it as an http request when it decides whether to apply the HSTS upgrade, but using the HSTS status of the target host to upgrade an http connection to a proxy doesn't seem right.
Component: Location Bar → Networking: FTP
Product: Firefox → Core
Assignee: nobody → dd.mozilla
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Whiteboard: [necko-next]
Attached patch bug_1373582.patch (obsolete) — Splinter Review
"When establishing an HTTP connection to a given host, however
 instigated, the UA examines its cache of Known HSTS Hosts to see if
 there are any with domain names that are superdomains of the given
 host's domain name. ..."
Attachment #8881958 - Flags: review?(mcmanus)
even better..

https://tools.ietf.org/html/rfc6797#section-8.3
Whenever the UA prepares to "load" (also known as "dereference") any
   "http" URI [RFC3986] (including when following HTTP redirects
   [RFC2616]), the UA MUST first determine whether a domain name is
   given in the URI and whether it matches a Known HSTS Host, using
   these steps:
Comment on attachment 8881958 [details] [diff] [review]
bug_1373582.patch

Review of attachment 8881958 [details] [diff] [review]:
-----------------------------------------------------------------

I think you need both sts priming and regular sts - ProcessSingleSecurityHeader() drives the latter.
Attachment #8881958 - Flags: review?(mcmanus) → review-
Attached patch bug_1373582.patch (obsolete) — Splinter Review
Attachment #8881958 - Attachment is obsolete: true
Attachment #8882032 - Flags: review?(mcmanus)
Comment on attachment 8882032 [details] [diff] [review]
bug_1373582.patch

Review of attachment 8882032 [details] [diff] [review]:
-----------------------------------------------------------------

you can skip the call to secureupgrade.. with that r+
Attachment #8882032 - Flags: review?(mcmanus) → review+
Attachment #8882032 - Attachment is obsolete: true
Attachment #8882054 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/28661214cd0c
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: