0

I believe my question will be a continuation of questions such as:

What's the point of the CA?

How does a digital certificate prove authenticity?

In short, I still don't have a firm grasp on why a TLS certificate signed by a reputable and public Certificate Authority (CA) is "better" than one that is not. I feel like I am not "connecting the dots" on this topic because I'm not seeing step-by-step examples of how a hacker can take advantage of TLS certificate that's not been signed by a CA.


EDIT

Actually, I spent a few days thinking through hypothetical situations. My current understanding is the main problem a CA is trying to solve is to ensure TLS certificates are not tampered with while in-transit between server and client. Is that correct? Please correct me if I am completely missing the point on what CAs are all about.

Here's a more detailed explanation of what I understand. I'll frame my understanding in the form of Problem and Solution and communicate my ideas with step-by-step demonstrations and use of pseudo-code.

Problem

A TLS certificate contains a public key and the Subject Alt Name (SAN) or Common Name (CN) of the entity the public key is meant to encrypt information for. The public key is susceptible to being altered while in-transit from server (eg. Apache web server) to client (eg. FireFox web browser) in the form of man-in-the-middle attacks. Undesirable ways a TLS can be altered while in-transit are:

  • an unauthorized entity can intercept transmissions between server and client and inject a fraudulent public key into the TLS certificate. If client uses fraudulent public key to encrypt information and then clients sends this encrypted information to server, the unauthorized entity can intercept transmissions and decrypt the information with the unauthorized entity's corresponding private key.

  • network connectivity issues could corrupt the TLS certificate, which could corrupt the public key and make the public key unuseable

To demonstrate this problem, I will use an example:

Assume there are 3 players for our example: AcmeCorp, FireFox web browser, and Hacker.

AcmeCorp is a legitimate company and wants to create a website https://acmecorp.com. AcmeCorp wants use a TLS certificate on their website https://acmecorp.com/. The website uses Apache Webserver. Apache Webserver needs two files to serve acmecorp.com over TLS. The two files required will be acme.cert and acme.key, which are the TLS certificate and private key respectively. The acme.cert contains a public key which can be extracted.

FireFox webbrowser is used by a real human customer. FireFox web browser visits https://acmecorp.com. FireFox receives acme.cert during TLS handshake. FireFox extracts public key from acme.cert and saves it as acme.pub. FireFox encrypts all information with acme.pub before sending it to acmecorp.com.

Hacker wants to steal information between FireFox and https://acmecorp.com. Hacker has the files hacker.cert and hacker.key, which are TLS certificate and private key respectively. The hacker.cert will have almost identical information to acme.cert, except the public key included in the hacker.cert is different from the public key acme.cert. The hacker.key can be used to decrypt information that's been encrypted by the public key in hacker.cert. Hacker wants to intercept transmissions from acmecorp.com and replace the contents of acme.cert with contents of hacker.cert.

As it stands now, it is very easy for Hacker to intercept transmissions from acmecorp.com to FireFox and replace the contents of acme.cert with the contents of hacker.cert. There is no way for FireFox to know if such modifications took place while acme.cert was in transit. If FireFox uses the public key from hacker.cert, then Hacker will be able to decrypt all of FireFox's transmissions using hacker.key.

Solution

The goal of a Certificate Authority is to provide client applications the ability to identify whether TLS certificates were tampered with or altered while in-transit from the server to the client application.

AcmeCorp can offer FireFox a way to verify whether the contents of acme.cert was modified by having a trusted third party called a Certificate Authority create the acme.cert on behalf of AcmeCorp. The TLS certificate creation process for acmecorp.com becomes:

