Skip to content

[Bug Fix] Auxiliary: Check if module is meant to have rhosts#21138

Open
g0tmi1k wants to merge 1 commit intorapid7:masterfrom
g0tmi1k:rhosts
Open

[Bug Fix] Auxiliary: Check if module is meant to have rhosts#21138
g0tmi1k wants to merge 1 commit intorapid7:masterfrom
g0tmi1k:rhosts

Conversation

@g0tmi1k
Copy link
Contributor

@g0tmi1k g0tmi1k commented Mar 17, 2026

Fix for: #21121

When using auxiliary/server/dhcp, its a server, it doesn't have a dedlicated target/rhosts value.
However, its set globally, it will still and try and use it:

[] Running module against 10.0.0.10
[
] Starting DHCP server...

Really should be like:

[*] Auxiliary module running as background job 0.


Demo

Before

$ msfconsole -q -x 'db_status; workspace -D; set VERBOSE true; setg RHOSTS 10.0.0.10; setg LHOST tap0; use auxiliary/server/dhcp; set DHCPIPSTART 10.0.0.20; set DHCPIPEND 10.0.0.25; set NETMASK 255.255.255.0; set BROADCAST 10.0.0.255; set ROUTER 10.0.0.1;  set DNSSERVER 10.0.0.1; set SRVHOST 10.0.0.1; options; advanced; workspace -v; run'
[*] Connected to msf. Connection type: postgresql.
[*] Deleted workspace: default
[*] Recreated the default workspace
VERBOSE => true
RHOSTS => 10.0.0.10
LHOST => tap0
DHCPIPSTART => 10.0.0.20
DHCPIPEND => 10.0.0.25
NETMASK => 255.255.255.0
BROADCAST => 10.0.0.255
ROUTER => 10.0.0.1
DNSSERVER => 10.0.0.1
SRVHOST => 10.0.0.1

Module options (auxiliary/server/dhcp):

   Name         Current Setting  Required  Description
   ----         ---------------  --------  -----------
   BROADCAST    10.0.0.255       no        The broadcast address to send to
   DHCPIPEND    10.0.0.25        no        The last IP to give out
   DHCPIPSTART  10.0.0.20        no        The first IP to give out
   DNSSERVER    10.0.0.1         no        The DNS server IP address
   DOMAINNAME                    no        The optional domain name to assign
   FILENAME                      no        The optional filename of a tftp boot server
   HOSTNAME                      no        The optional hostname to assign
   HOSTSTART                     no        The optional host integer counter
   NETMASK      255.255.255.0    yes       The netmask of the local subnet
   ROUTER       10.0.0.1         no        The router IP address
   SRVHOST      10.0.0.1         yes       The IP of the DHCP server


Auxiliary action:

   Name     Description
   ----     -----------
   Service  Run DHCP server



View the full module info with the info, or info -d command.


Module advanced options (auxiliary/server/dhcp):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    true             no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module
  # vulnerable.


View the full module info with the info, or info -d command.


Workspaces
==========

current  name     hosts  services  vulns  creds  loots  notes
-------  ----     -----  --------  -----  -----  -----  -----
*        default  0      0         0      0      0      0

[*] Running module against 10.0.0.10
[*] Starting DHCP server...
^C[-] Stopping running against current target...
[*] Control-C again to force quit all targets.
[*] Auxiliary module execution completed
msf auxiliary(server/dhcp) > exit
$

After

$ sudo vim lib/msf/ui/console/command_dispatcher/auxiliary.rb
$
$ !msfconsole
msfconsole -q -x 'db_status; workspace -D; set VERBOSE true; setg RHOSTS 10.0.0.10; setg LHOST tap0; use auxiliary/server/dhcp; set DHCPIPSTART 10.0.0.20; set DHCPIPEND 10.0.0.25; set NETMASK 255.255.255.0; set BROADCAST 10.0.0.255; set ROUTER 10.0.0.1;  set DNSSERVER 10.0.0.1; set SRVHOST 10.0.0.1; options; advanced; workspace -v; run'
[...]
Workspaces
==========

current  name     hosts  services  vulns  creds  loots  notes
-------  ----     -----  --------  -----  -----  -----  -----
*        default  0      0         0      0      0      0

[*] Auxiliary module running as background job 0.
msf auxiliary(server/dhcp) >
[*] Starting DHCP server...
msf auxiliary(server/dhcp) >
msf auxiliary(server/dhcp) > exit

@g0tmi1k g0tmi1k changed the title Auxiliary: Check if module is meant to have rhosts [Bug Fix] Auxiliary: Check if module is meant to have rhosts Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants