Skip to contentSkip to conversation

Followup to CVE-2008-3459 fix

Openvpn-devel Peter Rabbitson 2 participants 8 messages Aug 20, 2008 – Sep 6, 2008

lore
Share & tools
lore
#0 lore raw

Hello,

I would like to duplicate a concern about the proposed fix, voiced over at the debian BTS
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=493488#29, before the final version ships.

=========================================================
This fix breaks the following setup:

1) Server A provides openvpn connectivity to clients
2) Servers X Y and Z are configured as VPN clients and provide some http services both to the outside internet and to any VPN clients.
3) The http services are configured in a way that mandates password authentication via an SSL channel, except when communicating with other VPN clients.
4) Server A supplies 'push "route hostname.of.[X|Y|Z].server"', because the servers in question are development machines, which can (and do) change their IP addresses rather frequently.

With the current "fix" point 4 becomes impractical, and now besides updates to the dns (which are automatic) I have to update the server config every time something changes (which unfortunately is manual).
========================================================

Eventually the best way to deal with this is to test for ip_addr_dotted_quad_safe and is_special_addr, and then attempt a dns lookup on the string supplied for route. If anything comes back - use the result as the routed IPs. Otherwise warn and carry on. This would also fix this long-outstanding (not mine) wishlist:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=237251

Thank you

Peter

#1 lore raw
Quoted 25 lines · Peter Rabbitson

Hello,

I would like to duplicate a concern about the proposed fix, voiced over at the debian BTS
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=493488#29, before the final version ships.

=========================================================
This fix breaks the following setup:

1) Server A provides openvpn connectivity to clients
2) Servers X Y and Z are configured as VPN clients and provide some http services both to the outside internet and to any VPN clients.
3) The http services are configured in a way that mandates password authentication via an SSL channel, except when communicating with other VPN clients.
4) Server A supplies 'push "route hostname.of.[X|Y|Z].server"', because the servers in question are development machines, which can (and do) change their IP addresses rather frequently.

With the current "fix" point 4 becomes impractical, and now besides updates to the dns (which are automatic) I have to update the server config every time something changes (which unfortunately is manual).
========================================================

Quoted 6 lines

Eventually the best way to deal with this is to test for ip_addr_dotted_quad_safe and is_special_addr, and then attempt a dns lookup on the string supplied for route. If anything comes back - use the result as the routed IPs. Otherwise warn and carry on. This would also fix this long-outstanding (not mine) wishlist:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=237251

I agree that this should be fixed, probably via a --route-fqdn-pull option (as suggested) on the client to permit DNS lookups on option parameters that previously allowed them.

James

#2 lore raw
Quoted 10 lines · James Yonan
Quoted 7 lines · Peter Rabbitson

Eventually the best way to deal with this is to test for ip_addr_dotted_quad_safe and is_special_addr, and then attempt a dns lookup on the string supplied for route. If anything comes back - use the result as the routed IPs. Otherwise warn and carry on. This would also fix this long-outstanding (not mine) wishlist:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=237251

Quoted 4 lines

I agree that this should be fixed, probably via a --route-fqdn-pull option (as suggested) on the client to permit DNS lookups on option parameters that previously allowed them.

I think if you go with my second suggestion (above) the option becomes redundant. You can attempt a DNS lookup with pretty much anything (as far as string goes), and if nothing comes back - well nothing comes back.

In any case, I'm glad this didn't fall off the radar.

Thank you for the excellent software!

Peter

#3 lore raw
Quoted 14 lines · Peter Rabbitson
Quoted 8 lines · James Yonan
Quoted 6 lines · Peter Rabbitson

Eventually the best way to deal with this is to test for ip_addr_dotted_quad_safe and is_special_addr, and then attempt a dns lookup on the string supplied for route. If anything comes back - use the result as the routed IPs. Otherwise warn and carry on. This would also fix this long-outstanding (not mine) wishlist:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=237251

Quoted 4 lines

I agree that this should be fixed, probably via a --route-fqdn-pull option (as suggested) on the client to permit DNS lookups on option parameters that previously allowed them.

Quoted 7 lines

I think if you go with my second suggestion (above) the option becomes redundant. You can attempt a DNS lookup with pretty much anything (as far as string goes), and if nothing comes back - well nothing comes back.

In any case, I'm glad this didn't fall off the radar.

Thank you for the excellent software!

This fix has been committed and will be released in 2.1-rc10.

------------------------------------------------------------------------
r3307 | james | 2008-09-04 14:35:09 -0600 (Thu, 04 Sep 2008) | 7 lines Changed paths:
M /branches/BETA21/openvpn/openvpn.8
M /branches/BETA21/openvpn/options.c
M /branches/BETA21/openvpn/options.h
M /branches/BETA21/openvpn/socket.c
M /branches/BETA21/openvpn/socket.h