TLS Creation Process

  1. AcmeCorp owns the domain acmecorp.com.
  2. AcmeCorp uses OpenSSL to create a private key and a CSR. The CSR has a public key, a SAN/CN of acmecorp.com and all the meta information to create a TLS certificate for the domain acmecorp.com.
  3. AcmeCorp gives the CSR to a CA.
  4. CA sees that the CSR is for the domain acmecorp.com.
  5. CA does DNS checks to ensure AcmeCorp does own the domain acmecorp.com. If checks fail, then abort process.
  6. CA creates a temporary file called temp-cert.pem based on the information of the CSR.
  7. CA creates a TLS certificate file and digitally signs the TLS certificate with a command like MakeTLSCert(outfile: 'acmecorp.cert', infile:'temp-cert.pem', hash:'sha256', cakey:'ca.key'). My understanding of this step is weak, but i'm guessing it is broken down into these steps: 7.1. hash the contents of temp-cert.pem with sha256 and call the result a message digest. 7.2. encrypt the message digest with CA's private key ca.key and call the result the CA digital signature. 7.3. concatenate the temp-cert.pem and the CA digital signature and call this the acmecorp.cert, which is the TLS certificate.
  8. CA gives acme.cert to AcmeCorp.

Now AcmeCorp can use acme.cert and acme.key with Apache web server to serve https://acmecorp.com over TLS.

If a Hacker tries to perform steps 1 to 8, the hacker will fail at step 5. That is, a CA will see that the hacker does not own the DNS records for acmecorp.com. Therefore, the CA will not issue a certificate that has the CA's digital signature.

Next, these are the steps that FireFox will use to identify a legitimate TLS certificate, that is, differentiate between acme.cert and hacker.cert by inspecting the contents:

TLS verification

FireFox comes bundled with the Public Key of reputable CA. Let's say FireFox has the public key of the reputable CA used in the steps above and it has the file name ca.pub. When FireFox visits https://acmecorp.com, the following happens:

  1. FireFox receives TLS certificate.
  2. FireFox extracts public key from TLS certificate.
  3. FireFox asks if public key can be trusted. The next step and onwards are meant to answer this question.
  4. FireFox sees a CA digital signature in the TLS certificate.
  5. In step 6 of the TLS creation process, temp-cert.pem is the first half of the TLS certificate, and the digital signature is the second half. Hence: 5.1 FireFox uses the ca.pub to decrypt the digital signature which yields a message digest (note, only ca.pub can decrypt information encrypted by ca.key). We now have the message digest that made by the CA. 5.2 FireFox uses the ca.pub to sha256 hash temp-cert.pem of TLS certificate to create another message digest.
  6. FireFox compares the message digest of step 5.1 and step 5.2 to make sure they are the same. If they are not the same, then it means the TLS certificate was modified while in transit from acmecorp.com to Firefox.

Final Questions

Did I mis-understand anything? Specifically:

  1. Did I mis-understand the main goal(s) of a Certificate Authority?
  2. Did I mis-understand how the Certificate Authority achieves its goals?
  3. Does anything I've said change between TLS1.2 vs. TLS1.3? I think everything I've said so far applies to TLS1.2 . If I were to guess how this applies to TLS1.3, it is that public keys in TLS certificates are used for generating symmetric keys in the Diffie-Hellman algorithm as opposed to being used for encrypting information. Hence, the function of CA digital signatures to allow FireFox a way to verify TLS certificates coming from the server were not tampered with still applies...because incorrect public keys means you are generating the wrong symmetric keys which a hacker can exploit. Is that correct?
7
  • 1
    "FireFox encrypts all information with acme.pub before sending it to acmecorp.com." - The public key in the certificate is NOT used for encrypting application data. The key for encrypting the application data is instead determined with a key exchange. In modern TLS (i.e. without using obsolete RSA key exchange) the server certificate is only used to authenticate the server in order to make sure that the key exchange is done with the intended server and not some man in the middle. Commented May 18 at 19:17
  • "In short, I still don't have a firm grasp on why a TLS certificate signed by a reputable and public Certificate Authority (CA) is "better" than one that is not." - I don't understand how anything what you write addresses the question of CA better than self-signed. You instead attempt to describe the process of certificate issuing and certificate validation. The "better" is clearly answered in the question you link to though, it's about the "bootstrapping" of trust relationships. Commented May 18 at 19:21
  • "The goal of a Certificate Authority is to provide client applications the ability to identify whether TLS certificates were tampered with or altered while in-transit from the server to the client application." - the actual goal is to derive trust into the server certificate from existing trust into the root CA and use this trust during certificate validation. Making sure that the server certificate is not modified is just necessary to achieve the actual goal. Commented May 18 at 19:28
  • @SteffenUllrich - thanks! For the comment on "bootstrapping", I tried to re-read the answer again. I'm stuck with the quesitons, "why should I trust the CA? What do they do to gain my trust and its relevancy to certs given by AcmeCorp?" I'll think about this question more and try to answer my own question. Commented May 18 at 19:33
  • 1
    @learningtech: The issue of CNNIC wasn't an inability to perform CSR checks. They issued an intermediate CA certificate to a customer. The customer in turn misused the intermediate CA to issue false certificates for TLS traffic inspection on a firewall. Note that only the intermediate CA certificate was revoked, not the CNNIC trust anchor itself.
    – Ja1024
    Commented May 18 at 22:22

