Skip to contentSkip to conversation

OpenVPN Versioning

Openvpn-devel James Yonan 4 participants 10 messages Jun 12, 2013 – Jun 20, 2013

lore
Share & tools
lore
#0 lore raw

I'm going to present some ideas and patches to make OpenVPN more solid in the area of versioning. The overall goal is to make OpenVPN more robust with respect to differences between client and server in OpenVPN version, TLS version, protocol capabilities, and config file grammar.

Specifically:

1. Allow one OpenVPN config file to be universally used by different clients on different platforms, even if some of the directives target capabilities only available in newer OpenVPN versions or specific kinds of platforms (i.e. mobile).

2. Allow TLS versions higher than 1.0 to be negotiated when both client and server support them.

3. Improve the flexibility of the OpenVPN protocol negotiation so that parameters such as cipher and HMAC digest can be dynamically negotiated.

Versioning robustness is also a practical security feature, because it allows gradual rollout of updated security parameters in a large network without loss of service. Security parameters might include minimum TLS version, allowed TLS ciphersuites, and OpenVPN cipher and HMAC digests.

Specific use case examples
--------------------------

(1) OpenVPN protocol negotiation: You are managing an OpenVPN server configured with the BF-128-CBC cipher. You want to upgrade to AES-128-CBC to take advantage of hardware AES acceleration on the server, but not all clients in the field support AES yet. With cipher negotiation, you could set up a mechanism where the server would negotiate AES-128-CBC with clients that support it, but downgrade to BF-128-CBC on clients that don't support either AES or the cipher negotiation capability itself.

(2) TLS version negotiation: You are managing an OpenVPN network and want to migrate to TLS 1.2 but still allow older clients to connect with TLS 1.0 for some period of time until it is phased out.

(3) Config file grammar: You are a developer and want to add a new OpenVPN config file directive, but don't want older clients to abort because they don't understand the directive.

Within these use cases are three areas where versioning is an issue, and I'll discuss each of them separately:

TLS Protocol
------------

Since day 1, OpenVPN has used TLS 1.0 as a control channel and key exchange mechanism. But now we have TLS 1.1 and 1.2, each of which addresses significant shortcomings in its predecessor. Fortunately, SSL/TLS already includes dynamic version negotiation. So I've put together a patch that leverages on this, by allowing OpenVPN client and server to negotiate the TLS version and use the highest version supported by both peers. The patch also adds a new directive "tls-version-min" that allows either client or server to specify a minimum required TLS version from the peer.

https://github.com/jamesyonan/openvpn/commit/6ee8faade224cc346d67a7f1716df4012782999a

OpenVPN Protocol
----------------

The OpenVPN protocol did not originally support handshaking, i.e. having the client and server mutually communicate their capabilities and use this info to dynamically select protocol parameters such as cipher, HMAC digest, compression algorithm, etc.

Instead of handshaking, we would manually add compatible directives to both client and server configs. But this approach is not very flexible, because in the absence of a handshaked protocol negotiation, every time a configuration change is made on the server that affects the protocol (such as cipher type), all of the client configs must also be upgraded or they will fail to connect.

To improve flexibility, we've gradually increased the amount of handshaking that occurs in the OpenVPN protocol. For example, with the recent addition of the Snappy compression algorithm, we now have a mechanism where the compression algorithm can be dynamically negotiated between client and server.

The basic mechanism for how this works is as follows:

After the TLS negotiation has succeeded but before the tunnel is active, the client communicates its capabilities to the server using a list of key/value pairs sent over the TLS control channel. We will call this the Client Capabilities List (which itself was introduced in OpenVPN 2.1 and was added to the OpenVPN protocol in a way that older clients would ignore it).

For example, running an OpenVPN 3.0 client on my mac, the following key/value pairs are sent to the server.

IV_VER=3.0
IV_PLAT=mac
IV_SNAPPY=1
IV_LZO=1

This tells the server that the client supports both Snappy and LZO compression protocols. Now that the server knows this, it can choose a protocol that it also supports, and communicate this back to the client via a pushed directive:

compress snappy

With this model, the client suggests a list of capabilities that it is willing to support, and the server makes the final selection from that list. But this also gives the client some discretion, as it can choose to veto certain capabilities by not including them in the list sent to the server. For example, suppose the client end-user chooses to disable compression. In this case, the client will simply tell the server that it doesn't support compression, i.e.

IV_VER=3.0
IV_PLAT=mac
IV_LZO_STUB=1
IV_COMP_STUB=1

The "STUB" parameters indicate support for null compression algorithms that include the compression framing byte, but don't actually compress any data.

