Fix SIGSEGV (NULL deref) receiving push "echo"
PATCH 1/1 Fix SIGSEGV (NULL deref) receiving push "echo"
A server pushing "echo" without arguments can crash the client. In such a situation, the code in question receives p[1] == NULL (which was CLEAR(p)'ed above), hands it strncmp, which then dereferences the null pointer.
Original report and analysis here:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256331
--- src/openvpn/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/options.c +1 -1
@@ -5365,7 +5365,7 @@ add_option(struct options *options, {/* only message-related ECHO are logged, since other ECHOs * can potentially include security-sensitive strings */ -if (strncmp (p[1 ],"msg" ,3 ) ==0 ) +if (p[1 ] &&strncmp (p[1 ],"msg" ,3 ) ==0 ) { msg(M_INFO, "%s:%s", pull_mode ? "ECHO-PULL" : "ECHO",
--
2.31.1
[Openvpn-devel] [PATCH applied] Re: Fix SIGSEGV (NULL deref) receiving push echo
This is obviously correct, and in hindsight a very obvious bug - we seemed to have focused too much on the documentation aspect of the commit introducing the bug, and not enough on the code change...
Your patch has been applied to the master and release/2.5 branch.
commit 0033811e0215af76f469d78912c95a2f59813454 (master). commit d6e21bed964109abaf4bf03a951dc2fc9b1d5c1f (release/2.5)
Author: Matthias Andree Date: Thu Jun 3 14:30:19 2021 +0200
Fix SIGSEGV (NULL deref) receiving push echo
Signed-off-by: Matthias Andree <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg22486.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Quoted 21 lines · Matthias Andree
A server pushing "echo" without arguments can crash the client. In such a situation, the code in question receives p[1] == NULL (which was CLEAR(p)'ed above), hands it strncmp, which then dereferences the null pointer.
Original report and analysis here:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256331Fixes Trac #1409Reported-by [email protected]... (to FreeBSD)Signed-off-by Matthias Andree <[email protected]...>--- src/openvpn/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/openvpn/options.c +0
-0
src/openvpn/options.c add_option(struct options *options, · line 5371
Quoted 8 lines
src/openvpn/options.c +1
-1@@ -5365,7 +5365,7 @@ add_option(struct options *options, {/* only message-related ECHO are logged, since other ECHOs * can potentially include security-sensitive strings */ -if (strncmp (p[1 ],"msg" ,3 ) ==0 ) +if (p[1 ] &&strncmp (p[1 ],"msg" ,3 ) ==0 ) { msg(M_INFO, "%s:%s", pull_mode ? "ECHO-PULL" : "ECHO",
Argh.. good to see already committed. I take all the blame for acking the original..
This may take the award for the easiest bug to reproduce: just run "openvpn --echo" no server, no config file required.
Selva