3 Answers 3

2

Oof, this got REALLY long. TL;DR: read the below stuff until you reach the horizontal line. The rest breaks down each of your confusions or misconceptions in sequence, and goes into far more detail.

Short answer: The purpose of the "public key infrastructure" (PKI) where trusted CAs issue certificates is so that you agent X can verify that agent Y is the legitimate owner of a certificate that claims to belong to Y. In particular, PKI lets arbitrary agents X and Y do this, without needing to do something inconvenient and non-scalable (like each X gets all Y's keys ahead of time through some other channel and hard-codes all agent<->key mappings in their software). It also serves other purposes, like providing a channel to revoke compromised certs (and issue new ones that are automatically trusted).

So long as you

  • trust the CA to have verified Y's identity and to not issue a fraudulent certificate
  • trust Y to not have leaked their private key
  • trust your certificate validation code to work correctly
  • trust your list of trusted CAs (usually provided by the OS or client software) to not be maliciously tampered with

then you can trust that any certificate which passes validation really does contain the right public key for its identified owner.


the main problem a CA is trying to solve is to ensure TLS certificates are not tampered with while in-transit between server and client.

No. You don't need CAs for that; even a self-signed certificate reveals tampering (or corruption) of just the public key, subject name, validity, etc. Of course, if the client doesn't know what public key to expect, an attacker could replace the certificate's public key with their own and then replace the (self-)signature with one from their corresponding private key. The certificate signature would once again be valid, just not from a trusted signer (and therefore not really trustworthy). This is why self-signed certificates are generally not accepted.

However, the primary purpose of the CA remains "be a way for an agent (in this case, the client) to trust that the public key in the certificate belongs to the agent (server) identified in the certificate". Obviously as a corollary to this, the method of transmitting this information (the certificate itself) needs to be possible to verify the authenticity of (it wouldn't be any good if the message [certificate] couldn't be verified to have originated at the CA), so that's why the CA signs the certificate with its own private key.

FireFox extracts public key from acme.cert and saves it as acme.pub.

No, although it could. The public key is usually only used once during the handshake, and small enough to easily keep in memory for that time. Once the handshake is done, the key - and the rest of the certificate - can be forgotten (though in practice it won't be so long as the tab is open).

FireFox encrypts all information with acme.pub before sending it to acmecorp.com.

No. Not only would this be catastrophically slow - public key encryption is far, far slower than asymmetric encryption - it would only protect the data going from the client (Firefox) to the server, not the data coming back (the client usually does not present any public key, in or out of a cert, to the server). Besides, some public key algorithms don't even support encryption, only signing!

Instead, the public key is used to authenticate a key exchange, whereby both client and server come to know a random symmetric key (actually a set of them) for algorithms like AES-256, without any way for an eavesdropper to learn them. The simplest such key exchange - but also the least-secure still widely supported, and in fact rapidly becoming unsupported - is for the client to generate a random value, encrypt it with the server's public key (this would be the only time the client actually need's the servers public key), and transmit it; this is how RSA key exchange works. Nearly all key exchanges these days are instead based on ephemeral Diffie-Hellman algorithms (specifically ECDHE, "elliptic-curve Diffie-Hellman ephemeral") which provide a valuable property called "perfect forward secrecy" that RSA exchange lacks. Rather than the client encrypting anything to the public key, the server signs its [ephemeral] public [EC]DH parameter - or, in TLS 1.3, signs the entire handshake - with its private key, and the client uses the public key to verify the signature before transmitting any user data.

The exchanged symmetric keys are used to encrypt (and authenticate) each message, using a cipher such as AES or ChaCha20. Messages are either authenticated using HMACs with SHA2 algorithms (legacy behavior, only up to TLS 1.2) or authenticated encryption (first available in TLS 1.2, required in TLS 1.3). Symmetric encryption/decryption and authentication code generation/verification is vastly faster than asymmetric (public key) encryption/decryption or signing/verification, even for much stronger key strengths. It's also potentially more secure against future attacks such as using quantum computing (though that wouldn't help if the key exchange is compromised).