So this basic model of the client sending a key/value list of protocol capabilities to the server, and the server responding with push directives to select the actual protocol feature can be a basic building block for adding additional negotiated features to the OpenVPN protocol.

For example, this model could be used to negotiate other protocol capabilities such as cipher and HMAC digest:

IV_CIPHER=BF-CBC,AES-128-CBC
IV_AUTH=SHA1,SHA256,SHA512

After receiving this info from the client, the server could choose a cipher and auth parameter and push it back to the client. Among other things, this requires that the client supports pushed "cipher" and "auth" directives (currently only the 3.0 core supports this). There is also the issue of the size of the Client Capabilities List. The IV_CIPHER and IV_AUTH lists might grow to be quite long, and the current Client Capabilities List is limited in size to 2048 bytes based on the TLS_CHANNEL_BUF_SIZE constant in common.h. To reduce the size, we might consider:

(a) use a single character designation for ciphers and HMAC digests, such as:

Cipher Codes:
A : BF-CBC
B : AES-128-CBC
. . .

Then communicate IV_CIPHER using the cipher codes:

IV_CIPHER=AB

This would require that the OpenVPN Project standardize on set of codes for ciphers and HMAC digests.

(b) remove the 2048 byte limitation on the Client Capabilities List. The limitation arises because of the packetization of messages over the OpenVPN control channel. One way to resolve this would be to standardize on a continuation marker that tells the peer that another packet of Client Capabilities List data is forthcoming. This would be similar to how the same problem was solved with the pushed directives list using continuations.

Rather than choosing either (a) or (b) I would suggest implementing them both. The number of ciphers and digests is always increasing and using a one or two-character code to denote a cipher or digest will make the Client Capabilities List smaller and faster to pass over the wire. It would also be good to fix (b) since it seems like an arbitrary limitation that could cause issues as the Client Capabilities List grows.

Config file grammar
-------------------

Originally, OpenVPN was strict about config file directives that it didn't recognize -- it was a fatal error to specify an unrecognized directive.

In many cases this is beneficial for security in the sense that a directive such as ns-cert-type or tls-remote, if not understood by the client and ignored, could render the connection much less secure than intended.

But it also reduces flexibility because it makes adding new directives unnecessarily difficult if the new directive crashes an older client that doesn't yet recognize it.

One solution that was introduced in OpenVPN 2.1 added a new directive that would cause any unrecognized directive to be ignored.

setenv FORWARD_COMPATIBLE 1

In hindsight, this is probably too broad. It would be better to allow individual directives to specify whether older clients that don't recognize them should ignore them or abort.

I've put together a new (and very small) patch that I believe solves the problem in a better way.

https://github.com/jamesyonan/openvpn/commit/037690df22a4604a556c9b470d1f5e891991834b

This patch defines a new directive prefix "setenv opt" that if prepended to an existing directive, will cause it to be ignored by clients that don't understand it (starting the directive with "setenv" is useful because OpenVPN clients going back to 2.0 don't really care what comes after the "setenv", so older clients should simply ignore the prefix).

To look at an example, the TLS versioning patch above adds a new directive "tls-version-min" to set the minimum allowed TLS version used by the peer. Example client usage might be:

tls-version-min 1.2

Suppose I want to put this directive in the config files I distribute to clients, but have it be ignored by older clients that don't recognize it. I could do this as follows on the client:

setenv opt tls-version-min 1.2

Suppose I also want to handle the case where some clients understand the tls-version-min directive but are not linked with an SSL library that supports TLS 1.2. To allow these clients to gracefully degrade to the highest TLS version they can support, a variation of the directive could be used on the client:

setenv opt tls-version-min 1.2 or-highest

Now suppose that after some upgrade period, we now want to require that all clients connect at TLS 1.2 or higher, and that 1.1 and 1.0 are no longer allowed. This can be done by limiting TLS to 1.2 or higher on the server:

tls-version-min 1.2

James

#1 lore raw

Am 12.06.13 21:38, schrieb James Yonan:

About finding out which cipher client and server use. I am not really familiar with this code so forgive my stupid question. TLS somehow also does this "select the best cipher to use" dance. Why can't we use the TLS mechanism but have to use our own IV_CIPHER?

Quoted 5 lines

Suppose I want to put this directive in the config files I distribute to clients, but have it be ignored by older clients that don't recognize it. I could do this as follows on the client:

setenv opt tls-version-min 1.2

I suppose this a good idea too also support older client. I would to *additionally* add a way to support this in a nicer way for future release. Like also adding an option

ignore-unknown-options tls-version new-cool-option

so newer can some day can still be written with having to use "setenv opt"

Loosly related this would also allow to give use a "default" set of options that can be ignored (ip-win32 on *nix)

Arne

#2 lore raw
Quoted 6 lines · Arne Schwabe