Added --allow-pull-fqdn option which allows client to pull DNS names
from server (rather than only IP address) for --ifconfig, --route, and
--route-gateway. OpenVPN versions 2.1_rc7 and earlier allowed DNS names
for these options to be pulled and translated to IP addresses by default. Now --allow-pull-fqdn will be explicitly required on the client to enable DNS-name to IP-address translation of pulled options.

------------------------------------------------------------------------

James

#4 lore raw
Quoted 43 lines · James Yonan
Quoted 14 lines · Peter Rabbitson
Quoted 8 lines · James Yonan
Quoted 6 lines · Peter Rabbitson

Eventually the best way to deal with this is to test for ip_addr_dotted_quad_safe and is_special_addr, and then attempt a dns lookup on the string supplied for route. If anything comes back - use the result as the routed IPs. Otherwise warn and carry on. This would also fix this long-outstanding (not mine) wishlist:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=237251

Quoted 4 lines

I agree that this should be fixed, probably via a --route-fqdn-pull option (as suggested) on the client to permit DNS lookups on option parameters that previously allowed them.

Quoted 7 lines

I think if you go with my second suggestion (above) the option becomes redundant. You can attempt a DNS lookup with pretty much anything (as far as string goes), and if nothing comes back - well nothing comes back.

In any case, I'm glad this didn't fall off the radar.

Thank you for the excellent software!

This fix has been committed and will be released in 2.1-rc10.

------------------------------------------------------------------------
r3307 | james | 2008-09-04 14:35:09 -0600 (Thu, 04 Sep 2008) | 7 lines Changed paths:
M /branches/BETA21/openvpn/openvpn.8
M /branches/BETA21/openvpn/options.c
M /branches/BETA21/openvpn/options.h
M /branches/BETA21/openvpn/socket.c
M /branches/BETA21/openvpn/socket.h

Added --allow-pull-fqdn option which allows client to pull DNS names from server (rather than only IP address) for --ifconfig, --route, and --route-gateway. OpenVPN versions 2.1_rc7 and earlier allowed DNS names for these options to be pulled and translated to IP addresses by default. Now --allow-pull-fqdn will be explicitly required on the client to enable DNS-name to IP-address translation of pulled options.

Quoted 3 lines

------------------------------------------------------------------------

James

Excellent!

May I be a total pain in the ass and point out the following:
* you validate the passed string with CC_NAME|CC_DASH|CC_DOT
* which after aliasing comes back as (perl re) /[A-Za-z0-9\_\-\.]/
* while http://tools.ietf.org/html/rfc3696#section-2 insists on LHR (i.e. no underscore)

Also it doesn't seem that you are checking the length of the string passed in, whereas FQDNs are generally limited to 255 bytes.

Other than that - excellent patch, exactly what the doctor ordered. Thank you!

#5 lore raw
Quoted 52 lines · Peter Rabbitson
Quoted 39 lines · James Yonan
Quoted 12 lines · Peter Rabbitson
Quoted 11 lines · James Yonan
Quoted 6 lines · Peter Rabbitson

Eventually the best way to deal with this is to test for ip_addr_dotted_quad_safe and is_special_addr, and then attempt a dns lookup on the string supplied for route. If anything comes back - use the result as the routed IPs. Otherwise warn and carry on. This would also fix this long-outstanding (not mine) wishlist:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=237251

I agree that this should be fixed, probably via a --route-fqdn-pull option (as suggested) on the client to permit DNS lookups on option parameters that previously allowed them.

Quoted 7 lines

I think if you go with my second suggestion (above) the option becomes redundant. You can attempt a DNS lookup with pretty much anything (as far as string goes), and if nothing comes back - well nothing comes back.

In any case, I'm glad this didn't fall off the radar.

Thank you for the excellent software!

This fix has been committed and will be released in 2.1-rc10.

------------------------------------------------------------------------
r3307 | james | 2008-09-04 14:35:09 -0600 (Thu, 04 Sep 2008) | 7 lines Changed paths:
M /branches/BETA21/openvpn/openvpn.8
M /branches/BETA21/openvpn/options.c
M /branches/BETA21/openvpn/options.h
M /branches/BETA21/openvpn/socket.c
M /branches/BETA21/openvpn/socket.h

Added --allow-pull-fqdn option which allows client to pull DNS names from server (rather than only IP address) for --ifconfig, --route, and --route-gateway. OpenVPN versions 2.1_rc7 and earlier allowed DNS names for these options to be pulled and translated to IP addresses by default. Now --allow-pull-fqdn will be explicitly required on the client to enable DNS-name to IP-address translation of pulled options.

Quoted 3 lines

------------------------------------------------------------------------

James

Excellent!

May I be a total pain in the ass and point out the following:
* you validate the passed string with CC_NAME|CC_DASH|CC_DOT
* which after aliasing comes back as (perl re) /[A-Za-z0-9\_\-\.]/
* while http://tools.ietf.org/html/rfc3696#section-2 insists on LHR (i.e. no underscore)

Quoted 5 lines

Also it doesn't seem that you are checking the length of the string passed in, whereas FQDNs are generally limited to 255 bytes.

