Skip to content

Commit c3f4707

Browse files
committed
Fix remotely-triggerable ASSERT() on malformed IPv6 packet.
Correct sanity checks on IPv6 packet length in mss_fixup_ipv6(), and change the ASSERT() check in mss_fixup_dowork() into a simple "return" (= the TCP header will simply not be inspected further). CVE-2017-7508 has been assigned due to the serious nature of the bug: it can be used to remotely shutdown an openvpn server or client, if IPv6 and --mssfix are enabled and the IPv6 networks used inside the VPN are known. Found by Guido Vranken <guidovranken@gmail.com>. v2: style changes CVE: 2017-7508 Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Steffan Karger <steffan.karger@fox-it.com> Message-Id: <20170613200832.15027-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/search?l=mid&q=20170613200832.15027-1-gert@greenie.muc.de Signed-off-by: Gert Doering <gert@greenie.muc.de>
1 parent 7718c89 commit c3f4707

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/openvpn/mss.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,12 @@ mss_fixup_ipv6(struct buffer *buf, int maxmss)
119119
return;
120120
}
121121

122+
/* skip IPv6 header (40 bytes),
123+
* verify remainder is large enough to contain a full TCP header
124+
*/
122125
newbuf = *buf;
123-
if (buf_advance( &newbuf, 40 ) )
126+
if (buf_advance( &newbuf, 40 )
127+
&& BLEN(&newbuf) >= (int) sizeof(struct openvpn_tcphdr))
124128
{
125129
struct openvpn_tcphdr *tc = (struct openvpn_tcphdr *) BPTR(&newbuf);
126130
if (tc->flags & OPENVPN_TCPH_SYN_MASK)
@@ -144,7 +148,10 @@ mss_fixup_dowork(struct buffer *buf, uint16_t maxmss)
144148
int accumulate;
145149
struct openvpn_tcphdr *tc;
146150

147-
ASSERT(BLEN(buf) >= (int) sizeof(struct openvpn_tcphdr));
151+
if (BLEN(buf) < (int) sizeof(struct openvpn_tcphdr))
152+
{
153+
return;
154+
}
148155

149156
verify_align_4(buf);
150157
tc = (struct openvpn_tcphdr *) BPTR(buf);

0 commit comments

Comments
 (0)