Skip to contentSkip to conversation

NTLM.c security fix / CVE-2017-7520

Openvpn-devel Gert Doering 1 participant 1 message Jun 21, 2017

lore
Share & tools
lore
#0 lore raw

Hi,

most patches that went into the tree today came to me by git-send-email, so I could re-send them to the list after embargo, and message-id:s referenced in the code match between mailing list, git tree, and in-reply-to in the ACK mail.

One patch came as a patch attached to a longer mail that I do not want to bounce "as is" to the list - so here's the patch that originally came to me as

Message-Id: <[email protected]......>

and is referenced as such, plus my ACK-and-merge mail, both as attachments.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...

From 83694284a1b7918fdf55c2e4ebebce2126bd92fa Mon Sep 17 00:00:00 2001
From: Guido Vranken <[email protected]...>
Date: Fri, 19 May 2017 14:04:25 +0200
Subject: [PATCH] Prevent two kinds of stack buffer OOB reads and a crash for
invalid input data

---
 src/openvpn/ntlm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
src/openvpn/ntlm.c +8 -2
index 0c43681..bb8679f 100644
@@ -197,7 +197,7 @@ ntlm_phase_3(const struct http_proxy_info *p, const char *phase_2, struct gc_are
      */
 
     char pwbuf[sizeof(p->up.password) * 2]; /* for unicode password */
-    char buf2[128]; /* decoded reply from proxy */
+    unsigned char buf2[128]; /* decoded reply from proxy */
     unsigned char phase3[464];
 
     char md4_hash[MD4_DIGEST_LENGTH+5];
@@ -303,7 +303,13 @@ ntlm_phase_3(const struct http_proxy_info *p, const char *phase_2, struct gc_are
                 tib_len = 96;
             }
             {
-                char *tib_ptr = buf2 + buf2[0x2c];           /* Get Target Information block pointer */
+                char *tib_ptr;
+                int tib_pos = buf2[0x2c];
+                if (tib_pos + tib_len > sizeof(buf2))
+                {
+                    return NULL;
+                }
+                tib_ptr = buf2 + tib_pos;                               /* Get Target Information block pointer */
                 memcpy(&ntlmv2_blob[0x1c], tib_ptr, tib_len);           /* Copy Target Information block into the blob */
             }
         }
Signature · 1 line
2.1.4

From: Gert Doering <[email protected]...>
To: Guido Vranken <[email protected]...>
Cc: [email protected]
Subject: [PATCH applied] Re: Prevent two kinds of stack buffer OOB reads and a crash for invalid input data
In-Reply-To: <CAO5O-EJvHKid-zTj+hmFG_3Gv78ixqCayE9=C62DZaxN32WNtQ@...2284...ail.com>
References: <CAO5O-EJvHKid-zTj+hmFG_3Gv78ixqCayE9=C62DZaxN32WNtQ@...2285...il.com>

ACK.

Your patch has been applied to the master, release/2.4, 2.3 and 2.2 branch.

commit 7718c8984f04b507c1885f363970e2124e3c6c77 (master) commit 043fe327878eba75efa13794c9845f85c3c629f2 (release/2.4) commit f38a4a105979b87ebebe9be1c3d323116d3fb924 (release/2.3) commit 4bec9d25d519a56bc40458e947d3dfa964b82b13 (release/2.2)

Author: Guido Vranken
Date:   Fri May 19 14:04:25 2017 +0200
     Prevent two kinds of stack buffer OOB reads and a crash for invalid input data

     CVE: 2017-7520
     Signed-off-by: Guido Vranken <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <CAO5O-EJvHKid-zTj+hmFG_3Gv78ixqCayE9=C62DZaxN32WNtQ@...2286...l.gmail.com>
     URL: https://www.mail-archive.com/search?l=mid&[email protected]...
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering