Linux DHCP Client Has Remote Code Execution Flaw
A flaw in how the open-source dhclient software handles meta-characters in hostnames assigned by the DHCP server would allow attackers to remotely execute malicious code.
A flaw in a popular open-source DHCP client software have been found that would allow attackers to remotely execute code. While it may take some time before the bug is fixed in every Linux distribution, there are steps administrators can take to mitigate the effects.
The dhclient software does not block commands that contain meta-characters, making it possible for rogue DHCP servers on a targeted network to remotely execute malicious code, the Internet Systems Consortium said on April 5. No known exploits exist in the wild, but it is possible that attackers will now start using the bug to break into networks.
In its advisory, ISC wrote, "dhclient doesn't strip or escape certain shell meta characters in dhcpd responses."
The vulnerability exists in versions prior to 3.1-ESV-R1, 4.1-ESV-R2, and 4.2.1-P1, according to the ISC advisory (CVE-2011-0997). Attackers can compromise a DHCP server to send out malicious hostname replies containing shellcode. The dhclient executes the shellcode when processing the hostname replies using its system-level privileges on the client system.
Administrators should upgrade to the latest versions, available from the ISC. There will be no patch available for 4.0.x as it is no longer being supported, and anyone running the 4.1.x versions should upgrade to 4.1-ESV-R2.
The software is found in most Linux, FreeBSD, Unix and other Unix-like platforms. Even though Mac OS X is based on BSD, it uses an Apple utility called IPConfiguration.bundle as its DHCP client and is not affected by the dhclient bug. Microsoft Windows doesn't use dhclient at all.
Administrators can set up, or tweak existing, filters or access control lists on the network to limit clients to accessing specific DHCP servers. This will protect systems running dhclient from rogue DHCP servers on the local network sending out malicious code. However, this will not protect systems if the authorized DHCP server on the network is already compromised.
The bug also affects the X server resource database utility from X.org, according to another advisory announced April 5. Since xrdb also evaluates hostnames sent from the DHCP server, maliciously crafted hostnames will also be passed on and executed when setting up the desktop environment.
The xrdb bug affects machines using DHCP to set their hostname and machines allowing users to remotely login using xdmcp, according to the X.Org advisory (CVE-2011-0465).
Administrators should also upgrade to xrdb 1.0.9, and it's already fixed in Red Hat Linux distributions.
There is a workaround for systems running Novell's SUSE Linux. Administrators can turn off the hostname update by disabling the DHCLIENT_SET_HOSTNAME setting on the dhcp script. Administrators for other systems can manually edit the dhclient-script to turn off the setting.
Short for Dynamic Host configuration Protocol, DHCP is a widely-used system for automatically assigning computers IP addreses on a network and helping administrators to keep track of those assignments. Windows, Macs, *nix all use DHCP as it's easier than manually assigning IP addresses, especially in a large network.
According to the ISC, dhclient is the most widely used open source DHCP client online.