isc-dhcp dhclient listens on extra random ports
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
isc-dhcp (Ubuntu) |
Fix Released
|
Undecided
|
Eric Desrochers | ||
Trusty |
Fix Released
|
Wishlist
|
Eric Desrochers | ||
Xenial |
Fix Released
|
Medium
|
Eric Desrochers |
Bug Description
[Impact]
In trusty, there is only 1 version of dhclient, including #define NSUPDATE, which introduce DDNS functionnality.
The DDNS functionnality, generate 2 random extra ports between 1024-65535.
Impact reported by users :
"One impact of these random ports is that security hardening becomes more difficult. The purpose of these random ports and security implications are unknown."
"We have software that was using one of the lower udp ports but it happened to collide with dhclient which seems to allocate 2 random ports."
There is a randomization mechanism in libdns that prevent dhclient to take the sysctl values into account (net.ipv4.
There is no realtime configuration to disable the feature or workaround this. The only possible way is at compile time.
I also talk with upstream maintainers, and there is no way they will accept to reduce the range (1024-65535) for security reason. Reducing the port range may facilitate the spoofing.
Xenial has separated dhclient in two packages :
isc-dhcp-client pkg : dhclient with DDNS functionality disabled (no random extra ports)
isc-dhcp-
The goal here is to reproduce the same situation in Trusty, for this bug to be less painful for at least users that doesn't require DDNS functionnality.
[Test Case]
Run a Trusty image with following package :
isc-dhcp-client
isc-dhcp-common
```
dhclient 1110 root 6u IPv4 11535 0t0 UDP *:bootpc
dhclient 1110 root 20u IPv4 11516 0t0 UDP *:64589 # <----------- extra random port
dhclient 1110 root 21u IPv6 11517 0t0 UDP *:7749 # <----------- extra random port
```
[Regression Potential]
I did the split such that Trusty users will automatically get "isc-dhcp-
Existing Trusty users can continue to use this DDNS functionality after the SRU without any necessary intervention.
With isc-dhcp-client:
dhclient 1110 root 6u IPv4 11535 0t0 UDP *:bootpc
dhclient 1110 root 20u IPv4 11516 0t0 UDP *:64589 # <----------- extra random port
dhclient 1110 root 21u IPv6 11517 0t0 UDP *:7749 # <----------- extra random port
With isc-dhcp-
dhclient 1110 root 6u IPv4 11535 0t0 UDP *:bootpc
Xenial also has both distinct dhclient binary package but in the opposite way. We have decided to use the opposite way approach for not impacting actual Trusty users by changing the nature of isc-dhcp-client itself.
Caribou and I, slashd, have also tested a couple of release upgrades from Trusty to Xenial with both scenarios :
1 - Trusty upgrade to Xenial with "isc-dhcp-
2 - Trusty upgrade to Xenial with "isc-dhcp-
and both scenarios worked as expected for caribou and I. (See comment #42)
Results :
===
** Upgrade tested with isc-dhcp-client **
# dpkg -l
ii isc-dhcp-client 4.2.4-7ubuntu12.8 amd64 ISC DHCP client
ii isc-dhcp-common 4.2.4-7ubuntu12.8 amd64 common files used by all the isc-dhcp* packages
# netstat -anputa | grep -i dhclient
udp 0 0 0.0.0.0:20114 0.0.0.0:* 632/dhclient
udp 0 0 0.0.0.0:68 0.0.0.0:* 632/dhclient
udp6 0 0 :::52249 :::* 632/dhclient
After successful upgrade Trusty (14.04.5) -> Xenial (16.04.2)
ii isc-dhcp-client 4.3.3-5ubuntu12.7 amd64 DHCP client for automatically obtaining an IP address
ii isc-dhcp-common 4.3.3-5ubuntu12.7 amd64 common files used by all of the isc-dhcp packages
# netstat -anputa | grep -i dhclient
udp 0 0 0.0.0.0:68 0.0.0.0:* 633/dhclient
** Upgrade tested with isc-dhcp-noddns (4.2.4-7ubuntu12.9) **
# dpkg -l
ii isc-dhcp-
# netstat -anputa | grep dhclient
udp 0 0 0.0.0.0:68 0.0.0.0:* 682/dhclient
After successful upgrade Trusty (14.04.5) -> Xenial (16.04.2)
# dpkg -l | grep -i dhcp
ii isc-dhcp-client 4.3.3-5ubuntu12.7 amd64 DHCP client for automatically obtaining an IP address
rc isc-dhcp-
ii isc-dhcp-common 4.3.3-5ubuntu12.6 amd64 common files used by all of the isc-dhcp packages
# netstat -anputa | grep dhclient
udp 0 0 0.0.0.0:68 0.0.0.0:* 639/dhclient
===
For ~ubuntu-sru, the above tests/scenarios will also be part of the testing phase once the package will be found in -proposed and I'll make sure they all succeed before tagging the bug to "verfication-done".
[Other Info]
* See : https:/
[Original Description]
Ubuntu 13.04 Server 64-bit. Fresh install. Only one network adapter.
dhclient process is listening on two randomly chosen udp ports in addition to the usual port 68. This appears to be a bug in the discovery code for probing information on interfaces in the system.
Initial research of the code also suggested omapi, but adding omapi port 9999 to /etc/dhcp/
Version of included distro dhclient was 4.2.4. I also tested with the latest isc-dhclient-
Debian has the same bug: http://
One impact of these random ports is that security hardening becomes more difficult. The purpose of these random ports and security implications are unknown.
Example netstat -lnp output:
udp 0 0 0.0.0.0:21117 0.0.0.0:* 2659/dhclient
udp 0 0 0.0.0.0:68 0.0.0.0:* 2659/dhclient
udp6 0 0 :::45664 :::* 2659/dhclient
Changed in isc-dhcp (Ubuntu): | |
importance: | Undecided → Medium |
status: | New → Triaged |
tags: | added: raring |
Changed in isc-dhcp (Ubuntu): | |
status: | Triaged → In Progress |
assignee: | nobody → Eric Desrochers (slashd) |
tags: | removed: raring |
Changed in isc-dhcp (Ubuntu): | |
importance: | Medium → High |
tags: | added: trusty |
Changed in isc-dhcp (Ubuntu Trusty): | |
status: | New → Confirmed |
description: | updated |
Changed in isc-dhcp (Ubuntu): | |
status: | In Progress → Fix Released |
Changed in isc-dhcp (Ubuntu Xenial): | |
status: | New → Fix Released |
Changed in isc-dhcp (Ubuntu Yakkety): | |
status: | New → Fix Released |
Changed in isc-dhcp (Ubuntu Trusty): | |
importance: | Medium → Wishlist |
Changed in isc-dhcp (Ubuntu): | |
importance: | High → Undecided |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Changed in isc-dhcp (Ubuntu Xenial): | |
importance: | Undecided → Medium |
assignee: | nobody → Eric Desrochers (slashd) |
Changed in isc-dhcp (Ubuntu Xenial): | |
status: | Fix Released → In Progress |
no longer affects: | isc-dhcp (Ubuntu Yakkety) |
I found the cause from a helpful thread at http:// forums. debian. net/viewtopic. php?f=10& t=95273
The NSUPDATE dns functionality in dhclient automatically causes it to listen on two random UDP ports. This could pose a security issue since the client will accept packets on these ports.
The current fix is to modify the source code to disable the functionality as per the thread mentioned above. Doing so stops it from listening on the random ports.
I have filed a bug with ISC, bug number [ISC-Bugs #33377] asking for documentation about this feature (none exists currently about why the ports are opened) as well as a run-time configuration option with a default value to disable it.