Skip to contentSkip to conversation

Fix illegal client float

PATCH Superseded Lev Stipakov 4 participants 6 messages Apr 13, 2020 – Apr 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix illegal client float

From: Lev Stipakov <[email protected]...>

There is a time frame between allocating peer-id and initializing data channel key, which is performed on receiving push request.

If a "rogue" data channel packet arrives during that time frame from another address and with same peer-id, this would cause client to float to that new address. This is because:

- tls_pre_decrypt() sets buffer length to zero if data channel key has not been initialized, which leads to

- openvpn_decrypt() returns true if buffer length is zero,
which leads to

- process_incoming_link_part1() returns true, which
calls multi_process_float(), which commits float

Note that problem doesn't happen when data channel key is initialized, since in this case openvpn_decrypt() returns false.

Fix illegal float by adding buffer length check before calling multi_process_float().

This should fix Trac #1272.

---
 src/openvpn/multi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/multi.c +1 -1
index da0aeeba..58892a87 100644
@@ -2555,7 +2555,7 @@ multi_process_incoming_link(struct multi_context *m, struct multi_instance *inst
             orig_buf = c->c2.buf.data;
             if (process_incoming_link_part1(c, lsi, floated))
             {
-                if (floated)
+                if (floated && c->c2.buf.len > 0)
                 {
                     multi_process_float(m, m->pending);
                 }
Signature · 1 line
2.17.1
#1 lore raw

Am 13.04.20 um 17:56 schrieb Lev Stipakov:

Quoted 37 lines

From: Lev Stipakov <[email protected]...>

There is a time frame between allocating peer-id and initializing data channel key, which is performed on receiving push request.

If a "rogue" data channel packet arrives during that time frame from another address and with same peer-id, this would cause client to float to that new address. This is because:

- tls_pre_decrypt() sets buffer length to zero if data channel key has not been initialized, which leads to

- openvpn_decrypt() returns true if buffer length is zero,
which leads to

- process_incoming_link_part1() returns true, which
calls multi_process_float(), which commits float

Note that problem doesn't happen when data channel key is initialized, since in this case openvpn_decrypt() returns false.

Fix illegal float by adding buffer length check before calling multi_process_float().

This should fix Trac #1272.

---
 src/openvpn/multi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/multi.c +0 -0
index da0aeeba..58892a87 100644

src/openvpn/multi.c multi_process_incoming_link(struct multi_context *m, struct multi_instance *inst · line 2561

Quoted 8 lines
src/openvpn/multi.c +1 -1
@@ -2555,7 +2555,7 @@ multi_process_incoming_link(struct multi_context *m, struct multi_instance *inst
             orig_buf = c->c2.buf.data;
             if (process_incoming_link_part1(c, lsi, floated))
             {
-                if (floated)
+                if (floated && c->c2.buf.len > 0)
                 {
                     multi_process_float(m, m->pending);
                 }

I think the commit is right but should we add a comment here saying that len >0 is required to have valid decrypted packet?

Arne

#2 lore raw

PATCH v2 1/1 Fix illegal client float

From: Lev Stipakov <[email protected]...>

There is a time frame between allocating peer-id and initializing data channel key, which is performed on receiving push request.

If a "rogue" data channel packet arrives during that time frame from another address and with same peer-id, this would cause client to float to that new address. This is because:

- tls_pre_decrypt() sets packet length to zero if data channel key has not been initialized, which leads to

- openvpn_decrypt() returns true if packet length is zero,
which leads to

- process_incoming_link_part1() returns true, which
calls multi_process_float(), which commits float

Note that problem doesn't happen when data channel key is initialized, since in this case openvpn_decrypt() returns false.

Fix illegal float by adding buffer length check before calling multi_process_float().

This should fix Trac #1272.

---
v2: add comment explaning why nonzero check needed

 src/openvpn/multi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/openvpn/multi.c +2 -1
index da0aeeba..37d2a6f2 100644
@@ -2555,7 +2555,8 @@ multi_process_incoming_link(struct multi_context *m, struct multi_instance *inst
             orig_buf = c->c2.buf.data;
             if (process_incoming_link_part1(c, lsi, floated))
             {
-                if (floated)
+                /* nonzero length means that we have a valid, decrypted packed */
+                if (floated && c->c2.buf.len > 0)
                 {
                     multi_process_float(m, m->pending);
                 }
Signature · 1 line
2.24.1 (Apple Git-126)
Acked-by on v2 1/1
#3 lore raw

Am 15.04.20 um 09:30 schrieb Lev Stipakov:

Quoted 39 lines

From: Lev Stipakov <[email protected]...>

There is a time frame between allocating peer-id and initializing data channel key, which is performed on receiving push request.

If a "rogue" data channel packet arrives during that time frame from another address and with same peer-id, this would cause client to float to that new address. This is because:

- tls_pre_decrypt() sets packet length to zero if data channel key has not been initialized, which leads to

- openvpn_decrypt() returns true if packet length is zero,
which leads to

- process_incoming_link_part1() returns true, which
calls multi_process_float(), which commits float

Note that problem doesn't happen when data channel key is initialized, since in this case openvpn_decrypt() returns false.

Fix illegal float by adding buffer length check before calling multi_process_float().

This should fix Trac #1272.

---
v2: add comment explaning why nonzero check needed

 src/openvpn/multi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/openvpn/multi.c +0 -0
index da0aeeba..37d2a6f2 100644

src/openvpn/multi.c multi_process_incoming_link(struct multi_context *m, struct multi_instance *inst · line 2562

Quoted 9 lines
src/openvpn/multi.c +2 -1
@@ -2555,7 +2555,8 @@ multi_process_incoming_link(struct multi_context *m, struct multi_instance *inst
             orig_buf = c->c2.buf.data;
             if (process_incoming_link_part1(c, lsi, floated))
             {
-                if (floated)
+                /* nonzero length means that we have a valid, decrypted packed */
+                if (floated && c->c2.buf.len > 0)
                 {
                     multi_process_float(m, m->pending);
                 }

Thanks!

#4 lore raw

Hi,

Quoted 51 lines · Arne Schwabe

Am 15.04.20 um 09:30 schrieb Lev Stipakov:

Quoted 39 lines

From: Lev Stipakov <[email protected]...>

There is a time frame between allocating peer-id and initializing data channel key, which is performed on receiving push request.

If a "rogue" data channel packet arrives during that time frame from another address and with same peer-id, this would cause client to float to that new address. This is because:

- tls_pre_decrypt() sets packet length to zero if data channel key has not been initialized, which leads to

- openvpn_decrypt() returns true if packet length is zero,
which leads to

- process_incoming_link_part1() returns true, which
calls multi_process_float(), which commits float

Note that problem doesn't happen when data channel key is initialized, since in this case openvpn_decrypt() returns false.

Fix illegal float by adding buffer length check before calling multi_process_float().

This should fix Trac #1272.

---
v2: add comment explaning why nonzero check needed

 src/openvpn/multi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/openvpn/multi.c +0 -0
index da0aeeba..37d2a6f2 100644

src/openvpn/multi.c multi_process_incoming_link(struct multi_context *m, struct multi_instance *inst · line 2562

Quoted 9 lines
src/openvpn/multi.c +2 -1
@@ -2555,7 +2555,8 @@ multi_process_incoming_link(struct multi_context *m, struct multi_instance *inst
             orig_buf = c->c2.buf.data;
             if (process_incoming_link_part1(c, lsi, floated))
             {
-                if (floated)
+                /* nonzero length means that we have a valid, decrypted packed */
+                if (floated && c->c2.buf.len > 0)
                 {
                     multi_process_float(m, m->pending);
                 }

Thanks!

Quoted 1 line

just went through the entire flow with Lev and David and this all makes a lot of sense now. Couldn't come up with a better fix for this issue.

Signature · 1 line
Antonio Quartulli
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: Fix illegal client float (CVE-2020-11810)

In reply to Lev Stipakov

Your patch has been applied to the master and release/2.4 branch (bugfix).

I have amended the commit message to make it more clear what is the risk (DoS against another random user of the same server, but no traffic injection or stealing)

Code change is "obviously correct". Have still given it a t_client run for good measure :-)

commit 37bc691e7d26ea4eb61a8a434ebd7a9ae76225ab (master) commit f7b318f811bb43c0d3aa7f337ec6242ed2c33881 (release/2.4)

Author: Lev Stipakov
Date:   Wed Apr 15 10:30:17 2020 +0300
     Fix illegal client float (CVE-2020-11810)

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Acked-by: Antonio Quartulli <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg19720.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering