Multiple Vendor DNS Query ID Field Prediction Cache Poisoning - Nessus

Critical   Plugin ID: 33447

This page contains detailed information about the Multiple Vendor DNS Query ID Field Prediction Cache Poisoning Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 33447
Name: Multiple Vendor DNS Query ID Field Prediction Cache Poisoning
Filename: dns_non_random_source_ports.nasl
Vulnerability Published: 2008-07-08
This Plugin Published: 2008-07-09
Last Modification Time: 2018-11-15
Plugin Version: 1.34
Plugin Type: remote
Plugin Family: DNS
Dependencies: bind_query.nasl
Required KB Items [?]: DNS/recursive_queries

Vulnerability Information


Severity: Critical
Vulnerability Published: 2008-07-08
Patch Published: N/A
CVE [?]: CVE-2008-1447
CPE [?]: N/A

Synopsis

The remote name resolver (or the server it uses upstream) is affected by a DNS cache poisoning vulnerability.

Description

The remote DNS resolver does not use random ports when making queries to third-party DNS servers. An unauthenticated, remote attacker can exploit this to poison the remote DNS server, allowing the attacker to divert legitimate traffic to arbitrary sites.

Solution

Contact your DNS server vendor for a patch.

Public Exploits


Target Network Port(s): N/A
Target Asset(s): N/A
Exploit Available: True (Exploit-DB)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the Multiple Vendor DNS Query ID Field Prediction Cache Poisoning vulnerability:

  1. Exploit-DB: exploits/multiple/remote/6122.rb
    [EDB-6122: BIND 9.4.1 < 9.4.2 - Remote DNS Cache Poisoning (Metasploit)]
  2. Exploit-DB: exploits/multiple/remote/6123.py
    [EDB-6123: BIND 9.x - Remote DNS Cache Poisoning]
  3. Exploit-DB: exploits/multiple/remote/6130.c
    [EDB-6130: BIND 9.x - Remote DNS Cache Poisoning]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


CVSS V2 Vector [?]: AV:N/AC:L/Au:N/C:N/I:C/A:C/E:POC/RL:OF/RC:C
CVSS Base Score:9.4 (High)
Impact Subscore:9.2
Exploitability Subscore:10.0
CVSS Temporal Score:7.4 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:7.4 (High)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H/E:P/RL:O/RC:C
CVSS Base Score:9.1 (Critical)
Impact Subscore:5.2
Exploitability Subscore:3.9
CVSS Temporal Score:8.2 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.2 (High)
STIG Severity [?]: I
STIG Risk Rating: High

Go back to menu.

Plugin Source


This is the dns_non_random_source_ports.nasl nessus plugin source code. This script is Copyright (C) 2008-2018 and is owned by Tenable, Inc. or an Affiliate thereof.

#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if(description)
{
  script_id(33447);
  script_version ("1.34");
  script_cvs_date("Date: 2018/11/15 20:50:21");

  script_cve_id("CVE-2008-1447");
  script_bugtraq_id(30131);
  script_xref(name:"CERT", value:"800113");
  script_xref(name:"IAVA", value:"2008-A-0045");
  script_xref(name:"EDB-ID", value:"6122");
  script_xref(name:"EDB-ID", value:"6123");
  script_xref(name:"EDB-ID", value:"6130");

  script_name(english:"Multiple Vendor DNS Query ID Field Prediction Cache Poisoning");
  script_summary(english:"Determines if the remote DNS server uses random source ports when making queries.");

  script_set_attribute(attribute:"synopsis", value:
"The remote name resolver (or the server it uses upstream) is affected
by a DNS cache poisoning vulnerability.");
  script_set_attribute(attribute:"description", value:
"The remote DNS resolver does not use random ports when making queries
to third-party DNS servers. An unauthenticated, remote attacker can
exploit this to poison the remote DNS server, allowing the attacker to
divert legitimate traffic to arbitrary sites.");
  script_set_attribute(attribute:"see_also", value:"https://www.cnet.com/news/massive-coordinated-dns-patch-released/");
  script_set_attribute(attribute:"see_also", value:"https://www.theregister.co.uk/2008/07/21/dns_flaw_speculation/");
  script_set_attribute(attribute:"solution", value:
"Contact your DNS server vendor for a patch.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:N/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:POC/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:P/RL:O/RC:C");
  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2008/07/08");
  script_set_attribute(attribute:"plugin_publication_date", value:"2008/07/09");
  
  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"stig_severity", value:"I");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english: "DNS");

  script_copyright(english:"This script is Copyright (C) 2008-2018 and is owned by Tenable, Inc. or an Affiliate thereof.");
  
  script_dependencie("bind_query.nasl");
  script_require_keys("DNS/recursive_queries");
  exit(0);
  }

