Open Bug 698252 Opened 15 years ago Updated 4 years ago

add tests to ensure that OCSP requests can't ever be affected by spdy/h2/alt-svc

Categories

(Core :: Security: PSM, defect, P3)

defect

Tracking

()

People

(Reporter: briansmith, Unassigned)

References

Details

(Whiteboard: [psm-backlog])

Assume that we connect to the OCSP responder site (https://ca.example.org) via HTTPS for some non-OCSP reason (e.g. to read the CP/CSP or whatever) and that response returned an HSTS header. Then, when we visit a site that uses that points to http://ca.example.org/ocsp-responder, we will rewrite that request as https://ca.example.org/ocsp-responder. However, it is likely that https://ca.example.org/ uses a certificate that also points https://ca.example.org/ocsp-responder for OCSP. I believe in the current code, this will cause an infinite loop. In order to support https:// OCSP/CRL URLs, we have to turn off OCSP/CRL fetching for some of the OCSP/CRL fetches if they would cause such an infinite loop. Usually our HTTP(S) stack directs HTTPS requests to an already-open HTTPS connection. We probably need a flag that we can add to each request that says "do not send this request to a HTTPS site that is blocked on certificate validation" that we could put on the OCSP/CRL requests. And, we probably need a flag that says "do not do OCSP/CRL fetching for this request" that we would put on the OCSP/CRL requests. (Maybe one flag could mean both things.) Or, maybe we need to explicitly *ignore* HSTS and/or Alternate-Protocol for OCSP/CRL requests and ALWAYS send them over HTTP.
(In reply to Brian Smith (:bsmith) from comment #0) > Or, maybe we need to explicitly *ignore* HSTS and/or Alternate-Protocol for > OCSP/CRL requests and ALWAYS send them over HTTP. For SPDY, one way of doing this would be to add a new request flag DISALLOW_SPDY to nsIRequest that maps to NS_HTTP_DISALLOW_SPDY (like LOAD_ANONYMOUS maps to NS_HTTP_LOAD_ANONYMOUS), and skip the Alternate-Protocol header check when this flag is set on the request. Similarly, we could have a DISALLOW_HTTPS flag for nsIRequest that would disable both HSTS rewriting HTTP -> HTTPS and Alternate-Protocol rewriting HTTP -> HTTPS (SPDY). Since this is easy to implement, I recommend we do this first, and then file a separate bug for enabling OCSP/CRL requests over HTTPS (HTTP or and/or SPDY over TLS).
patch 15 of 528288 https://bug528288.bugzilla.mozilla.org/attachment.cgi?id=570293 does something relevant. It adds a setallowspdy() at the channel level (nsIHttpChannelInternal) that sets NS_HTTP_DISALLOW_SPDY for all requrests on the channel. If that is set then alternate-protocol is ignored. The patch also sets allowspdy(false) on the channel that is used in nsNSSCallbacks The end result is alternate-protocol is ignored (at the cost of never using spdy) for ocsp/crl It doesn't solve anything for hsts or explicit https:// references - but it should at least keep us out of a spdy regression.
(In reply to Brian Smith (:bsmith) from comment #0) . Usually our HTTP(S) stack directs HTTPS requests to an > already-open HTTPS connection. We probably need a flag that we can add to > each request that says "do not send this request to a HTTPS site that is > blocked on certificate validation" that we could put on the OCSP/CRL > requests. It's coarse grained, but given the light use of CRL fetching you could do LOAD_FRESH_CONNECTION on it to avoid the blocking thing. (though you still need a way of doing the 'do not do crl fetching for this request' bit).
CRLs aren't relevant any more, but this still could be an issue with OCSP. :mcmanus - I thought this had been addressed in the HSTS case, but I can't identify any code that would do it - am I just misremembering? (Also I'm assuming Sid isn't actively working on this.)
Assignee: mozbugs → nobody
Flags: needinfo?(mcmanus)
Summary: Handle case where an OCSP responder and/or CRL distribution point URL is https:// and/or HSTS or Alternate-Protocol rewrite those requests from http:// to https:// → Handle case where HSTS or Alternate-Protocol rewrites http:// OCSP AIA requests to https://
Whiteboard: [psm-backlog]
(In reply to David Keeler [:keeler] (use needinfo?) from comment #5) > CRLs aren't relevant any more, but this still could be an issue with OCSP. > :mcmanus - I thought this had been addressed in the HSTS case, but I can't > identify any code that would do it - am I just misremembering? Bug 1003566?
comment 6 seems right
Flags: needinfo?(mcmanus)
Summary: Handle case where HSTS or Alternate-Protocol rewrites http:// OCSP AIA requests to https:// → Handle case where Alternate-Protocol rewrites http:// OCSP AIA requests to https://
what's the argument for disabling alt-svc? The subject line indicates the scheme is changed, but alt-svc never ever changes scheme.
Maybe I'm not understanding how alt-svc works, but couldn't it cause a request to http://example.com to be served via https://example.com, which would result in a certificate verification, which could result in an OCSP request to http://example.com (which would be weird, but assume it's the CA's website), which would be served over https://example.com, and so on?
(In reply to David Keeler [:keeler] (use needinfo?) from comment #10) > Maybe I'm not understanding how alt-svc works, but couldn't it cause a > request to http://example.com to be served via https://example.com, which > would result in a certificate verification, which could result in an OCSP > request to http://example.com (which would be weird, but assume it's the > CA's website), which would be served over https://example.com, and so on? we're both wrong :) alt-svc would never change http://example.com to be https://example.com.. it might change the internet host in the same way a DNS CNAME would (it can change the port too).. and it can even change the protocol version (i.e. to h2).. and indeed it can even use TLS.. but it will still be http://example.com. The origin never changes - that's the fundamental rule of alt-svc. (fwiw the bug title talks about Alternate-Protocol which is a chrome precursor to alt-svc.. we never implemented in gecko) but indeed, if it does use TLS that can lead to authentication which indeed gets at the problem described here. but you're saved, because we only implement alt-svc for services that speak spdy or h2 (because they carry the fully qualified URL to remove ambiguity) - and we already prohibit spdy/h2 for ocsp. I don't mind if you hack it in specifically, but it would be redundant. or we could just finally get rid of ocsp :) (please?)
Ok - great! Thanks for the explanation. Looks like we're in good shape. I couldn't find a test for this specific case, though, so I'll just morph this bug to that. It would be nice to remove OCSP, but I don't think we're quite in a position where we can, yet.
Summary: Handle case where Alternate-Protocol rewrites http:// OCSP AIA requests to https:// → add tests to ensure that OCSP requests can't ever be affected by spdy/h2/alt-svc
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.