Skip to contentSkip to conversation

Always disable TLS renegotiations

PATCH Superseded Arne Schwabe 3 participants 3 messages Mar 26, 2021

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Always disable TLS renegotiations

Renegotiations have been troublesome in the past and also the recent OpenSSL security problem (CVE-2021-3449) is only exploitable if TLS renegotiation is enabled.

mbed TLS disables it by default and says in the documentation:

Warning: It is recommended to always disable renegotation unless you know you need it and you know what you're doing. In the past, there have been several issues associated with renegotiation or a poor understanding of its properties.

TLS renegotiation can be used to restart a session with diffferent parameters (e.g. now with client certs). This somethign that OpenVPN does not use.

Furthermore because of all these problems, also TLS 1.3 completely drops support for renegotiations.

Patch V2: Improve commments and commit message

---
 src/openvpn/ssl_mbedtls.c | 4 ++++
 src/openvpn/ssl_openssl.c | 4 ++++
 2 files changed, 8 insertions(+)
src/openvpn/ssl_mbedtls.c +4 -0
index 4626e9838..8917fb188 100644
@@ -1086,6 +1086,10 @@ key_state_ssl_init(struct key_state_ssl *ks_ssl,
     {
         mbedtls_ssl_conf_curves(ks_ssl->ssl_config, ssl_ctx->groups);
     }
+    /* Disable TLS renegotiations. OpenVPN's renegotiation creates new SSL
+     * session and does not depend on this feature. And TLS renegotiations have
+     * been problematic in the past */
+    mbedtls_ssl_conf_renegotiation(ks_ssl->ssl_config, MBEDTLS_SSL_RENEGOTIATION_DISABLED);
 
     /* Disable record splitting (for now).  OpenVPN assumes records are sent
      * unfragmented, and changing that will require thorough review and
src/openvpn/ssl_openssl.c +4 -0
index d161f48b8..c311dd08e 100644
@@ -320,6 +320,10 @@ tls_ctx_set_options(struct tls_root_ctx *ctx, unsigned int ssl_flags)
     sslopt |= SSL_OP_CIPHER_SERVER_PREFERENCE;
 #endif
     sslopt |= SSL_OP_NO_COMPRESSION;
+    /* Disable TLS renegotiations. OpenVPN's renegotiation creates new SSL
+     * session and does not depend on this feature. And TLS renegotiations have
+     * been problematic in the past */
+    sslopt |= SSL_OP_NO_RENEGOTIATION;
 
     SSL_CTX_set_options(ctx->ctx, sslopt);
 
Signature · 1 line
2.30.1
Acked-by on v2 1/1
#1 lore raw

Hi,

Quoted 4 lines · Arne Schwabe

Renegotiations have been troublesome in the past and also the recent OpenSSL security problem (CVE-2021-3449) is only exploitable if TLS renegotiation is enabled.

Quoted 8 lines

mbed TLS disables it by default and says in the documentation:

Warning: It is recommended to always disable renegotation unless you know you need it and you know what you're doing. In the past, there have been several issues associated with renegotiation or a poor understanding of its properties.

TLS renegotiation can be used to restart a session with diffferent

too many f

Quoted 1 line

parameters (e.g. now with client certs). This somethign that OpenVPN does

somethign -> something

Quoted 6 lines

not use.

Furthermore because of all these problems, also TLS 1.3 completely drops support for renegotiations.

Patch V2: Improve commments and commit message

too many m :D

Quoted 2 lines

Basic connection tests passed, with OpenVPN renegotiations performed with no issue.

Signature · 1 line
Antonio Quartulli
#2 lore raw
In reply to Arne Schwabe

Hi,

src/openvpn/ssl_openssl.c tls_ctx_set_options(struct tls_root_ctx *ctx, unsigned int ssl_flags) · line 326

Quoted 4 lines · Arne Schwabe
src/openvpn/ssl_openssl.c +4 -0
+    /* Disable TLS renegotiations. OpenVPN's renegotiation creates new SSL
+     * session and does not depend on this feature. And TLS renegotiations have
+     * been problematic in the past */
+    sslopt |= SSL_OP_NO_RENEGOTIATION;

Unfortunately this seems to be not available in OpenSSL 1.0.2, which is what the OS ships on FreeBSD 11.4 (which is still supported).

../../../openvpn/src/openvpn/ssl_openssl.c:326:15: error: use of undeclared identifier

      'SSL_OP_NO_RENEGOTIATION'
    sslopt |= SSL_OP_NO_RENEGOTIATION;

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...