Other than that - excellent patch, exactly what the doctor ordered. Thank you!

Fixed:

------------------------------------------------------------------------
r3312 | james | 2008-09-06 04:43:31 -0600 (Sat, 06 Sep 2008) | 8 lines Changed paths:
M /branches/BETA21/openvpn/socket.c
M /branches/BETA21/openvpn/socket.h

Modified ip_or_dns_addr_safe, which validates pulled DNS names, to more closely conform to RFC 3696:

* DNS name length must not exceed 255 characters

* DNS name characters must be limited to alphanumeric, dash ('-'), and dot ('.')

------------------------------------------------------------------------

James

#6 lore raw
In reply to James Yonan
Quoted 43 lines · James Yonan
Quoted 14 lines · Peter Rabbitson
Quoted 8 lines · James Yonan
Quoted 6 lines · Peter Rabbitson

Eventually the best way to deal with this is to test for ip_addr_dotted_quad_safe and is_special_addr, and then attempt a dns lookup on the string supplied for route. If anything comes back - use the result as the routed IPs. Otherwise warn and carry on. This would also fix this long-outstanding (not mine) wishlist:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=237251

Quoted 4 lines

I agree that this should be fixed, probably via a --route-fqdn-pull option (as suggested) on the client to permit DNS lookups on option parameters that previously allowed them.

Quoted 7 lines

I think if you go with my second suggestion (above) the option becomes redundant. You can attempt a DNS lookup with pretty much anything (as far as string goes), and if nothing comes back - well nothing comes back.

In any case, I'm glad this didn't fall off the radar.

Thank you for the excellent software!

This fix has been committed and will be released in 2.1-rc10.

------------------------------------------------------------------------
r3307 | james | 2008-09-04 14:35:09 -0600 (Thu, 04 Sep 2008) | 7 lines Changed paths:
M /branches/BETA21/openvpn/openvpn.8
M /branches/BETA21/openvpn/options.c
M /branches/BETA21/openvpn/options.h
M /branches/BETA21/openvpn/socket.c
M /branches/BETA21/openvpn/socket.h

Added --allow-pull-fqdn option which allows client to pull DNS names from server (rather than only IP address) for --ifconfig, --route, and --route-gateway. OpenVPN versions 2.1_rc7 and earlier allowed DNS names for these options to be pulled and translated to IP addresses by default. Now --allow-pull-fqdn will be explicitly required on the client to enable DNS-name to IP-address translation of pulled options.

Quoted 3 lines

------------------------------------------------------------------------

James

Also while we are at it, do you have any considerations of retrofitting getaddr() (socket.c) to support
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=237251 ? It would be very beneficial, and would take you closer to IPv6 too (as you'd use the new getaddrinfo() instead).

Thanks
Peter

#7 lore raw
Quoted 42 lines · Peter Rabbitson
Quoted 41 lines · James Yonan
Quoted 12 lines · Peter Rabbitson
Quoted 11 lines · James Yonan
Quoted 6 lines · Peter Rabbitson

Eventually the best way to deal with this is to test for ip_addr_dotted_quad_safe and is_special_addr, and then attempt a dns lookup on the string supplied for route. If anything comes back - use the result as the routed IPs. Otherwise warn and carry on. This would also fix this long-outstanding (not mine) wishlist:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=237251

I agree that this should be fixed, probably via a --route-fqdn-pull option (as suggested) on the client to permit DNS lookups on option parameters that previously allowed them.

Quoted 7 lines

I think if you go with my second suggestion (above) the option becomes redundant. You can attempt a DNS lookup with pretty much anything (as far as string goes), and if nothing comes back - well nothing comes back.

In any case, I'm glad this didn't fall off the radar.

Thank you for the excellent software!

This fix has been committed and will be released in 2.1-rc10.

------------------------------------------------------------------------
r3307 | james | 2008-09-04 14:35:09 -0600 (Thu, 04 Sep 2008) | 7 lines Changed paths:
M /branches/BETA21/openvpn/openvpn.8
M /branches/BETA21/openvpn/options.c
M /branches/BETA21/openvpn/options.h
M /branches/BETA21/openvpn/socket.c
M /branches/BETA21/openvpn/socket.h

Added --allow-pull-fqdn option which allows client to pull DNS names from server (rather than only IP address) for --ifconfig, --route, and --route-gateway. OpenVPN versions 2.1_rc7 and earlier allowed DNS names for these options to be pulled and translated to IP addresses by default. Now --allow-pull-fqdn will be explicitly required on the client to enable DNS-name to IP-address translation of pulled options.

------------------------------------------------------------------------

Quoted 7 lines
Quoted 1 line

James

Also while we are at it, do you have any considerations of retrofitting getaddr() (socket.c) to support
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=237251 ? It would be very beneficial, and would take you closer to IPv6 too (as you'd use the new getaddrinfo() instead).

It's an interesting idea -- I'd certainly consider it if someone submitted a patch.

James