include("global_settings.inc");
include("audit.inc");
include("byte_func.inc");
include("dns_func.inc");
include("misc_func.inc");
include("spad_log_func.inc");

port = 53;
if (! get_udp_port_state(port)) exit(0, "UDP port "+port+" is not open.");

MIN_SAMPLES = 4;
NUM = 4;
HARD_LIMIT = 50;

function abs()
{
 local_var x;
 x = _FCT_ANON_ARGS[0];
 if ( x > 0 ) return x;
 return 0 - x;
}

totCount = 0;
per_ip = make_array();

for ( i = 0 ; i < NUM ; i ++ )
{
  totCount ++;
  req["transaction_id"] = rand() % 65535;
  req["flags"] = 0x0100;
  req["q"]     = 1;
  packet = mkdns(dns:req, query:mk_query(txt:dns_str_to_query_txt(rand_str(length:8, charset:"abcdefghijklmnopqrstuvwxyz")  + "-" + i + ".t.nessus.org."), type:0x0010, class:0x0001));
  soc = open_sock_udp(53);
  send(socket:soc, data:packet);
  r = recv(socket:soc, length:4096);
  close(soc);
  if ( ! r )
    exit(1, "Failed to receive DNS response from socket.");

  r = dns_split(r);
  res = r["an_rr_data_0_data"];
  if ( ! res )
    exit(1, "DNS result not received.");

  if( strlen(res) < 2  )
    exit(1, "DNS result length < 2.");

  res = substr(res, 1, strlen(res) - 1);
  if ( res !~ "^[0-9.]+,[0-9]+")
    exit(1, "DNS results don't conform to IP address regex.");

  array = split(res, sep:",", keep:FALSE);
  responses_ports = per_ip[array[0]];
  if ( isnull(responses_ports) )
  {
	  responses_ports = make_list();
 	  if ( max_index(keys(per_ip)) > 0 ) NUM += 4;
	}
  responses_ports[max_index(responses_ports)] = int(array[1]);
  per_ip[array[0]] = responses_ports;

  if ( totCount > HARD_LIMIT ) break;
}

# debug logging
foreach dns_server ( keys(per_ip) )
{
  responses_ports = per_ip[dns_server];
  spad_log(message:"DNS Server " + dns_server + " response ports : " + join(responses_ports, sep:","));
}

buggy_dns_servers = make_array();
foreach dns_server ( keys(per_ip) )
{
  responses_ports = per_ip[dns_server];
  if ( max_index(responses_ports) >= MIN_SAMPLES )
   {
    flag = 0;
    for ( i = 1 ; i < max_index(responses_ports) && flag == 0; i ++ ) {
      if ( abs(responses_ports[i - 1] - responses_ports[i]) >= 20 )
        flag = 1;
    }
    if ( flag == 0 )
    {
     buggy_dns_servers[dns_server] = responses_ports;
    }
   }
}

if ( max_index(keys(buggy_dns_servers)) > 0 )
{
 report = "
The remote DNS server uses non-random ports for its
DNS requests. An attacker may spoof DNS responses.

List of used ports :
";
  foreach dns_server ( keys(buggy_dns_servers) )
  {
    report += '\n+ DNS Server: ' + dns_server + '\n';
    responses_ports = buggy_dns_servers[dns_server];
    for ( i = 0 ; i < max_index(responses_ports) ; i ++ )
	{
	  report += '|- Port: ' + responses_ports[i] + '\n';
	}
  }

 security_hole(port:53, proto: "udp", extra: report);
}
else
{
  audit(AUDIT_LISTEN_NOT_VULN, "DNS", port);
}

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/dns_non_random_source_ports.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\dns_non_random_source_ports.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/dns_non_random_source_ports.nasl

Go back to menu.

How to Run