As it stands now, it is very easy for Hacker to intercept transmissions from acmecorp.com to FireFox and replace the contents of acme.cert with the contents of hacker.cert. There is no way for FireFox to know if such modifications took place while acme.cert was in transit. If FireFox uses the public key from hacker.cert, then Hacker will be able to decrypt all of FireFox's transmissions using hacker.key.

Correct (aside from all the ways that your understanding of how TLS encryption works are wrong; see above), assuming that Firefox doesn't already know what public key to expect for acmecorp. In practice it almost never does - a very small number of critical sites have "pinned" public keys, but most rely entirely on PKI - so this is correct.

As a side note, there's no reason at all for Hacker to "replace the contents of acme.cert with the contents of hacker.cert", as that implies that Firefox is talking to acmecorp.com at all. Rather, the attacker usually just impersonates the target server, becoming the destination point for the TCP/IP connection over which TLS is used (this is generally possible any time the attacker could instead modify traffic in transit). Hacker then presents its own certificate - which fraudulently identifies itself as acmecorp.com - to Firefox, and (optionally, if needed) can open its own connection as a client to acmecorp.com for relaying the user's data back and forth. This is what's called a "man [or monkey] in the middle" (MITM) attack.

The goal of a Certificate Authority is to provide client applications the ability to identify whether TLS certificates were tampered with or altered while in-transit from the server to the client application.

Not really. As mentioned above, the signature alone does that, so long as you know what key to expect signed the certificate and trust that key's owner (which in the usual case is a CA, but in self-signed certificates is the cert owner). The CA provides client applications (and sometimes servers and many other things that consume certificates) the ability to trust that the public key in the certificate belongs to the agent identified in the certificate. Since it does so via the certificate's signature, this also means that the certificate can't be tampered with (even in ways that don't affect the public key or owner) or spoofed.

TLS Creation Process 1. - 4.

Generally correct, though you need not use OpenSSL specifically. At least some browsers actually have the ability to generate key pairs and CSRs built into them, and there's lots of other cryptographic tools that can do it stand-alone or as part of another program.

Also, that's not creating TLS, that's creating a certificate for use in TLS via a certificate authority. Certificates are used for many things besides TLS (and indeed, you can use TLS without certificates). Certificates can also be created without the use of a CA (self-signed certificates; as mentioned above these are not usually trusted because the recipient needs to already know what public key to expect - which largely obviates the point of the certificate - or else trust that the transmission is genuine for some other reason).

  1. CA does DNS checks to ensure AcmeCorp does own the domain acmecorp.com. If checks fail, then abort process.

That's one way to do it, though it's relatively weak. The domain registrar doesn't necessarily validate your identity when you register a domain name, and sometimes doesn't reveal the domain owner's name anyhow. I probably couldn't get a registrar to believe me that my identity is "Google, subsidiary of Alphabet corp" but you don't want to rely on the registrar to get that right. Besides, what about cases where the domain is "superuser.com" but the owner is "Stack Exchange Inc"? How would the CA know that the latter owns the former?

Instead, there's various other ways of identity validation that CAs use, depending on how careful they're being (and how much money/hassle the requester wants to expend). For example, the CA might give you a random unique string that you're supposed to put in your DNS entry or host on your website at a known location, as proof that you own the domain (and the server at the domain's IP). This is not very strong, but it's easy to automate. Or the CA might require you to submit legal proof of ownership of the domain and legal proof of your own identity and manually verify that those match, perhaps while checking the relevant public records in the process; that's way more effort and can't really be automated the same way, but can't be spoofed by an attacker spoofing the victim site's DNS records or planting a file somewhere via some vulnerability in your server.

