Trouble with OCSP

This is a post about side channel information leak present in OnionBrowser OCSP requests. This post omits a lot of details about OCSP protocol.

Digital certificates usually have long expiration, to reduce maintenance overhead. Most of the cases CAs issue a certificate for few years.

But what are we to do when a certificate is compromised? We can re-issue a certificate, but compromised certificate is still in the wind. Online Certificate Status Protocol (OCSP) is designed to help with this exact situation. It defines a way to check validity of a certificate in a timely1 manner.

OCSP2 works roughly as follows in an https connection:

  1. Client looks up the OCSP responder server from AuthorityInfoAccess section in the certificate.
  2. Client crafts a OCSP request and sends it to OCSP responder (server provided by the CA).
  3. Responder returns the current status of the certificate, one of good, revoked or unknown

Note: There are many other interactions defined in the OCSP ecosystem. Maybe the most important one is OCSP Stapling. In stapling the original request server sends back OCSP validation message with the certificate itself, removing the need for another seperate request.

Dissecting an OCSP Request

If the request is less than 255 bytes, OCSP allows it to be passed as a GET path. A typical request looks like this

The request is URL-Encoded > BASE64 encoded > ASN-1 data. After decoding, one can use ocsptool from GnuTLS to read it.

.. and then lookup the cert parameter s

Privacy Takes a Backseat.

Careful examination of above workflow will reveal that the OCSP flow is happening over HTTP. With the above dissecting example, an attacker will know that it is highly probable that user is accessing https://check.torproject.org.

Most issuers seem to stick to http; possibly to avoid cyclical dependencies. This means man-in-the-middle leakage of certificates a user is validating is happening, and by extension leakage of websites user is accessing.

Onion Browser

iOS has inbuilt mechanism for checking revocations. They seem to be only enforced for EV certificates though. This is not a bad thing at all, but it creates a weird situation where it leaks urls with EV certs from Onion Browser. Semi-Official (as far as I can tell) Tor browser on iOS.

Whenever Onion Browser accesses a website with EV cert, (for e.g https://check.torproject.com), the OCSP request is routed via regular transport, not via onion network as one would assume.

An attacker observing network can see any of the OCSP requests, and thus know a subset of sites user is visiting, even if they are on Tor.

A weird detail is that the .onion endpoint of NYTimes has an EV certificate. The ocsp request for it is send via plain transport and gets leaked, if you were using OnionBrowser to access it.

I stumbled upon this accidently while inspecting requests from my iPhone with mitmproxy. The bug was reported to Onion Browser team and they have a nice write up of the situation. Unfortunately, it is hard to fix. :-(

Many thanks to @konarkmodi for helping me verify my findings and reviewing this post.


  1. Opposed to checking against a Certificate Revocation List.

  2. Familiar readers will note that this is plain OCSP, the non-stapling kind.