Skip to content
Naked Security Naked Security

Serious Security: China Internet Network Information Center in TLS certificate blunder

TLS certificates are very important. In fact, you could say they are the cornerstone of online security, especially for e-commerce. So we thought we'd use a story about a recent certificate security blunder to remind you why...

TLS certificates are very important.

So we thought we’d use a story about a recent certificate security blunder to remind you why.

TLS stands for Transport Layer Security; it used to be called SSL, for Secure Sockets Layer.

It’s the internet security protocol that puts the padlock in your browser’s address bar when you type https://, among much else.

(A lot of people still talk about “SSL” and “SSL certificates”, in the same way that English speakers in countries that use kilometres still say things like, “Your mileage may vary.”)

The idea is that TLS provides all of the following security features:

  1. Confidentiality. At the start, each end agrees securely on an encryption key for the rest of the session. You can’t eavesdrop that key by “sniffing” the network, so the contents of the entire session remain secret.
  2. Integrity. Each chunk of data exchanged in the session is digitally signed so that it can’t be tampered with along the way.
  3. Authenticity. The website identifies itself up front by presenting a cryptographically-signed digital certificate.

Point 3, as you can probably imagine, requires more than just a certificate presented by the server.

In fact, TLS involves what’s known as a chain of trust.

The certificate sent by the server needs to be vouched for by a sequence of ever-more-trustworthy certificates, ending in a certificate that is explicitly trusted by your operating system or browser.

Otherwise, any server could state that it was nakedsecurity.sophos.com (or any other server, for that matter) and you would have no way of knowing whether it was an imposter.

Visualising the chain of trust

Generally speaking, TLS traffic is signed by a digital certificate that identifies the company that owns the website you’re connecting to.

That certificate is signed, or vouched for, by a Certificate Authority (CA), and that CA’s identity is pre-programmed into your operating system or browser as a “trusted advisor.”

For example, when you visit Naked Security using Firefox on OS X 10.10, you should see something like this:

Naked Security’s certificate is owned by Sophos; Sophos’s right to represent itself as Naked Security is vouched for by GlobalSign; and GlobalSign’s right to vouch for Sophos is vouched for by Firefox.

Web filtering

You hit a bit of a snag if you’re a network administrator who wants to filter HTTPS web traffic, for example to block booby-trapped web sites or to catch malware downloads.

Because you are the network administrator, and you control the network, it’s usually fairly easy to intercept your organisation’s web traffic.

You can use what’s known as a proxy server between your users’ browsers and the websites they’re connecting to (that’s where this approach gets the name Man-in-The-Middle, or MiTM).

That works for HTTP, but it’s not enough for snooping on HTTPS, thanks to Point 1 above: the contents are encrypted end-to-end in each direction.

Although your proxy can see that there’s a conversation going on, you have no idea if the traffic contains kitten photos or data-stealing malware.

What you have to do is to decrypt the traffic coming from the user before it leaves your network, and then re-encrypt it by making your own onward HTTPS connection to the server at the other end:

As a result, the data is briefly unencrypted inside your web filter, so you can examine and analyse it.

Of course, that messes up Point 3 above, because your web filter has to come up with a temporary digital certificate that it can send to the user’s browser, pretending to identify itself as the destination server.

And that bogus certificate won’t be signed by a recognised CA, so (by default at least), your users’ browsers will throw up a warning:

Finessing the chain of trust

The right way to get around MiTM TLS warnings of this sort is to act as your own CA.

You create a CA certificate of your own, which you load into your web filter so it can “mint” temporary digital certificates in the names of other people’s websites, purely for filtering purposes.

You then explicitly configure the operating systems and browsers inside your organisation to trust your own web filter’s CA certificate.

That way, if any temporary man-in-the-middle certificates happen to leak out of your organisation, no-one else’s browser will trust them, so they will be no more use to a crook than fake certificates that he signed himself.

In real life, however, getting all of your users’ computers to trust your web filter may end up being quite a lot of work, depending on your security readiness.

Different procedures are needed for different browsers and operating systems.

So the sneaky approach to getting your own organisation to trust your web filter is to make the whole world trust it in one go.

This “wrong way” involves persuading a root CA – a CA that is already trusted by everybody’s browser – to sign a so-called intermediate CA certificate for you.

Usually, you use an intermediate certificate to run a CA business, which goes something like this:

  • Customers ask you to sign website TLS certificates.
  • You do some sort of due diligence to check up on the applicants’ identities.
  • You check that they really do own the website names they are asking you to certify.
  • You sign their certificates and send them back.
  • The customers’ certificates are immediately and widely trusted.

The last point works because there is a chain of trust from the customers’ certificates you just signed, through you, through the root CA, to most browsers in the world.

Organisations that sign TLS certificates clearly aren’t supposed to do so automatically or in bulk, since they are supposed to be vouching for the identity of the customers for whom they are signing.

Of course, if you were to upload your new and powerful intermediate CA certificate into your web filter instead, any temporary certificates it created while your users browsed would be trusted right away.