Am 12.06.13 21:38, schrieb James Yonan:

About finding out which cipher client and server use. I am not really familiar with this code so forgive my stupid question. TLS somehow also does this "select the best cipher to use" dance. Why can't we use the TLS mechanism but have to use our own IV_CIPHER?

TLS includes a handshake mechanism for TLS version and ciphersuite selection. In TLS, a single ciphersuite specifies a set of cipher, mode, keysize, MAC digest, etc., while in OpenVPN the cipher and HMAC digest are separately selected by cipher and auth directives.

Historically, OpenVPN has never implemented any interaction between the TLS ciphersuite selection and the cipher/auth selection for the OpenVPN protocol -- they are completely decoupled from one another, so using TLS negotiation isn't going to have any effect on OpenVPN cipher/auth.

But you raise an interesting point that we might want to explore, i.e. looking at the TLS ciphersuite that ends up getting negotiated, and extract the cipher/auth directive from that since you know it will be consistent on both client and server.

Quoted 4 lines
Quoted 4 lines

Suppose I want to put this directive in the config files I distribute to clients, but have it be ignored by older clients that don't recognize it. I could do this as follows on the client:

Quoted 8 lines
Quoted 1 line

setenv opt tls-version-min 1.2

I suppose this a good idea too also support older client. I would to *additionally* add a way to support this in a nicer way for future release. Like also adding an option

ignore-unknown-options tls-version new-cool-option

so newer can some day can still be written with having to use "setenv opt"

Sure, that makes sense.

Quoted 2 lines

Loosly related this would also allow to give use a "default" set of options that can be ignored (ip-win32 on *nix)

Deciding whether or not to ignore options is tricky. With the new 3.0 core, it was necessary to ignore some options because they are simply not implemented, and raising an error for every unimplemented option would make it very difficult upgrade to 3.0 in a way that maintains reasonable config file compatibility with 2.x.

So the approach I took for 3.0 was to only raise an error on unimplemented options where ignoring the option might compromise security. Initially tls-remote fell under this category, but it has since been implemented in the 3.0 core.

James

#3 lore raw
In reply to James Yonan

From James Yonan <[email protected]...>:

Quoted 13 lines

TLS Protocol
------------

Since day 1, OpenVPN has used TLS 1.0 as a control channel and key exchange mechanism. But now we have TLS 1.1 and 1.2, each of which addresses significant shortcomings in its predecessor. Fortunately, SSL/TLS already includes dynamic version negotiation. So I've put together a patch that leverages on this, by allowing OpenVPN client and server to negotiate the TLS version and use the highest version supported by both peers. The patch also adds a new directive "tls- version-min" that allows either client or server to specify a minimum required TLS version from the peer.

Quoted 3 lines

https://github.com/jamesyonan/openvpn/commit/6ee8faade224cc346d67a7f17
1
6df4012782999a

