News for hackers. Stuff that matters.

Ask HN: How Did My ISP MITM a TLS Connection to the Pirate Bay?

When I opened https://thepiratebay.se/ today, I got a blank page. Looking at the source revealed something rather suspicious (slightly reformatted, and removed identifiers):

  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0"/>
  <style>body{margin:0px;padding:0px;}iframe{width:100%;height:100%}</style>
  <iframe src="http://{isp-ip}:8080/webadmin/deny/index.php?dpid=1&dpruleid=3&cat={some-id}&ttl=0&groupname=-&policyname=-&username=-&userip={my-ip}8&connectionip=127.0.0.1&nsphostname=Policy03-Chennai&protocol=policyprocessor&dplanguage=-&url=http%3a%2f%2fthepiratebay%2ese%2f" width="100%" height="100%" frameborder=0></iframe>
Here {isp-ip} belongs to my ISP, Airtel (it falls inside the IP range 182.64.0.0 - 182.79.255.255, which belongs to them).

The certificate returned for thepiratebay.se (belonging to Cloudflare) was in perfect order, so how could my ISP MITM this connection? Just to be sure that this is indeed an MITM, I checked this URL on the wayback machine, and this is what I got: http://imgur.com/77tbMqy. Nothing wrong here, no trace of the above code.

Here's the certificate that is returned to me: https://gist.github.com/anonymous/f01e495cf89de7c72684ebb368cac81b

The cipher suite used is TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256.

Is one of Cloudflare or Pirate Bay acting in connivance with Airtel to return the strange response above?

Asssuming that's not the case, what else could have happened? A closer look at the certificate reveals a lot of DNS names under the certificate subject alt name:

  Not Critical
  DNS Name: sni33780.cloudflaressl.com
  DNS Name: *.beeeeer.org
  DNS Name: *.durst.io
  DNS Name: *.messedupquotes.com
  DNS Name: *.ohhai.xyz
  DNS Name: *.thepiratebay.se
  ...
(see the certificate above for the complete list)

If my ISP controls one of the domains in this list, could it have carried out a successful attack without Cloudflare's help?

( 4 comments | 19 points | on HN )
Re:Ask HN: How Did My ISP MITM a TLS Connection to the Pirat... by lightlyused on Friday April 22, 2016 @09:49PM (#11553726)
According to this, the domain name is send unencrypted in the initial handshake request. http://security.stackexchange.com/questions/86723/why-do-htt...
Re:Ask HN: How Did My ISP MITM a TLS Connection to the Pirat... by snug on Friday April 22, 2016 @06:34PM (#11553007)
> If my ISP controls one of the domains in this list, could it have carried out a successful attack without Cloudflare's help?

No they cannot.

CloudFlare hold the private keys to those certificates. Did you visit the iFrame source directly? Doesn't really see like much tbh.

Re:Ask HN: How Did My ISP MITM a TLS Connection to the Pirat... by tls-intercepted on Friday April 22, 2016 @07:02PM (#11553131)
The iframe says:

"Your requested URL has been blocked as per the directions received from Department of Telecommunications, Government of India. Please contact administrator for more information."

Interestingly, since the iframe source is on http rather than https, browsers refuse to load it. So users to this site end up seeing a blank page, which was probably not what the ISP intended.

Re:Ask HN: How Did My ISP MITM a TLS Connection to the Pirat... by thesmileyone on Friday April 22, 2016 @11:53PM (#11554087)
You could get a seedbox for your torrents, and use it as a tunnel to browse the torrent sites?