Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

The X509 specification allows a CA to issue a single certificate for multiple hostnames, by using the "Subject Alternative Name" extension.

From the spec:

The subject alternative name extension allows identities to be bound to the subject of the certificate. These identities may be included in addition to or in place of the identity in the subject field of the certificate.

This has numerous uses; in particular, consider a hosting / reverse-proxy situation, with multiple sites colocated. These sites do not particularly trust each other, and do not have any kind of affiliation; they are just being hosted by the same server, and thus sharing the same certificate.

Is this as risky as it sounds?
At first glance I would say that being as the sites are not trusted to each other, it might be possible for siteA to spoof siteB, even over SSL, since siteA uses the same private key that siteB does. DNS would still need to be spoofed, but there are several ways to do so (even if they are not trivial).
Am I wrong, IS there some other cryptographic (or other) mitigation that I am not seeing here?

share|improve this question
2  
While your question is indeed valid, you're starting with an incorrect premise. You're proposing a situation where a SAN cert is used incorrectly (for sites that are operated by different entities or where there's no mutual trust). Examples of correct usage is when you want to have avid.org and avid.net, or your holding company runs two entities avid-firm.com and avid-agency.com. That's what SAN is for. –  Adnan Jun 6 '13 at 9:10
    
No, thats not an incorrect premise, that is the exact scenario I am describing. This does seem to me to be oh so very wrong, I am looking for validation - or better yet, to learn by finding out I am wrong and this setup is not as vulnerable as I would think. –  AviD Jun 6 '13 at 9:20
1  
For my education: the right way to do this is SNI, right? –  Gilles Jun 6 '13 at 12:10
1  
@Gilles see Thomas's answer below. –  AviD Jun 6 '13 at 12:52

3 Answers 3

up vote 16 down vote accepted

If every tenant has a copy of the private key, then well, they all have it, which means that they can spoof each other. They can also decrypt traffic between other tenants and their clients, unless they use the "DHE" cipher suites of SSL, which removes this specific issue; this is known as Perfect Forward Secrecy. DHE does nothing against the spoofing issue, and can be used only if the client software agrees.

The trick is, then, not to give the private key to each tenant. Instead of having them share the same certificate, make them share the same SSL server. Run a single, trusted HTTPS server which uses the certificate, and then forwards the decrypted HTTP traffic to the relevant tenant (whose name is specified in the HTTP header -- no need for SNI support here). Indeed, a reverse proxy situation. Such a setup is safe (tenants are given nothing); however, it requires tenants to trust the shared SSL server (that's still better than requiring the tenants to trust each other), and it will interfere with (i.e. in all practicality, prevent) use of client certificates.

share|improve this answer
    
Thanks! So if this multiple-SAN cert is installed on the reverse proxy, it's not a problem for the backend sites to share the same cert? The sites themselves dont have access to the private key, sure, but they do have access to the connection with the client via the same cert. I guess I'm thinking in the direction of malicious sites, that send down javascript (or flash, or whathaveyou) that then forces a connection to the same server, using the other site's name, ala DNS Rebinding. E.g. some form of redirected tunnelling... I am explicitly NOT clear on how this would work, though... –  AviD Jun 6 '13 at 12:50
    
From the point of view of the client, "same server" means "same name". That's how Same-Origin Policies work; they don't give a fig about whether two distinct host names happen to be hosted on the same IP, or, for that matter, use the same certificate. The multiple servers also don't have access to the same connection: for each name, the client browser opens a new SSL connection, because the client, at that point, does not know that the other server will use the same certificate (and it won't "merge" connection afterwards either). –  Thomas Pornin Jun 6 '13 at 22:37

Yes, it is as risky as it sounds. You're not wrong, and, AFAIK, I don't think you're missing anything.

Multiple entities sharing the same certificate which signs a public key, means they share the same private key. Not A Good ThingTM. If site1.com doesn't trust site2.com then they shouldn't be configured to use a Subject Alternative Name (SAN) certificate.

A good CA will verify that the entity requesting a certificate has ownership over subjects defined in the SAN (domain name, IP address, email address, etc.)

So in conclusion, SAN certificates should only be used when the covered subjects trust each others. A good example of different sites using the same certificate (one you mentioned in the DMZ), is the case of SE sites. Even though stackoverflow.com is a different site from superuser.com, they still trust each others and belong to the same entity.

share|improve this answer
    
+1, but the point about the CA is misplaced - if there is a multi-tenant hosting situation - or think of a CDN - the host does have authorization to install the certificates for those sites, and should eventually have a cert for each site installed. But I agree about the site1 shouldnt be using the same cert as site2, even if both certs would otherwise be installed on the same server. –  AviD Jun 6 '13 at 10:19
    
Other than common sense, do you have any resources, exploit PoC, authoritative statements to that effect, etc? This is a large, wellknown entity that is doing this, I want to have something to point them at for backup.... –  AviD Jun 6 '13 at 10:21

@Adnan and @Thomas Pornin both touch on the first leg of the tripod: If the key is only accessed by the shared provider (e.g., a CDN) then the security is not necessarily lower, and if it is shared by unconnected parties then the security is ridiculously lower.

There is a second leg to the tripod, which is maintenance. Let's assume that the key is only held by the shared provider (HostCo), so the security is not an issue. HostCo has 20 tenants that he stuffs onto the key using Subject Alternative Names (SAN). Great! June passes, July arrives, 3 tenants leave and 4 new ones show up. Whoops! Time to get a new cert issued reflecting the adds/changes. Great. Whoops! August comes... see where this is going? The maintenance of redoing a cert with multiple SANs is stupid over time unless the pool of names going onto a SAN is pretty static.

The third leg of the tripod is money. It may be cheaper for HostCo to use a SAN cert than to go out and buy 20 certs. This leg doesn't make sense, really, because of the tenants are truly unconnected units that don't trust each other, HostCo is just going to pass the costs of individual certs along to them. There's not the same economic incentive that, say, Massive Dynamic has to save money on the cert for the web site that all 273 of it's subsidiaries are served by.

That's three remarkably wobbly legs. I wouldn't sit on that stool given the option.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.