OCSP requests leak cookies

RESOLVED FIXED in mozilla18



Security: PSM
6 years ago
5 years ago


(Reporter: st3fan, Unassigned)



Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(Not tracked)



(1 attachment)



6 years ago
During testing of some OCSP server side code I saw Firefox do the following OCSP request:

Host: evsecure-ocsp.verisign.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Content-Length: 115
Content-Type: application/ocsp-request
Cookie: v1st=YX32X24T8E9X; __utma=136232671.83772523.1; __utmz=1369032.23772523.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)

What worries me is that the Cookie header is included.

I think this is a security problem because because it is identifying me to the owner of the OCSP server.

Not only does the owner of the OCSP server now know what site I am visiting (through the SSL certificate hash in the OCSP request body), it can also identify me.

This can be further exploited by OCSP server owners by somehow getting cookies setup for the domain. For example by embedding ads. (I know this is a stretch but it is certainly possible)

Since these OCSP requests are basic API requests, I think they should be as minimal as possible, which means leaving out any headers that are not required. In my opinion that should also include the User-Agent header.
Component: Security → Security: PSM
QA Contact: toolkit → psm
OS: Mac OS X → All
Hardware: x86 → All
Created attachment 538159 [details] [diff] [review]
wild guess

I don't know that this is the right fix, but it seems to be the only place where NSS code creates a necko channel (via trySendAndReceiveFcn, which is certainly used by PKIX OCSP code). Also it's untested :)
Attachment #538159 - Flags: feedback?(kaie)
Stefan, do you know what the STR are? I was not able to reproduce this, even after visiting several URLs on verisign.com and then going to paypal.com.

Gavin, thanks for the patch. I will take a look at it once I am able to reproduce the bug.
Keywords: privacy

Comment 3

6 years ago

Go to http://www.verisign.com
Browse around for example change to another language
Validate that a cookie has been set
Quit Firefox (to force OCSP since I don't think it is fully cached?)
Go to https://twitter.com

Go to http://www.godaddy.com
Validate that a cookie has been set (should be for godaddy.com)
Quit Firefox (to force OCSP since I don't think it is fully cached?)
Go to https://sa.tk (my domain that has a godaddy cert)

It might be easier to enable ocsp.require but you don't have to.
Attachment #538159 - Flags: feedback?(bsmith)

Comment 4

6 years ago
I did this:
- enable strict ocsp
- start debug build with NSPR_LOG_MODULES="cookie:5"
- go to verisign (gets a cookie)
- quit firefox
- start firefox
- go to https://twitter.com
- look at trace output, search for ocsp,
  a cookie was sent for an ocsp request

I agree we should not do this.

I applied the patch, and I repeated the above.
I no longer see a cookie being sent to the ocsp server.

Comment 5

6 years ago
Comment on attachment 538159 [details] [diff] [review]
wild guess


Gavin, thanks for this patch. Do you want to take the bug and drive it in, or should we?
Attachment #538159 - Flags: superreview+
Attachment #538159 - Flags: review?(bsmith)
Attachment #538159 - Flags: feedback?(kaie)
Attachment #538159 - Flags: feedback?(bsmith)
Attachment #538159 - Flags: feedback+
I can take the bug, though I'm not really familiar with the test situation for this code. Are there any automated OCSP tests that a test for this bug could easily be added to?
Comment on attachment 538159 [details] [diff] [review]
wild guess


Unfortunately, we don't have any automated tests for OCSP in Firefox--partly because we don't have any way of generating OCSP responses. Kai's manual test procedure will have to do for now.
Attachment #538159 - Flags: review?(bsmith) → review+


6 years ago
Keywords: checkin-needed
Please do NOT add the checkin-needed keyword in the future for patches without metadata.

I took a guess as to what that should be in this case, but next time I'll just remove the keyword...
Assignee: nobody → gavin.sharp
Flags: in-testsuite?
Keywords: checkin-needed

Comment 10

6 years ago
Ok, thanks a lot Boris!
Sorry - I intended to land this myself, I just forgot about it.
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Blocks: 703020
Blocks: 703024
Duplicate of this bug: 703020
No longer blocks: 703020
This was backed out in bug 703024.
Assignee: gavin.sharp → nobody
Resolution: FIXED → ---
Target Milestone: mozilla8 → ---


5 years ago
Duplicate of this bug: 786229

Comment 16

5 years ago
Can we apply Gavin's patch again now that the dependencies for this bug have been resolved?

I still think this is a major privacy concern: CAs can effectively use this to track someone.
Yeah, looks like bug 627616 means that the old patch should work as-is (it won't affect proxy authentication).
I relanded this
Target Milestone: --- → mozilla18
This looks suspicious:

     1.1 --- a/security/manager/ssl/src/nsNSSCallbacks.cpp
     1.2 +++ b/security/manager/ssl/src/nsNSSCallbacks.cpp
     1.3 @@ -72,16 +72,18 @@ nsHTTPDownloadEvent::Run()
     1.4    nsCOMPtr<nsIChannel> chan;
     1.5    ios->NewChannel(mRequestSession->mURL, nullptr, nullptr, getter_AddRefs(chan));
     1.6    NS_ENSURE_STATE(chan);
     1.8    // Disabled because it breaks authentication with a proxy, when such proxy
     1.9    // had been setup, and brings blue UI for EV certs.
    1.10    // chan->SetLoadFlags(nsIRequest::LOAD_ANONYMOUS);
    1.12 +  chan->SetLoadFlags(nsIRequest::LOAD_ANONYMOUS);

The comment seems to be outdated by the fix in bug 627616 and thus should be removed, shouldn't it?
comment removed

Last Resolved: 6 years ago5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.