And that’s the “overkill way” of getting your web filter trusted inside your organisation without further effort.

Clearly, you shouldn’t be giving this sort of power to your web filter, because its only reason for signing temporary TLS certificates is to suppress inconvenient SSL warnings amongst your own users.

If crooks got hold of one of those fake certificates, for example by hacking into your web filter, they could suppress “inconvenient” warnings too, on just about any computer in the world, to help them with phishing or malware distribution.

Web filters shouldn’t be trusted with intermediate CA certificates, and that, quite simply, is that.

It happened again

Back at the end of 2013, we wrote about a crisis of confidence caused by temporary digital certificates generated by a web filter run by no less an organisation than the French Treasury.

The Treasury acquired an intermediate certificate for its web filter from the French Public Service Infrastructure Trust Management group (ICG/A); because ICG/A was on most browsers’ already-trusted list, this had the paradoxical effect of breaking the world’s trust in ICG/A

Something similar just happened again.

This time, the culprits were CNNIC, the China Internet Network Information Center, and an Egyptian service provider called MCS Holding.

CNNIC minted a test intermediate CA certificate for MCS; MCS apparently intended to enter the business of providing “trusted public signing capabilities.”

The test certificate was only valid for two weeks, but it seems as though things didn’t go too well for MCS during that time.

The certificate inadvertently ended up installed in an outward facing web filtering proxy.

An IT engineer browsed through the proxy using Google Chrome

As a result, Google “became aware of [unauthorised] digital certificates for several Google domains.”

Any crook who got his hands on the temporary certificate shown above could have enjoyed a two-week period pretending to be Gmail, with a globally-trusted certificate chain to back him up.

What to do?

The offending intermediate CA certificate issued to MCS has been revoked (it would have expired within two weeks anyway), and Google seems to accept that no rogue certificates “identifying” Google domains actually leaked out.

So it’s unlikely any direct harm was done, and no action is required.

But whether the browser community will go on trusting intermediate certificates signed by CNNIC remains to be decided.

Mozilla, for example, has said that the matter will be considered in its security policy forum.

For the rest of us:

  • Don’t use globally-trusted intermediate certificates in your web filter.
  • Don’t expect CAs (indeed, don’t even ask them) to sign intermediate certificates for this purpose.
  • If you are a CA, refuse any such requests.

A chain of trust is only as strong as its weakest link.

Don’t take risks, or make mistakes like MCS did, that could make you into that weakest link.

0 Comments

I thought organizations could set up their browser network settings to use an “SSL Proxy” to accomplish this without having to mess around with certificates.

Reply

Doesn’t TLS stand for Transport Layer Security?

Reply

Of course it does. Everyone knows that. Except me, apparently.

Really sorry about that…don’t know how *that* happened. I suppose it was just so close to the start of the article that I saw it so many times that it just started to look right.

Fixing now…

Reply

It would be nice to be able to prune the list of cert authorities to a minimum. Is there a subset that would be suitable for a typical user of, say, the UK? Would it be practicable for Mozilla (etc) to supply different default lists of certs for different geographical markets instead of giving us a list containing them all?

Reply

That would be nice.

You _can_ go in and “distrust” any or all of Mozilla’s root CAs, and re-enable them if you later see that they are widely used as roots by websites you wish to deal with…

…except I can’t for the life of me work out how to turn *off* the “distrust.” It isn’t a delete (Firefox makes that clear) but it is not at all obvious, to me anyway, how you change your mind later, short of importing that certificate again.

Reply

Using the Firefox “Certificate Manager” (from Preferences, Advanced, Certificates, View Certificates) one can “Edit Trust” to change what a cert can be used for (but one at a time only) or “Delete or Distrust”, which only deletes as far as I can see. But this is laborious and the opposite of what we should want: the default is trust all, whereas perhaps we should want a default of trust nobody. Except non-technical users probably are and would be baffled by prompts for whether to trust the Chinese certificate authority and probably just say yes.

The whole chain of trust idea seems broken (or maybe just never fit for purpose). Is there an alternative (DNSSec perhaps)?

Reply

My point was that the UI tells you that you can’t delete built-in root certificates, only “distrust” them. (Presumably that’s because next update the ones you deleted would simply come back into the list.)

That gave me the impression that the certificates were still there, just labelled “distrusted,” and thus could be “re-trusted” later on if you wanted. Can’t find how to “re-trust” a certificate, though.

The laboriousness is noted…

Reply

I can’t permanently delete any of these CINNC certs! Is all you can do is ‘Edit Trust’?

Reply

If you’re in Firefox, deleting a built-in certificate makes it vanish from the list but when you revisit the list…it comes back. However, if you then “edit trust” you will see that it is indeed untrusted. I can’t find a way to show a list certificates that aren’t trusted.

From a UI/UX perspective this is a bit weird but it seems to work. Presumably they leave it in the list so that it doesn’t get added back next update, or something.

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to get the latest updates in your inbox.
Which categories are you interested in?
You’re now subscribed!