Some comments on the design and implementation here. (I've just looked at the code, not tested it.)

I'm confused by your comments about TLS/SSL versions used. Our own builds using PolarSSL do negotiate TLSv1.1 and TLSv1.2 between themselves and when interoperating with OpenSSL, logging "Control Channel: TLSv1.1, cipher XXX" or even "Control Channel: TLSv1.2, cipher XXX". In general, the highest version supported by both client and server is used, as is normally the case with SSL. However, stock Ubuntu OpenVPN seems to negotiate TLSv1. Huh?

I'm not sure what purpose the "or-highest" serves. Clients already connect with the newest protocol supported by both client and server; if you want to run a TLSv1.2-only network, just set min-version to 1.2 on the server. If you're an especially competent and paranoid user, you might want to set min-version on the client, but in that case you hardly need an "or-highest", since you know which cipher suites your client supports.

Some of the whitespace looks odd/wrong.

Does the change to key_state_ssl_init() do anything?

The variables polar_{major,minor} in ssl_polarssl.c should be renamed, probably to something like ssl_{major,minor}_version - it's not a PolarSSL version.

The switch(tls_version_min) needs a default case, just compile the first case/default: unconditionally.

Quoted 23 lines

OpenVPN Protocol
----------------

[Handshaking] could be used to negotiate other protocol capabilities such as cipher and HMAC digest:

   IV_CIPHER=BF-CBC,AES-128-CBC
   IV_AUTH=SHA1,SHA256,SHA512

(...) There
is also the issue of the size of the Client Capabilities List. The IV_CIPHER and IV_AUTH lists might grow to be quite long (...) To reduce the size, we might
consider:

(a) use a single character designation for ciphers and HMAC digests, such as:

Cipher Codes:
A : BF-CBC
B : AES-128-CBC
. . .

Quoted 6 lines

Then communicate IV_CIPHER using the cipher codes:

IV_CIPHER=AB

This would require that the OpenVPN Project standardize on set of codes for ciphers and HMAC digests.

This is a good idea in general, but why not use SSL cipher suites (which already have standardized binary representations)? That has the added advantage of itting AEAD suites like AES-GCM, which are getting more important. (We may need to add some, but note that the { 0xff, X } "namespace" is available for "local and experimental" cipher suites.)

Negotiating ciphers might be fatal in some configurations that were a bad idea to begin with. E.g. if you use OpenVPN with a static key and --auth none (which is a bad idea!), adding this negotation could allow an attacker to set the cipher to none or, more dangerously, to a very weak cipher like DES (provided it is mutually supported). An attacker could then bruteforce the key and use his knowledge of 56 bits of the key to attack stronger protocols like AES or 3DES. (Or do we only negotiate in SSL mode? I must admit to being fuzzy on the non-SSL mode.)

Joachim

#4 lore raw
Quoted 14 lines · Joachim Schipper
Quoted 14 lines

From James Yonan <[email protected]...>:
TLS Protocol
------------

Since day 1, OpenVPN has used TLS 1.0 as a control channel and key exchange mechanism. But now we have TLS 1.1 and 1.2, each of which addresses significant shortcomings in its predecessor. Fortunately, SSL/TLS already includes dynamic version negotiation. So I've put together a patch that leverages on this, by allowing OpenVPN client and server to negotiate the TLS version and use the highest version supported by both peers. The patch also adds a new directive "tls- version-min" that allows either client or server to specify a minimum required TLS version from the peer.

Quoted 7 lines
Quoted 3 lines

https://github.com/jamesyonan/openvpn/commit/6ee8faade224cc346d67a7f17
1
6df4012782999a

Some comments on the design and implementation here. (I've just looked at the code, not tested it.)

I'm confused by your comments about TLS/SSL versions used. Our own builds using PolarSSL do negotiate TLSv1.1 and TLSv1.2 between themselves and when interoperating with OpenSSL, logging "Control Channel: TLSv1.1, cipher XXX" or even "Control Channel: TLSv1.2, cipher XXX". In general, the highest version supported by both client and server is used, as is normally the case with SSL. However, stock Ubuntu OpenVPN seems to negotiate TLSv1. Huh?

PolarSSL dynamically negotiates the TLS version within the bounds set by ssl_set_min_version and ssl_set_max_version. If these methods haven't been called, as is the case with OpenVPN 2.3.2 and earlier, then the highest version supported by both peers will be used. So even in the absence of my patch, PolarSSL if used by both client and server, could negotiate a higher version than TLS 1.0.

OpenSSL, however, does not appear to negotiate a version other than TLS 1.0 if TLSv1_server_method() or TLSv1_client_method() is passed to SSL_CTX_new, as is done by all versions of OpenVPN up to 2.3.2.

To get the adaptive versioning behavior in OpenSSL, you have to use SSLv23_server_method() or SSLv23_client_method() and then explicitly disable the versions you don't want to consider, i.e. SSL_OP_NO_SSLv2, SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, etc.

Quoted 1 line

I'm not sure what purpose the "or-highest" serves. Clients already connect with the newest protocol supported by both client and server; if you want to run a TLSv1.2-only network, just set min-version to 1.2 on the server. If you're an especially competent and paranoid user, you might want to set min-version on the client, but in that case you hardly need an "or-highest", since you know which cipher suites your client supports.

Suppose a server admin wants to upgrade to TLS 1.2 over some transition period, to allow time to upgrade existing clients in the field.

At the end of the transition period, tls-version-min 1.2 would be added to the server config, but this can't be done immediately or it might lock out older clients (using TLS 1.0) before they have a chance to upgrade.

So a transition plan could start by distributing client config files containing:

setenv opt tls-version-min 1.2 or-highest

Older OpenVPN versions that don't understand tls-version-min would simply ignore it, under the presumption that these clients would be upgraded before the end of the transition period.

Newer versions of OpenVPN that understand tls-version-min and are linked with SSL libraries that support TLS 1.2 would force a TLS 1.2 connection with server, so they would be immune to any version rollback attack where a MiTM tries to force a lower version negotiation.

However there is a middle ground here: what about OpenVPN clients that understand tls-version-min but are not linked with an SSL library that implements TLS 1.2. The "or-highest" tells the client to use the highest TLS version supported by their SSL library as the tls-version-min parameter.

If "or-highest" wasn't used, and the SSL lib doesn't implement TLS 1.2, then an error would be given that TLS 1.2 is an unrecognized TLS version.

The overall goal here is to provide tools that allow a controlled rollout of TLS 1.2 that doesn't break any clients during the rollout period, and to upgrade to 1.2 in a way that doesn't create the potential for MiTM version rollback attacks.

Quoted 1 line

Some of the whitespace looks odd/wrong.

Ok.

Quoted 1 line

Does the change to key_state_ssl_init() do anything?

I had to add ssl_flags (containing tls-version-min parameter) to key_state_ssl_init because that seems like the most appropriate place to configure tls-version-min for PolarSSL.

For OpenSSL, tls_ctx_set_options is the right place to configure tls-version-min.

Quoted 1 line

The variables polar_{major,minor} in ssl_polarssl.c should be renamed, probably to something like ssl_{major,minor}_version - it's not a PolarSSL version.

Sure.

Quoted 1 line

The switch(tls_version_min) needs a default case, just compile the first case/default: unconditionally.

There is a default case already -- it's right under "case TLS_VER_1_0:".

Quoted 24 lines
Quoted 24 lines

OpenVPN Protocol
----------------

[Handshaking] could be used to negotiate other protocol capabilities such as cipher and HMAC digest:

    IV_CIPHER=BF-CBC,AES-128-CBC
    IV_AUTH=SHA1,SHA256,SHA512

(...) There
is also the issue of the size of the Client Capabilities List. The IV_CIPHER and IV_AUTH lists might grow to be quite long (...) To reduce the size, we might
consider:

(a) use a single character designation for ciphers and HMAC digests, such as:

Cipher Codes:

   A : BF-CBC
   B : AES-128-CBC
   . . .
Quoted 8 lines
Quoted 6 lines

Then communicate IV_CIPHER using the cipher codes:

IV_CIPHER=AB

This would require that the OpenVPN Project standardize on set of codes for ciphers and HMAC digests.

This is a good idea in general, but why not use SSL cipher suites (which already have standardized binary representations)? That has the added advantage of itting AEAD suites like AES-GCM, which are getting more important. (We may need to add some, but note that the { 0xff, X } "namespace" is available for "local and experimental" cipher suites.)

I do like the idea of using SSL ciphersuites. There are two ways this could be done:

(1) extract cipher/auth parameters from the ciphersuite name, using some sort of lookup table. The problem here is that some SSL ciphersuites might not be implemented yet in OpenVPN. For example, if the TLS ciphersuite is AES-GCM, it would require a version of OpenVPN that understands GCM mode. Another way to handle this would be to have the OpenVPN peer limit the ciphersuites it advertises/accepts to those which have a supported cipher/auth translation in OpenVPN.

(2) have OpenVPN actually encrypt/decrypt/MAC data channel packets using the ciphersuite algorithm implementation in the underlying SSL library. The main issue here is that SSL implementations don't generally expose
an API allowing library clients to directly access the ciphersuite algorithm implementations.

Quoted 1 line

Negotiating ciphers might be fatal in some configurations that were a bad idea to begin with. E.g. if you use OpenVPN with a static key and --auth none (which is a bad idea!), adding this negotation could allow an attacker to set the cipher to none or, more dangerously, to a very weak cipher like DES (provided it is mutually supported). An attacker could then bruteforce the key and use his knowledge of 56 bits of the key to attack stronger protocols like AES or 3DES. (Or do we only negotiate in SSL mode? I must admit to being fuzzy on the non-SSL mode.)

Static key mode has no negotiation.

Agreed that any negotiation model must have constraints placed on the security of the negotiated cipher and HMAC digest. You would probably want to disable "cipher none" or "auth none" on the presumption that users who want a cleartext tunnel would explicitly configure the client and server for this.

One thing to keep in mind is that OpenVPN protocol negotiation occurs over the already-negotiated TLS session, so it is immune to being tampered with by a MiTM. This is in contrast to SSL/TLS where a MiTM can affect the negotiation.

James

#5 lore raw
Quoted 5 lines · James Yonan

To get the adaptive versioning behavior in OpenSSL, you have to use SSLv23_server_method() or SSLv23_client_method() and then explicitly disable the versions you don't want to consider, i.e. SSL_OP_NO_SSLv2, SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, etc.

Wow, so SSLv23_{client,server}_method() is the 'wildcard' you need to dynamically negotiate the version. Yet it sounds like something completely broken that should be avoided at all cost. OpenSSL keeps amazing me.

Quoted 9 lines
Quoted 1 line

Does the change to key_state_ssl_init() do anything?

I had to add ssl_flags (containing tls-version-min parameter) to key_state_ssl_init because that seems like the most appropriate place to configure tls-version-min for PolarSSL.

For OpenSSL, tls_ctx_set_options is the right place to configure tls-version-min.

The ssl_flags are already available through the tls session that is passed as the fourth parameter. To make this a bit more clear, commit b97e2c3 changed the type of session to struct tls session* (see
https://github.com/OpenVPN/openvpn/commit/b97e2c3c90afdbb1a24bc1357ec6b94d626defcd).

-Steffan

#6 lore raw
Quoted 10 lines · Steffan Karger
Quoted 5 lines · James Yonan

To get the adaptive versioning behavior in OpenSSL, you have to use SSLv23_server_method() or SSLv23_client_method() and then explicitly disable the versions you don't want to consider, i.e. SSL_OP_NO_SSLv2, SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, etc.

Wow, so SSLv23_{client,server}_method() is the 'wildcard' you need to dynamically negotiate the version. Yet it sounds like something completely broken that should be avoided at all cost. OpenSSL keeps amazing me.

It really shows OpenSSL's age, doesn't it? But aside from the cruftiness, I wouldn't say that it's broken. It's arguably a more flexible mechanism than PolarSSL because it allows you to cherry-pick the SSL/TLS versions you want to support, rather than just give a min/max range.

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

Does the change to key_state_ssl_init() do anything?

I had to add ssl_flags (containing tls-version-min parameter) to key_state_ssl_init because that seems like the most appropriate place to configure tls-version-min for PolarSSL.

Quoted 7 lines
Quoted 3 lines

For OpenSSL, tls_ctx_set_options is the right place to configure tls-version-min.

The ssl_flags are already available through the tls session that is passed as the fourth parameter. To make this a bit more clear, commit b97e2c3 changed the type of session to struct tls session* (see
https://github.com/OpenVPN/openvpn/commit/b97e2c3c90afdbb1a24bc1357ec6b94d626defcd).

Right, I've rebased the patch against master and now use session->opt->ssl_flags

This simplifies the patch because now it's no longer necessary to pass ssl_flags to key_state_ssl_init

https://github.com/jamesyonan/openvpn/commit/03a5599202bdc3ba07983dc4efdae387fb8fb436

James

#7 lore raw
In reply to James Yonan

From: James Yonan <[email protected]...>:

Quoted 13 lines · Joachim Schipper
Quoted 4 lines
Quoted 4 lines

From James Yonan <[email protected]...>:
TLS Protocol
------------

Quoted 8 lines
Quoted 8 lines

Since day 1, OpenVPN has used TLS 1.0 as a control channel and key exchange mechanism. But now we have TLS 1.1 and 1.2, each of which addresses significant shortcomings in its predecessor. Fortunately, SSL/TLS already includes dynamic version negotiation. So I've put together a patch that leverages on this, by allowing OpenVPN client and server to negotiate the TLS version and use the highest version supported by both peers. The patch also adds a new directive "tls- version-min" that allows either client or server to specify a

Quoted 8 lines

minimum

Quoted 3 lines
Quoted 3 lines

required TLS version from the peer.

https://github.com/jamesyonan/openvpn/commit/6ee8faade224cc346d67a7f1

Quoted 3 lines
Quoted 3 lines

7
1
6df4012782999a

[snip: SSL negotiation. Thanks for the explanation; I agree that speaking the highest supported protocol is good.]

Quoted 5 lines
Quoted 1 line

I'm not sure what purpose the "or-highest" serves. Clients already

connect with the newest protocol supported by both client and server; if you want to run a TLSv1.2-only network, just set min-version to 1.2 on the server. (...)

Quoted 7 lines

Suppose a server admin wants to upgrade to TLS 1.2 over some transition period, to allow time to upgrade existing clients in the field.

The overall goal here is to provide tools that allow a controlled rollout of TLS 1.2 that doesn't break any clients during the rollout period, and to upgrade to 1.2 in a way that doesn't create the potential for MiTM version rollback attacks.

But no modern SSL protocol allows version rollback attacks: modern implementations will always speak the highest supported/configured protocol version between each other. (Only) SSLv2 allows rollback attacks, which is why the only sane way to deal with SSLv2 in 2013 is to unconditionally disable support.

Quoted 5 lines
Quoted 1 line

The switch(tls_version_min) needs a default case, just compile the

first case/default: unconditionally.

There is a default case already -- it's right under "case TLS_VER_1_0:".

Yes, but that's #ifdef'ed. I'd be happier if the default case remained present even if PolarSSL foolishly decides to drop TLSv1 support.

[snip: ciphersuites]

Quoted 11 lines
Quoted 3 lines

Negotiating ciphers might be fatal in some configurations that were a bad idea to begin with. E.g. if you use OpenVPN with a static key and --auth none (which is a bad idea!), adding this negotation could

allow

Quoted 6 lines

an attacker to set the cipher to none or, more dangerously, to a very weak cipher like DES (provided it is mutually supported). An attacker could then bruteforce the key and use his knowledge of 56 bits of the key to attack stronger protocols like AES or 3DES. (Or do we only negotiate in SSL mode? I must admit to being fuzzy on the non-SSL mode.)

Quoted 7 lines

Static key mode has no negotiation.

Agreed that any negotiation model must have constraints placed on the security of the negotiated cipher and HMAC digest. You would probably want to disable "cipher none" or "auth none" on the presumption that users who want a cleartext tunnel would explicitly configure the client and server for this.

Sure. Just disabling negotiations unless you have an SSL'd control channel works fine against this.

Quoted 4 lines

One thing to keep in mind is that OpenVPN protocol negotiation occurs over the already-negotiated TLS session, so it is immune to being tampered with by a MiTM. This is in contrast to SSL/TLS where a MiTM can affect the negotiation.

As above, MiTM attackers cannot effect the negotiation step in SSL/TLS
protocols after SSLv2, except trivially (by causing the negotiation to fail, possibly a couple of protocol steps later, e.g. by dropping all packets.)

Joachim

#8 lore raw
Quoted 39 lines · Joachim Schipper

From: James Yonan <[email protected]...>:

Quoted 13 lines · Joachim Schipper
Quoted 4 lines
Quoted 4 lines

From James Yonan <[email protected]...>:
TLS Protocol
------------

Quoted 8 lines
Quoted 8 lines

Since day 1, OpenVPN has used TLS 1.0 as a control channel and key exchange mechanism. But now we have TLS 1.1 and 1.2, each of which addresses significant shortcomings in its predecessor. Fortunately, SSL/TLS already includes dynamic version negotiation. So I've put together a patch that leverages on this, by allowing OpenVPN client and server to negotiate the TLS version and use the highest version supported by both peers. The patch also adds a new directive "tls- version-min" that allows either client or server to specify a

Quoted 8 lines

minimum

Quoted 3 lines
Quoted 3 lines

required TLS version from the peer.

https://github.com/jamesyonan/openvpn/commit/6ee8faade224cc346d67a7f1

Quoted 3 lines
Quoted 3 lines

7
1
6df4012782999a

[snip: SSL negotiation. Thanks for the explanation; I agree that speaking the highest supported protocol is good.]

Quoted 5 lines
Quoted 1 line

I'm not sure what purpose the "or-highest" serves. Clients already

connect with the newest protocol supported by both client and server; if you want to run a TLSv1.2-only network, just set min-version to 1.2 on the server. (...)

Quoted 7 lines

Suppose a server admin wants to upgrade to TLS 1.2 over some transition period, to allow time to upgrade existing clients in the field.

The overall goal here is to provide tools that allow a controlled rollout of TLS 1.2 that doesn't break any clients during the rollout period, and to upgrade to 1.2 in a way that doesn't create the potential for MiTM version rollback attacks.

Quoted 5 lines

But no modern SSL protocol allows version rollback attacks: modern implementations will always speak the highest supported/configured protocol version between each other. (Only) SSLv2 allows rollback attacks, which is why the only sane way to deal with SSLv2 in 2013 is to unconditionally disable support.

Right, and the patch is able to unconditionally disable support for SSL 2 and 3 since these were never supported by even the earliest versions of OpenVPN.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

The switch(tls_version_min) needs a default case, just compile the

first case/default: unconditionally.

There is a default case already -- it's right under "case TLS_VER_1_0:".

Yes, but that's #ifdef'ed. I'd be happier if the default case remained present even if PolarSSL foolishly decides to drop TLSv1 support.

Agreed -- there shouldn't be any implicit assumption that SSL lib might not implement TLS 1.0.

https://github.com/jamesyonan/openvpn/commit/d23005413b0e0f28a3c48a6342f494763d5c9b40

Quoted 23 lines

[snip: ciphersuites]

Quoted 11 lines
Quoted 3 lines

Negotiating ciphers might be fatal in some configurations that were a bad idea to begin with. E.g. if you use OpenVPN with a static key and --auth none (which is a bad idea!), adding this negotation could

allow

Quoted 6 lines

an attacker to set the cipher to none or, more dangerously, to a very weak cipher like DES (provided it is mutually supported). An attacker could then bruteforce the key and use his knowledge of 56 bits of the key to attack stronger protocols like AES or 3DES. (Or do we only negotiate in SSL mode? I must admit to being fuzzy on the non-SSL mode.)

Quoted 7 lines

Static key mode has no negotiation.

Agreed that any negotiation model must have constraints placed on the security of the negotiated cipher and HMAC digest. You would probably want to disable "cipher none" or "auth none" on the presumption that users who want a cleartext tunnel would explicitly configure the client and server for this.

Sure. Just disabling negotiations unless you have an SSL'd control channel works fine against this.

Quoted 7 lines
Quoted 4 lines

One thing to keep in mind is that OpenVPN protocol negotiation occurs over the already-negotiated TLS session, so it is immune to being tampered with by a MiTM. This is in contrast to SSL/TLS where a MiTM can affect the negotiation.

As above, MiTM attackers cannot effect the negotiation step in SSL/TLS
protocols after SSLv2, except trivially (by causing the negotiation to fail, possibly a couple of protocol steps later, e.g. by dropping all packets.)

Aha, that's good to know. Apparently browsers are still vulnerable to version rollback attacks due to compatibility fallback mechanisms, but that's great that SSL/TLS protocols are immune above SSL 3. There's a good writeup on the subject here:

http://www.carbonwind.net/blog/post/Random-SSLTLS-101%E2%80%93SSLTLS-version-rollbacks-and-browsers.aspx

James

#9 lore raw

From James Yonan <[email protected]...>:

Quoted 35 lines · Joachim Schipper
Quoted 19 lines

From James Yonan <[email protected]...>:

Quoted 18 lines · Joachim Schipper
Quoted 17 lines
Quoted 4 lines

From James Yonan <[email protected]...>:
TLS Protocol
------------

Quoted 10 lines

Since day 1, OpenVPN has used TLS 1.0 as a control channel and key exchange mechanism. But now we have TLS 1.1 and 1.2, each of which addresses significant shortcomings in its predecessor. Fortunately, SSL/TLS already includes dynamic version negotiation. So I've put together a patch that leverages on this, by allowing OpenVPN client and server to negotiate the TLS version and use the highest version supported by both peers. The patch also adds a new directive "tls- version-min" that allows either client or server to specify a minimum
required TLS version from the peer.

I'm not sure what purpose the "or-highest" serves. Clients already connect with the newest protocol supported by both client and

server;

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

if you want to run a TLSv1.2-only network, just set min-version to 1.2 on the server. (...)

The overall goal here is to provide tools that allow a controlled rollout of TLS 1.2 that doesn't break any clients during the rollout period, and to upgrade to 1.2 in a way that doesn't create the potential for MiTM version rollback attacks.

Quoted 5 lines

But no modern SSL protocol allows version rollback attacks: modern implementations will always speak the highest supported/configured protocol version between each other. (Only) SSLv2 allows rollback attacks, which is why the only sane way to deal with SSLv2 in 2013 is to unconditionally disable support.

Quoted 3 lines

Right, and the patch is able to unconditionally disable support for SSL 2 and 3 since these were never supported by even the earliest versions of OpenVPN.

Ack.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

The switch(tls_version_min) needs a default case, just compile the

first case/default: unconditionally.

There is a default case already -- it's right under "case TLS_VER_1_0:".

Yes, but that's #ifdef'ed. I'd be happier if the default case

Quoted 8 lines

remained

Quoted 1 line

present even if PolarSSL foolishly decides to drop TLSv1 support.

Agreed -- there shouldn't be any implicit assumption that SSL lib might not implement TLS 1.0.

https://github.com/jamesyonan/openvpn/commit/d23005413b0e0f28a3c48a6342
f494763d5c9b40

Looks good.

Quoted 14 lines
Quoted 1 line
Quoted 1 line

One thing to keep in mind is that OpenVPN protocol negotiation

occurs

Quoted 2 lines
Quoted 2 lines

over the already-negotiated TLS session, so it is immune to being tampered with by a MiTM. This is in contrast to SSL/TLS where a

MiTM

Quoted 3 lines
Quoted 1 line

can affect the negotiation.

As above, MiTM attackers cannot effect the negotiation step in

SSL/TLS

Quoted 1 line

protocols after SSLv2, except trivially (by causing the negotiation

to

Quoted 2 lines

fail, possibly a couple of protocol steps later, e.g. by dropping all packets.)

Quoted 7 lines

Aha, that's good to know. Apparently browsers are still vulnerable to version rollback attacks due to compatibility fallback mechanisms, but that's great that SSL/TLS protocols are immune above SSL 3. There's a good writeup on the subject here:

http://www.carbonwind.net/blog/post/Random-SSLTLS-101%E2%80%93SSLTLS-
version-rollbacks-and-browsers.aspx

Mmm, I didn't know that "falls back to SSLv2 handshakes" was among IE6's long list of flaws. The rest isn't too serious, and note that this is specifically talking about browsers, not SSL itself. Still, good to know; thanks for the link.

Still, SSL is not the protocol we would design today, but this part works.

Joachim