7.1. hash the contents of temp-cert.pem with sha256 and call the result a message digest. 7.2. encrypt the message digest with CA's private key ca.key and call the result the CA digital signature.

Conceptually false but mathematically correct for the specific case of RSA keys. The fact that in RSA, the operation "sign" is the same as the operation "encrypt" just performed with the private key instead of the public key does not mean encryption and signing are the same thing. The security considerations are quite different, and non-RSA algorithms don't even work that way (some don't support encryption at all)! Don't ever think of "encrypt" as a thing you can do with a private key. Note that RSA is slow and requires gigantic key sizes to achieve acceptable levels of security; as a result, it's being slowly phased out. Also, "digest" as a noun in the context of cryptography just means "what you get when you hash (verb) something" or "the output of a hash algorithm"; this is related to the more general concept of a digest (noun) as "a summary of one or more longer messages, with the details removed", see also "gloss" (explanation, paraphrase, or interpretation of a message) or "gist" (the essential part of the message).

TLS verification 1. - 4.

Broadly correct again, though this is specifically only certificate signature validation. For TLS validation, you also have to validate things like "the entity identified in the certificate is the one I expect" (otherwise I could get a perfectly valid cert for cbhacking.com and use it to MitM your connections to Google.com) and "the certificate is allowed to be used for this purpose" (generally Server Identification and Digital Signature). Indeed, this isn't even enough to verify the certificate in general (only its signature), for verifying the validity of a certificate you also need to verify things like "is after the 'valid after' date but not yet expired" and "has not been revoked".

5.1 FireFox uses the ca.pub to decrypt the digital signature which yields a message digest (note, only ca.pub can decrypt information encrypted by ca.key). We now have the message digest that made by the CA.

Again, mathematically correct in the specific case of RSA, but conceptually wrong. "Decrypt" is not a thing public keys can do, because "decrypt" means "reveal a secret message" and since anybody is allowed to see a public key and therefore could do this operation, and the "secret message" in this case is a hash of a publicly-available data blob, so it really isn't a "secret" at all, is it?

5.2 FireFox uses the ca.pub to sha256 hash temp-cert.pem of TLS certificate to create another message digest.

Wrong, though close. SHA2-256 is an unkeyed hash function; there is nowhere in the process of using it that the CA's public key (or any other key, except for the one embedded in the rest of the certificate and treated as undifferentiated data) would be used. However, yes, for verifying an RSA signature, the verifier re-hashes the message original with the same hash algorithm.

  1. FireFox compares the message digest of step 5.1 and step 5.2 to make sure they are the same. If they are not the same, then it means the TLS certificate was modified while in transit from acmecorp.com to Firefox.

