Lucene search

K
metasploitMike Connor, Juerg Schweingruber <[email protected]>, Patrick Schmid <[email protected]>MSF:AUXILIARY-SCANNER-HTTP-FORTIMAIL_LOGIN_BYPASS_DETECTION-
HistoryJun 25, 2020 - 8:28 a.m.

FortiMail Unauthenticated Login Bypass Scanner

2020-06-2508:28:17
Mike Connor, Juerg Schweingruber <[email protected]>, Patrick Schmid <[email protected]>
www.rapid7.com
35

7.5 High

CVSS2

Attack Vector

NETWORK

Attack Complexity

LOW

Authentication

NONE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:N/AC:L/Au:N/C:P/I:P/A:P

9.8 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

0.028 Low

EPSS

Percentile

90.7%

This module attempts to detect instances of FortiMail vulnerable against an unauthenticated login bypass (CVE-2020-9294).

##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Auxiliary
  include Msf::Exploit::Remote::HttpClient
  include Msf::Auxiliary::Report
  include Msf::Auxiliary::Scanner

  def initialize
    super(
      'Name' => 'FortiMail Unauthenticated Login Bypass Scanner',
      'Description' => %q{
        This module attempts to detect instances of FortiMail vulnerable
        against an unauthenticated login bypass (CVE-2020-9294).
      },
      'Author' => [
        'Mike Connor', # Initial Vulnerability discovery
        'Juerg Schweingruber <juerg.schweingruber[at]redguard.ch>', # Vulnerability Re-Discovery
        'Patrick Schmid <patrick.schmid[at]redguard.ch>' # Exploit Development & MSF module
      ],
      'References' => [
        ['CVE', '2020-9294'],
        ['URL', 'https://www.fortiguard.com/psirt/FG-IR-20-045'],
        ['URL', 'https://www.redguard.ch/blog/2020/07/02/fortimail-unauthenticated-login-bypass/']
      ],
      'License' => MSF_LICENSE
    )

    register_options([
      OptString.new('TARGETURI', [true, 'Path to the FortiMail admin page', '/admin/AdminLogin.html']),
      Opt::RPORT(443)
    ])

    register_advanced_options([
      OptBool.new('SSL', [true, 'Negotiate SSL connection', true])
    ])
  end

  def target_url
    proto = 'http'
    if (rport == 443) || ssl
      proto = 'https'
    end
    uri = normalize_uri(datastore['URI'])
    "#{proto}://#{vhost}:#{rport}#{uri}"
  end

  def run_host(ip)
    vprint_status("Checking vulnerability at #{ip}")
    uri = normalize_uri(target_uri.path)

    res = send_request_raw({
      'method' => 'GET',
      'uri' => uri
    })

    return :abort unless res # prints default connection error messages

    if res.code == 301
      vprint_error("#{ip} - Page redirect to #{res.headers['Location']}")
      return :abort
    end

    unless res.code == 200
      vprint_bad("#{ip} - No version of FortiMail detected")
      return :abort
    end

    version_raw = res.body[/fml-admin-login-(\d+).js/, 1]
    version = version_raw.to_i
    unless (res.body.include?('newpassword') && (version.between?(140, 160) || version.between?(730, 745) || version.between?(250, 263)))
      print_bad("#{ip} - Not vulnerable version (Build: #{version_raw}) of FortiMail detected")
      return :abort
    end

    print_good("#{ip} - Vulnerable version (Build: #{version_raw}) of FortiMail detected")

    report_vuln(
      host: rhost,
      port: rport,
      name: 'FortiMail Login Bypass',
      refs: references
    )
  rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
    # noop
  rescue ::Timeout::Error, ::Errno::EPIPE
    # noop
  rescue ::OpenSSL::SSL::SSLError => e
    return if (e.to_s.match(/^SSL_connect /)) # strange errors / exception if SSL connection aborted
  end
end

7.5 High

CVSS2

Attack Vector

NETWORK

Attack Complexity

LOW

Authentication

NONE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:N/AC:L/Au:N/C:P/I:P/A:P

9.8 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

0.028 Low

EPSS

Percentile

90.7%

Related for MSF:AUXILIARY-SCANNER-HTTP-FORTIMAIL_LOGIN_BYPASS_DETECTION-