Skip to contentSkip to conversation

Fix for CVE-2013-2061 breaks multihome?

Openvpn-devel Alberto Gonzalez Iniesta 2 participants 6 messages Jun 17, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

I applied the fix for CVE-2013-2061 [0] to Debian's stable version of openvpn (2.2.1) [1]. When the new package was sent to the mirrors I got a couple of reports of broken VPNs [2]. After some testing I think the problem arises with the use of "multihome" option. The server daemon starts to log lots of these:

Jun 17 12:43:52 srv ovpn-srv[31073]: write UDPv4 []: Invalid argument (code=22)
Jun 17 12:43:53 srv ovpn-srv[31073]: write UDPv4 []: Invalid argument (code=22)

If the "multihome" option is removed, the VPN comes back to live.

Could a patch to fix this be made or should we go back to 2.2.1 without the patch to fix CVE-2013-2061?

Thanks,

Alberto

[0] https://github.com/OpenVPN/openvpn/commit/11d21349a4e7e38a025849479b36ace7c2eec2ee
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=707329
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=712414

Signature · 5 lines
Alberto Gonzalez Iniesta    | Formación, consultoría y soporte técnico
agi@(inittab.org|debian.org)| en GNU/Linux y software libre
Encrypted mail preferred    | http://inittab.com

Key fingerprint = 5347 CBD8 3E30 A9EB 4D7D  4BF2 009B 3375 6B9A AA55
#1 lore raw

Hi,

Quoted 5 lines · Alberto Gonzalez Iniesta

I applied the fix for CVE-2013-2061 [0] to Debian's stable version of openvpn (2.2.1) [1]. When the new package was sent to the mirrors I got a couple of reports of broken VPNs [2]. After some testing I think the problem arises with the use of "multihome" option. The server daemon starts to log lots of these:

Quoted 7 lines
Jun 17 12:43:52 srv ovpn-srv[31073]: write UDPv4 []: Invalid argument (code=22)
Jun 17 12:43:53 srv ovpn-srv[31073]: write UDPv4 []: Invalid argument (code=22)

If the "multihome" option is removed, the VPN comes back to live.

Could a patch to fix this be made or should we go back to 2.2.1 without the patch to fix CVE-2013-2061?

This patch is most definitely not affecting multihome. If you look at the patch, there is nothing in there that could affect external behaviour (except remove the timing variance).

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]...
#2 lore raw
Quoted 11 lines · Gert Doering

Hi,

Quoted 8 lines · Alberto Gonzalez Iniesta

I applied the fix for CVE-2013-2061 [0] to Debian's stable version of openvpn (2.2.1) [1]. When the new package was sent to the mirrors I got a couple of reports of broken VPNs [2]. After some testing I think the problem arises with the use of "multihome" option. The server daemon starts to log lots of these:

Jun 17 12:43:52 srv ovpn-srv[31073]: write UDPv4 []: Invalid argument (code=22)
Jun 17 12:43:53 srv ovpn-srv[31073]: write UDPv4 []: Invalid argument (code=22)
Quoted 9 lines
Quoted 4 lines

If the "multihome" option is removed, the VPN comes back to live.

Could a patch to fix this be made or should we go back to 2.2.1 without the patch to fix CVE-2013-2061?

This patch is most definitely not affecting multihome. If you look at the patch, there is nothing in there that could affect external behaviour (except remove the timing variance).

Thanks Gert,

I compiled the package without the patch now, and get the same (bogus) result. Somethigng must have changed in the build environment that breaks this. Will investigate further.

Signature · 5 lines
Alberto Gonzalez Iniesta    | Formación, consultoría y soporte técnico
agi@(inittab.org|debian.org)| en GNU/Linux y software libre
Encrypted mail preferred    | http://inittab.com

Key fingerprint = 5347 CBD8 3E30 A9EB 4D7D  4BF2 009B 3375 6B9A AA55
#3 lore raw
Quoted 22 lines · Alberto Gonzalez Iniesta
Quoted 11 lines · Gert Doering

Hi,

Quoted 8 lines · Alberto Gonzalez Iniesta

I applied the fix for CVE-2013-2061 [0] to Debian's stable version of openvpn (2.2.1) [1]. When the new package was sent to the mirrors I got a couple of reports of broken VPNs [2]. After some testing I think the problem arises with the use of "multihome" option. The server daemon starts to log lots of these:

Jun 17 12:43:52 srv ovpn-srv[31073]: write UDPv4 []: Invalid argument (code=22)
Jun 17 12:43:53 srv ovpn-srv[31073]: write UDPv4 []: Invalid argument (code=22)
Quoted 9 lines
Quoted 4 lines

If the "multihome" option is removed, the VPN comes back to live.

Could a patch to fix this be made or should we go back to 2.2.1 without the patch to fix CVE-2013-2061?

This patch is most definitely not affecting multihome. If you look at the patch, there is nothing in there that could affect external behaviour (except remove the timing variance).

Quoted 5 lines

Thanks Gert,

I compiled the package without the patch now, and get the same (bogus) result. Somethigng must have changed in the build environment that breaks this. Will investigate further.

Does this strace output help?
From working build:

sendmsg(6, {msg_name(16)={sa_family=AF_INET, sin_port=htons(33497), sin_addr=inet_addr("62.82.17.220")}, msg_iov(1)=[{"h\22\260\274\377\244\300\234G\5,\256\376d\5+ \274\264V\260\20\201\tNO\202\271\354\351E}\322"..., 124}], msg_controllen=28, {cmsg_len=28, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = 124
poll([{fd=6, events=POLLIN|POLLPRI}, {fd=7, events=POLLIN|POLLPRI}], 2, 4037) = 1 ([{fd=6, revents=POLLIN}])

From failing build:
sendmsg(6, {msg_name(16)={sa_family=AF_INET, sin_port=htons(33497), sin_addr=inet_addr("62.82.17.220")}, msg_iov(1)=[{">]\253^\16\330\226\202\3\350\31\31tC\247\352\244\10\0- (\363\377\364\2077\360h\215\333\216{"..., 124}], msg_controllen=28, {cmsg_len=662516248, cmsg_level=SOL_IP, cmsg_type=, ...}, msg_flags=0}, 0) = -1 EINVAL (Invalid argument)
recvmsg(6, 0x7fff5686b060, MSG_ERRQUEUE) = -1 EAGAIN (Resource temporarily unavailable)

Seems like "cmsg_len" went nuts...

Again, only happens with multihome, if that helps...

Signature · 5 lines
Alberto Gonzalez Iniesta    | Formación, consultoría y soporte técnico
agi@(inittab.org|debian.org)| en GNU/Linux y software libre
Encrypted mail preferred    | http://inittab.com

Key fingerprint = 5347 CBD8 3E30 A9EB 4D7D  4BF2 009B 3375 6B9A AA55
Acked-by Acked-by Arne Schwabe
#4 lore raw

Hi,

Quoted 1 line · Alberto Gonzalez Iniesta

Seems like "cmsg_len" went nuts...

Seems your compiler grew too much smarts and optimized that bug to death :-)

Quoted 1 line

Again, only happens with multihome, if that helps...

That code path is only used for multihome. Bugfix is here (if it's indeed *that* problem):

commit 8c431f960357d776cfd0961192214ad1b0942bfb

Author: Gert Doering <[email protected]...>
Date:   Thu May 30 13:31:24 2013 +0200

Fix problem with UDP tunneling due to mishandled pktinfo structures.

In link_socket_write_udp_posix_sendmsg(), pktinfo structures for ipv4 and ipv6 are going out of scope before actually calling sendmsg(), so depending on compiler optimization, garbage is passed to sendmsg() - fix by using "union openvpn_pktinfo" and having that in scope all the time.

Problem reported and patch provided by "danta" in trac#297

URL: https://community.openvpn.net/openvpn/ticket/297
Message-ID: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7629

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]...
#5 lore raw
Quoted 12 lines · Gert Doering

Hi,

Quoted 1 line · Alberto Gonzalez Iniesta

Seems like "cmsg_len" went nuts...

Seems your compiler grew too much smarts and optimized that bug to death :-)

Quoted 1 line

Again, only happens with multihome, if that helps...

That code path is only used for multihome. Bugfix is here (if it's indeed *that* problem):

Thanks a log Gert. Yes, applying the patch solved the problem.

Cheers,

Alberto

Signature · 5 lines
Alberto Gonzalez Iniesta    | Formación, consultoría y soporte técnico
agi@(inittab.org|debian.org)| en GNU/Linux y software libre
Encrypted mail preferred    | http://inittab.com

Key fingerprint = 5347 CBD8 3E30 A9EB 4D7D  4BF2 009B 3375 6B9A AA55