Here is how to run the Multiple Vendor DNS Query ID Field Prediction Cache Poisoning as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select DNS plugin family.
  6. On the right side table select Multiple Vendor DNS Query ID Field Prediction Cache Poisoning plugin ID 33447.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl dns_non_random_source_ports.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a dns_non_random_source_ports.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - dns_non_random_source_ports.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state dns_non_random_source_ports.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: IAVA | Information Assurance Vulnerability Alert:
  • 2008-A-0045
CERT | Computer Emergency Response Team: See also: Similar and related Nessus plugins:
  • 33448 - CentOS 3 / 4 / 5 : bind / selinux-policy (CESA-2008:0533)
  • 49017 - Multiple Cisco Products Vulnerable to DNS Cache Poisoning Attacks
  • 33737 - Debian DSA-1617-1 : refpolicy - incompatible policy
  • 33739 - Debian DSA-1619-1 : python-dns - DNS response spoofing
  • 78224 - F5 Networks BIG-IP : BIND DNS cache poisoning vulnerability (SOL8938)
  • 34380 - Fedora 9 : ruby-1.8.6.287-2.fc9 (2008-8738)
  • 35693 - Fedora 9 : dnsmasq-2.45-1.fc9 (2009-1069)
  • 35188 - GLSA-200812-17 : Ruby: Multiple vulnerabilities
  • 35347 - GLSA-200901-03 : pdnsd: Denial of Service and cache poisoning
  • 62383 - GLSA-201209-25 : VMware Player, Server, Workstation: Multiple vulnerabilities
  • 26139 - HP-UX PHNE_36973 : HP-UX Running BIND, Remote DNS Cache Poisoning (HPSBUX02251 SSRT071449 rev.3)
  • 33864 - HP-UX PHNE_37865 : HP-UX Running BIND, Remote DNS Cache Poisoning (HPSBUX02351 SSRT080058 rev.6)
  • 34211 - Mac OS X 10.5.x < 10.5.5 Multiple Vulnerabilities
  • 33790 - Mac OS X Multiple Vulnerabilities (Security Update 2008-005)
  • 34210 - Mac OS X Multiple Vulnerabilities (Security Update 2008-006)
  • 72834 - MS08-037: Vulnerabilities in DNS Could Allow Spoofing (951746) (uncredentialed check)
  • 147379 - NewStart CGSL CORE 5.04 / MAIN 5.04 : bind Multiple Vulnerabilities (NS-SA-2021-0017)
  • 67709 - Oracle Linux 3 / 4 / 5 : bind (ELSA-2008-0533)
  • 67735 - Oracle Linux 5 : dnsmasq (ELSA-2008-0789)
  • 79464 - OracleVM 2.1 : dnsmasq (OVMSA-2009-0022)
  • 99569 - OracleVM 3.3 / 3.4 : bind (OVMSA-2017-0066)
  • 137170 - OracleVM 3.3 / 3.4 : bind (OVMSA-2020-0021)
  • 33462 - RHEL 2.1 / 3 / 4 / 5 : bind (RHSA-2008:0533)
  • 33865 - RHEL 5 : dnsmasq (RHSA-2008:0789)
  • 33565 - Slackware 10.0 / 10.1 / 10.2 / 11.0 / 12.0 / 12.1 / current : dnsmasq (SSA:2008-205-01)
  • 34972 - Slackware 11.0 / 12.0 / 12.1 : ruby (SSA:2008-334-01)
  • 33441 - MS08-037: Vulnerabilities in DNS Could Allow Spoofing (953230)
  • 33560 - Ubuntu 8.04 LTS : dnsmasq vulnerability (USN-627-1)
  • 37068 - Ubuntu 6.06 LTS / 7.04 / 7.10 / 8.04 LTS : ruby1.8 vulnerabilities (USN-651-1)
  • 40382 - VMSA-2008-0014 : Updates to VMware Workstation, VMware Player, VMware ACE, VMware Server, VMware ESX, VMware VCB address information disclosure, privilege escalation and other security issues.
  • 35450 - DNS Server Spoofed Request Amplification DDoS
  • 10595 - DNS Server Zone Transfer Information Disclosure (AXFR)

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file dns_non_random_source_ports.nasl version 1.34. For more plugins, visit the Nessus Plugin Library.

Go back to menu.