SSL and security
What is a DDoS attack?
A DDoS attack uses many machines to flood one target with traffic until it cannot respond. Learn how it works, the main types and how to reduce the damage.
· Mateo Cardenas
TLS (Transport Layer Security) is a protocol that lets a client communicate securely with a server across an untrusted network.1, source 1 It encrypts the data exchanged between client and server while it is in transit, so attackers cannot read it.1, source 1 SSL is the precursor to TLS.1, source 1
TLS is most notably used to secure HTTP connections on the web, and the resulting protocol is called HTTPS; HTTPS is the defense against a manipulator in the middle (MITM) attack, in which an attacker sits between the browser and the server and can read and modify the traffic.1, source 1 RFC 8446 says the primary goal of TLS is to provide a secure channel between two communicating peers.2, source 2 TLS is application protocol independent, so higher-level protocols can layer on top of it transparently.2, source 2
RFC 8446 says the secure channel should provide confidentiality: data sent over it after establishment is only visible to the endpoints.2, source 2 TLS does not hide the length of the data it transmits, though endpoints can pad TLS records to obscure lengths and improve protection against traffic analysis.2, source 2 With TLS, an attacker cannot secretly modify data in transit between client and server without detection.1, source 1
With TLS, client and server are each able to prove to the other party that they are the entity they claim to be.1, source 1 RFC 8446 says the secure channel should also provide authentication, with the server side always authenticated and the client side optionally authenticated.2, source 2 On the web, servers usually authenticate themselves to clients, but clients do not usually authenticate themselves to servers.1, source 1 TLS authentication can use asymmetric cryptography such as RSA, ECDSA or EdDSA, or a symmetric pre-shared key (PSK).2, source 2
TLS consists of two primary components: a handshake protocol and a record protocol.2, source 2 In the handshake, client and server agree on which version of TLS to use.1, source 1 They also agree on which cipher suite to use.1, source 1 Client and server also agree on a secret key that they use to encrypt and decrypt messages.1, source 1
After the handshake, client and server use the secret key to encrypt and decrypt any messages, including HTTP headers as well as bodies.1, source 1 Server authentication, in which the server proves who it is to the client, is a fundamental part of web security.1, source 1 TLS 1.3 supports three basic key exchange modes: (EC)DHE (Diffie-Hellman over either finite fields or elliptic curves), PSK-only, and PSK with (EC)DHE.2, source 2
In the Key Exchange phase of the TLS 1.3 handshake, the peers establish shared keying material and select the cryptographic parameters, and everything after this phase is encrypted.2, source 2 The Server Parameters phase establishes other handshake parameters, such as whether the client is authenticated and application-layer protocol support.2, source 2 The Authentication phase authenticates the server (and optionally the client) and provides key confirmation and handshake integrity.2, source 2
In TLS 1.3, the client opens with a ClientHello message containing a random nonce, its offered protocol versions and a list of symmetric cipher and HKDF hash pairs.2, source 2 When (EC)DHE key establishment is in use, the TLS 1.3 ServerHello contains a key_share extension with the server's ephemeral Diffie-Hellman share.2, source 2 TLS 1.3 encrypts all handshake messages after the ServerHello.2, source 2 In TLS 1.3, if the client's key_share extension is insufficient, the server corrects the mismatch with a HelloRetryRequest and the client restarts the handshake with an appropriate key_share extension.2, source 2
In TLS 1.3, the Certificate message carries the certificate of the endpoint and any per-certificate extensions.2, source 2 The TLS 1.3 CertificateVerify message is a signature over the entire handshake made with the private key that corresponds to the public key in the Certificate message.2, source 2 In TLS 1.3, the Finished message is a message authentication code (MAC) over the entire handshake that provides key confirmation.2, source 2
Session resumption drastically reduces the number of full TLS handshakes.3, source 3 In TLS 1.3, after a handshake completes the server can send the client a PSK identity that corresponds to a unique key derived from that handshake, and the client can use it in future handshakes.2, source 2 If the server accepts the PSK, the key derived from the initial handshake bootstraps the cryptographic state of the new connection instead of a full handshake.2, source 2 In TLS 1.2 and below, resumption was provided by session IDs and session tickets, and both mechanisms are obsoleted in TLS 1.3.2, source 2
In TLS 1.3, a PSK can be used with (EC)DHE key exchange to provide forward secrecy, or alone at the cost of losing forward secrecy for the application data.2, source 2 TLS 1.3 added a zero round-trip time (0-RTT) mode that saves a round trip at connection setup for some application data, at the cost of certain security properties.2, source 2 In this mode, a client that shares a PSK with the server can send data on its first flight, called early data or 0-RTT data.2, source 2 In TLS 1.3, the security properties for 0-RTT data are weaker than those for other kinds of TLS data.2, source 2
0-RTT data is not forward secret, because it is encrypted solely under keys derived using the offered PSK.2, source 2 There are no guarantees of non-replay between connections for 0-RTT data.2, source 2 RFC 9325 says applications must avoid 0-RTT unless an explicit specification for the application protocol clarifies when 0-RTT is appropriate and secure.3, source 3
The SSLv3 protocol was released in 1996 and has been subject to a long series of attacks on both its key exchange mechanism and the encryption schemes it supports.4, source 4 RFC 9325 says TLS 1.0 was published in 1999 and TLS 1.1 in 2006.3, source 3
RFC 9325 says TLS 1.2 was standardized in 2008.3, source 3 RFC 5246 specifies TLS version 1.2.5, source 5 In TLS 1.2, the ClientHello and ServerHello establish the protocol version, session ID, cipher suite and compression method.5, source 5 In TLS 1.2, the server sends its certificate in a Certificate message after the hello messages if it is to be authenticated.5, source 5
In TLS 1.2, the handshake is complete after the server's own ChangeCipherSpec and Finished messages, and then client and server may begin to exchange application layer data.5, source 5 RFC 8446 specifies TLS version 1.3, was published in August 2018, and obsoletes RFC 5077, RFC 5246 and RFC 6961.2, source 2 TLS 1.3 is not directly compatible with previous versions, but all versions of TLS incorporate a versioning mechanism that lets clients and servers negotiate a common version if both support one.2, source 2 In TLS 1.3, the supported_versions extension is used by the client to indicate which versions of TLS it supports and by the server to indicate which version it is using.2, source 2
A server that negotiates TLS 1.3 must respond with a supported_versions extension containing the selected version value 0x0304.2, source 2 TLS 1.3 has a downgrade protection mechanism embedded in the server's random value.2, source 2 TLS 1.3 removed the legacy symmetric encryption algorithms, and those that remain are all Authenticated Encryption with Associated Data (AEAD) algorithms.2, source 2 TLS 1.3 removed static RSA and Diffie-Hellman cipher suites, so all public-key based key exchange mechanisms provide forward secrecy.2, source 2
TLS 1.3 removed compression, the Digital Signature Algorithm (DSA) and custom Ephemeral Diffie-Hellman (DHE) groups.2, source 2 TLS 1.3 restructured the handshake state machine to remove superfluous messages such as ChangeCipherSpec, except when needed for middlebox compatibility.2, source 2
RFC 7568 says SSLv3, as specified in RFC 6101, is not sufficiently secure and must not be used, and that negotiation of SSLv3 from any version of TLS must not be permitted.4, source 4 In SSLv3, the non-deterministic padding used in the Cipher Block Chaining (CBC) construction trivially permits the recovery of plaintext.4, source 4 RFC 9325 says implementations must not negotiate SSL version 2.3, source 3
RFC 8996 formally deprecates TLS versions 1.0 (RFC 2246) and 1.1 (RFC 4346).6, source 6 Accordingly, the documents that define TLS 1.0 and TLS 1.1 have been moved to Historic status.6, source 6 The integrity of both TLS 1.0 and TLS 1.1 depends on a running SHA-1 hash of the exchanged messages.6, source 6 RFC 8996 says TLS 1.0 and 1.1 lack support for recommended cryptographic algorithms and mechanisms, and that various government and industry profiles of applications using TLS mandate avoiding them.6, source 6
RFC 8996 says TLS 1.0 and TLS 1.1 must not be used, and that negotiation of either from any version of TLS must not be permitted.6, source 6 It also says removing support for older versions reduces the attack surface and the opportunity for misconfiguration, and streamlines library and product maintenance.6, source 6
RFC 9325 says implementations must support TLS 1.2 and should support TLS 1.3, and must prefer to negotiate TLS 1.3 over earlier versions of TLS when they implement it.3, source 3 It also says TLS 1.3 is a major overhaul of the protocol that resolves many of the security issues with TLS 1.2.3, source 3
RFC 9325 says that when its recommendations are followed to mitigate known attacks, using TLS 1.2 is as safe as using TLS 1.3.3, source 3 Under RFC 9325, TLS 1.2 clients must not fall back to earlier TLS versions, since those versions have been deprecated by RFC 8996.3, source 3 RFC 8996 warns that some systems may not support (D)TLS 1.2 or higher, and that following its recommendations will make communication with those systems fail.6, source 6
A cipher suite defines the algorithms used for key agreement, authentication, encryption and message authentication.1, source 1 TLS 1.3 changed the cipher suite concept to separate the authentication and key exchange mechanisms from the record protection algorithm.2, source 2 RFC 8446 says that, unless an application profile standard specifies otherwise, a TLS-compliant application must implement the TLS_AES_128_GCM_SHA256 cipher suite and should implement TLS_AES_256_GCM_SHA384 and TLS_CHACHA20_POLY1305_SHA256.2, source 2 RFC 9325 says incorrectly configuring a server leads to no or reduced security.3, source 3
Forward secrecy prevents the recovery of information that was encrypted with older session keys, limiting how far back in time data can be decrypted when an attack is successful.3, source 3 RFC 9325 says implementations must support and prefer to negotiate cipher suites offering forward secrecy.3, source 3 They must not negotiate cipher suites with NULL encryption, which do not encrypt traffic, or RC4 cipher suites.3, source 3
Under RFC 9325, implementations should not negotiate cipher suites based on RSA key transport, also called static RSA, because they do not support forward secrecy.3, source 3 For TLS 1.2, RFC 9325 recommends four cipher suites: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 and TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384.3, source 3 For TLS 1.2, preferring the recommended suites typically requires explicitly configuring the order of suites in server software.3, source 3
Choosing the right TLS server configuration has a big impact on the security of the connection, and it determines the TLS version and cryptographic algorithms that will be used.1, source 1 A website's digital certificate contains a digitally signed copy of the public key that is the counterpart of the website's private key.1, source 1 Server Name Indication (SNI) supports multiple TLS-protected virtual servers on a single address by allowing each one to have its own certificate.3, source 3 Modern web hosting services support HTTPS for you, either by default or through a configuration setting.1, source 1
In nginx, the ssl_certificate directive specifies a file with the certificate in PEM format for the given virtual server.7, source 7 The nginx ssl_certificate_key directive specifies a file with the secret key in PEM format for the given virtual server.7, source 7 In nginx, the ssl_protocols directive enables the specified protocols, and its default is TLSv1.2 TLSv1.3, with the TLSv1.3 parameter used by default since nginx 1.23.4.7, source 7
In Apache HTTP Server 2.4, the SSLProtocol directive controls which versions of the SSL/TLS protocol will be accepted in new connections.8, source 8 In Apache HTTP Server 2.4 mod_ssl, the SSLProtocol default is all -SSLv3 (up to 2.4.16 the default was all).8, source 8
Cloudflare's Minimum TLS Version setting only allows HTTPS connections from visitors that support the selected TLS protocol version or newer.9, source 9 In Cloudflare, if TLS 1.1 is selected as the minimum TLS version, visitors attempting to connect using TLS 1.0 are rejected.9, source 9 You can disable TLS 1.0 in Cloudflare by choosing a higher minimum TLS version.9, source 9
To manage the TLS version for a whole zone proxied through Cloudflare, go to the Edge Certificates page in the Cloudflare dashboard and select an option for Minimum TLS Version.9, source 9 To test whether Cloudflare blocks TLS 1.1, you can request your site with curl and the --tls-max 1.1 option.9, source 9
A site that is only served over HTTPS should still listen for HTTP requests and use a 301 Moved Permanently response to redirect to the HTTPS version.1, source 1 When attackers intercept the initial HTTP exchange and prevent the upgrade to HTTPS, this is sometimes called an SSL stripping attack.1, source 1 The server should also send the Strict-Transport-Security HTTP response header (HSTS), which tells clients the site wishes them to use HTTPS.1, source 1 With HSTS, SSL stripping is prevented except for the first time the browser tries to connect to the site, or the first time after an HSTS record in the browser has expired.1, source 1
If a website loads its main document over HTTPS but loads any of its subresources over HTTP, this is called mixed content.1, source 1
SSL is the precursor to TLS. TLS is a protocol that lets a client communicate securely with a server across an untrusted network. RFC 7568 says SSL 3.0 must not be used, and RFC 9325 says implementations must not negotiate SSL version 2.
No, HTTPS is HTTP secured by TLS. HTTPS is the defense against a manipulator in the middle (MITM) attack, in which an attacker sits between the browser and the server.
Yes, in transit between client and server. Attackers cannot read it, though TLS does not hide the length of the data it transmits.
No, RFC 8996 says it must not be used. It formally deprecates TLS 1.0 and TLS 1.1, which it says lack support for recommended cryptographic algorithms and mechanisms.
TLS 1.2 and TLS 1.3, under RFC 9325. It says implementations must support TLS 1.2 and should support TLS 1.3, and must prefer to negotiate TLS 1.3 over earlier versions when they implement it.
Set the allowed protocols in the server configuration. In nginx, the ssl_protocols directive enables the specified protocols. In Apache HTTP Server 2.4, the SSLProtocol directive controls which versions are accepted. In Cloudflare, you can disable TLS 1.0 by choosing a higher minimum TLS version.
Every fact on this page comes from one of these, checked before it goes live.
SSL and security
A DDoS attack uses many machines to flood one target with traffic until it cannot respond. Learn how it works, the main types and how to reduce the damage.
· Mateo Cardenas
SSL and security
A firewall controls the flow of network traffic between networks or hosts. Learn how it filters packets, its hardware and software forms, and what WAFs do.
· Mateo Cardenas
SSL and security
An SSL certificate binds a public key to a domain name so browsers can verify the server. Learn what it holds, who issues it and how long it lasts.
· Mateo Cardenas
SSL and security
HTTPS is an encrypted version of HTTP that uses TLS to protect all communication between a client and a server.
· Mateo Cardenas