Or just fraudulent to begin with (e.g. the attacker forged it entirely, but of course couldn't generate a valid CA signature because the attacker doesn't have the CA's private key) and being spoofed. MitM attacks sometimes don't involve the client actually interacting with the real server in any way at all!

Again though, this process is just validating the certificate's signature; there's a bunch of other checks that you need to perform to validate a full TLS handshake. Also, if the client (Firefox) didn't know to expect a CA's signature, or if an attacker were able to slip their own public key into the "trust store" (list of trusted CA public keys), then the attacker could potentially have signed the certificate with their own private key and this would be accepted as valid (though in practice, Firefox throws a fit about self-signed server certificates, and rightly so).

Final Questions - Did I mis-understand anything? Specifically: 1. Did I mis-understand the main goal(s) of a Certificate Authority? 2. Did I mis-understand how the Certificate Authority achieves its goals?

You misunderstood a number of things, as mentioned above, including the distinction between what the purpose of the signature on a certificate is in general, the purpose of CAs in the certificate ecosystem (PKI), and the exact process CAs use for identity validation and sometimes the process for signing (though CA certs do often still use RSA keys, since CAs don't rotate the certs very often and RSA used to be the best available algorithm).

Does anything I've said change between TLS1.2 vs. TLS1.3? I think everything I've said so far applies to TLS1.2

Nothing you've said is actually specific to TLS (any version) at all! Well, except for the "server sends its certificate to the client" (correct) and arguably the "client encrypts everything with the server's public key" (which is completely wrong for all TLS versions, and every other use of certificates that I know of). Certificate signature validation is a critical part of the security of TLS, but it's not even sufficient for certificate validation in general, much less certificate validation in the context of TLS, never mind the other security guarantees of TLS!

But no, none of the stuff you got right is different between TLS 1.3 and any earlier version; the creation and use of certificates has not changed between versions (aside from differences between versions regarding ways to use TLS without certificates at all, which TLS used to have a number of insecure options for though thankfully almost nothing allowed them).

public keys in TLS certificates are used for generating symmetric keys in the Diffie-Hellman algorithm as opposed to being used for encrypting information.

Once again, wrong but kiiiind of close. You can't use a public key to generate DH keys/parameters, at least not in any useful way; they're generated from a secure random number generator using an algorithm specific to the key type, same as for any other key pair. Furthermore, both client and server must generate such [EC]DH pairs. In TLS 1.2, the server signs its [EC]DH public key with its private key before transmitting it, and the client verifies the signature on that key (to prove that the server has the corresponding private key, and that a MitM hasn't modified or spoofed the [EC]DH public key) using the server's signature from its certificate. In TLS 1.3, the same general thing holds except the server signs the entire handshake, not just its side of the key exchange; this prevents an attacker from tampering with any portion of the TLS handshake at all.

Additionally, the use of [EC]DH key exchanges isn't new to TLS 1.3, or even to TLS at all; for example, SSL_DHE_DSS_WITH_DES_CBC_SHA is a SSL 3.0 (precursor to TLS 1.0) cipher suite. It uses ephemeral integer (non-EC) DH key exchange, with DSA-SHA1 (Digital Signature Standard) signatures to authenticate the server and key exchange (that is, the server certificate contains a DSA public key, which can't be used for encryption at all, only verifying DSA signatures).

This cipher suite is weak in a number of ways:

  • DSS is deprecated (partially because it uses the broken SHA1 and specifies a too-weak key strength for DSA, but integer DSA in general is also deprecated, replaced be ECDSA, EdDSA, and especially Ed25519)
  • integer DH is on its way out, replaced by ECDH
  • DES is too weak to use for anything anymore, even its upgraded form triple-DES still uses relatively weak keys and dangerously short block sizes, but single-DES keys are now easy to break due to hardware advances since they were standardized; it's been replaced mostly by AES but sometimes other block ciphers, plus various modern stream ciphers
  • CBC mode (and other non-authenticated modes) is on its way out, replaced by authenticated encryption ("AEAD", Authenticated Encryption with Associated Data) modes, most commonly GCM though there are others that have some advantages vs. GCM
  • SHA1 is broken, and while the specific use here - HMAC-SHA1 - is probably still safe for most purposes, there's just no reason to use it anymore even if for some reason you're still using a non-authenticated encryption mode

plus SSL 3.0 itself is a flawed and obsolete algorithm (among other things, unspecified behaviors meant that compliant implementations could be vulnerable to padding oracle attacks when using block ciphers like DES, 3DES, or AES in modes such as CBC). However, this deeply obsolete cipher suite does at least use ephemeral key exchange to provide perfect forward secrecy!

Hence, the function of CA digital signatures to allow FireFox a way to verify TLS certificates coming from the server were not tampered with still applies...because incorrect public keys means you are generating the wrong symmetric keys which a hacker can exploit.

Basically right, though for the wrong reason. If the certificate's signature was invalid or generated by an untrusted signer, you couldn't be sure what the server's public key was (that being the thing CAs are for). In that scenario, an MitM attacker could present their own [EC]DH public parameters, signed with their own private key, to the client, and the client wouldn't know that they weren't actually the server's public parameters. If the client used the attacker-generated parameters to complete the [EC]DH key exchange, then they would have exchanged symmetric keys with the attacker, not with the server, and the attacker could thus decrypt all messages that the client sent (and encrypt+authenticate responses to the client in the way the client expects).

3

It seems a lot of the confusion comes from a misunderstanding of how complex networks (like the Internet) work. You somehow assume that the client can simply establish a point-to-point connection to “the server”, so that the only remaining problem is to get the server's public key to the client unaltered.

This is not the case. In reality, when an HTTPS client want to send requests to a website acmecorp.com, several steps happen.

  • If no IP address for the hostname is known, then it has to be looked up via DNS. DNS responses are typically not integrity-protected, so they can be manipulated in transit. The DNS records themselves that ultimately come from an authoritative nameserver are also not usually signed, which means they may be false before they're transmitted. As a result, the client cannot tell whether they even have the right IP address.
  • Once the client has obtained an IP address for acmecorp.com (which may or may not be correct), they establish a TCP connection. This usually means sending entirely unprotected IP packets through a cascade of different devices like switches, routers, caches and proxies. Depending on how exactly the client connects to the Internet, it may also be dealing with wi-fi access points or cellular towers. Each device can be misconfigured or malicious, so it's entirely unclear where the sent IP packets are going to, where the received IP packets are coming from, and whether any manipulations have taken place.
  • Once a TCP connection has been established, it's possible to perform a TLS handshake.

As you can tell, everything below the TLS protocol is usually not protected at all. You don't know if the IP address is correct, you don't know if the IP packets actually arrive at the desired host, you don't know if the IP packets you receive are from that same host. This isn't just an in-transit problem. Even if you completely exclude man-in-the-middle attacks, you cannot tell whether you're even communicating with the right endpoint. So how can you possibly trust a public key you've received over such a connection?

To fix this problem, it's necessary to have a binding between the domain name and a public key. This is what certificates are for. They contain a public key together with one or many domain names, and the cryptographic signature allows you to verify that a particular entity vouches for the correctness of the data.

The remaining problem is that you cannot simply trust any signature. For example, if I gave you a certificate for google.com, signed with my own private key, it certainly wouldn't be a good idea to use that certificate from now on. There's no reason for you to believe me that the public key is correct. The signature has to come from a trusted entity. Currently, the common solution is to have predefined set of trust anchors (root CAs) which belong to hand-picked organizations. Those organizations are deemed trustworthy by, for example, the browser vendor based on regulations, audits, their track record etc. They're expected to maintain a secure public-key infrastructure and follow specific rules (like the ones from the CA/Browser Forum). Note that you're free to add or remove trust anchors. You don't have to accept the trust anchors that come with a browser or the operating system.

Certificates signed by CAs aren't the only solution for binding public keys to domain names. There's also DNS-based Authentication of Named Entities (DANE) where public keys are integrated into the DNS system and integrity-protected with the Domain Name System Security Extensions (DNSSEC). You could also devise a completely different trust system that doesn't rely on central authorities at all. For example, analogous to the web-of-trust concept of GPG, you could have “a friend of a friend” confirm that a particular public key indeed belongs to google.com.

In any case, you need some trusted entity to bind a public key to the target domain.

0
1

The purpose of TLS is to determine if the message was tampered with or read in transit to the server. The purpose of CAs is to authenticate the server that you are communicating to. The "problem" section describes what can happen in a "Man In the Middle" attack, where you are lead to connect to the wrong server and then complete the TLS handshake. Once that is done, you can be certain that nobody can eavesdrop your connection (to the fraudulent server), but you can't say anything about the identity of the server. They could be the correct server, or they could be a malicious one. TLS does not provide a singular way to determine either way.

What it does is provide you with the certificate of the other side. The CA system is a way of verifying that the certificate of the server is one that could only have been given to a legitimate owner of the (true) server. The CA signs the certificate indicating that they have done some level of authentication and (to their standards) the bearer of the certificate is the correct owner of the resource.

CAs are designed to prevent the Man In the Middle attack because they should never sign a certificate for a malicious actor claiming to own a server they do not own. The public CAs understand that trust is a fickle thing. They have processes for auditing certificates issued and for revoking certificates found to be in error.

In the end, they are a transitive tool. You trust that your particular security concerns (such as providing a credit card) are sufficiently small compared to the burden of authentication that CAs uphold that you can trust their analysis of a certificate (which they signed) sufficiently well for your needs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .