Cisco ASA Software IKEv1 and IKEv2 UDP Packet Handling RCE (cisco-sa-20160210-asa-ike)

2016-02-12T00:00:00
ID CISCO-SA-20160210-ASA-IKE.NASL
Type nessus
Reporter Tenable
Modified 2018-08-09T00:00:00

Description

The remote Cisco Adaptive Security Appliance (ASA) is missing a vendor-supplied security patch. It is, therefore, affected by a remote code execution vulnerability due to an overflow condition in the Internet Key Exchange (IKE) implementation. An unauthenticated, remote attacker can exploit this, via specially crafted UDP packets, to cause a denial of service or the execution of arbitrary code. Note that only systems configured in routed firewall mode and single / multiple context mode are affected.

                                        
                                            #TRUSTED 7bef45c67ead39339bd1dbdcb6b900a0e12548fbb701efe6b503304c8b7231b17bb308ea7ef8f73636e94969e1a05d6bc206f96426976284dc622a6bf0ff36e90e0162e73a9807ebbffb9240925b010e6e3646aea2cd3ad904ea0bae963cb6593154415b14f8b93e238040a0b2725a4feaec185573c557211bfaa154d11039733e428d0d701baf70894a784bd91a1e87a451ea2e2c6c800576fe0b2c0fe3970eefba6f056effbdb24fe340a98dcfce0ac53ff610288e57ac681b3999add6c28fcf924d565d815f9b94911743663497f355a94ceef29f37534504674b6acd4533738b4e644ff41a271ea9ccd4a97e8277e7654e734d030b30bc61c2085fcd1642f907969e22b68ba48b0d5dce4c34d236f5acbf30c368948d9e365170f6896feced30d521d1ee3b082b3ed66faacdabc44fc6fd9e154cb76d4e13f9c9670296f920c212fc259c76989f2afe18a680a6bdddfe4e9545fe82bfb24226291aa0dd2d21696da200aea552474d1237639775ea05990f4e634c21f55bfcc537a36c8dfbcc1796de9c17dfd8f52d2ae51bb01ba32fc663098641e3682c18e85f12f32f8e3ee6294217801a412b99e4acd2968c992adf3760506cb06cbb3bf6c478e0ee181c6da40e16a1663824d65945014e73b5c8737b6fd0c3e088cc97bf1f5a9bdc5b6188ea579f5cd42300a121b37fcdb920b569d55f3de76471545ce87ec18abd0e
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(88713);
  script_version("1.9");
  script_set_attribute(attribute:"plugin_modification_date", value:"2018/08/09");

  script_cve_id("CVE-2016-1287");
  script_bugtraq_id(83161);
  script_xref(name:"CERT", value:"327976");
  script_xref(name:"CISCO-BUG-ID", value:"CSCux29978");
  script_xref(name:"CISCO-BUG-ID", value:"CSCux42019");
  script_xref(name:"CISCO-SA", value:"cisco-sa-20160210-asa-ike");

  script_name(english:"Cisco ASA Software IKEv1 and IKEv2 UDP Packet Handling RCE (cisco-sa-20160210-asa-ike)");
  script_summary(english:"Checks the ASA version.");

  script_set_attribute(attribute:"synopsis", value:
"The remote device is missing a vendor-supplied security patch.");
  script_set_attribute(attribute:"description", value:
"The remote Cisco Adaptive Security Appliance (ASA) is missing a
vendor-supplied security patch. It is, therefore, affected by a remote
code execution vulnerability due to an overflow condition in the
Internet Key Exchange (IKE) implementation. An unauthenticated, remote
attacker can exploit this, via specially crafted UDP packets, to cause
a denial of service or the execution of arbitrary code. Note that only
systems configured in routed firewall mode and single / multiple
context mode are affected.");
  # https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20160210-asa-ike
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?eafc4e71");
  script_set_attribute(attribute:"solution", value:
"Upgrade to the relevant fixed version referenced in Cisco Security
Advisory cisco-sa-20160210-asa-ike.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");

  script_set_attribute(attribute:"vuln_publication_date", value:"2016/01/26");
  script_set_attribute(attribute:"patch_publication_date", value:"2016/01/19");
  script_set_attribute(attribute:"plugin_publication_date", value:"2016/02/12");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:cisco:adaptive_security_appliance_software");
  script_end_attributes();

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

  script_copyright(english:"This script is Copyright (C) 2016-2018 Tenable Network Security, Inc.");

  script_dependencies("ssh_get_info.nasl");
  script_require_keys("Host/Cisco/ASA", "Host/Cisco/ASA/model");

  exit(0);
}

include("audit.inc");
include("cisco_func.inc");
include("cisco_kb_cmd_func.inc");

asa = get_kb_item_or_exit('Host/Cisco/ASA');
model = get_kb_item_or_exit('Host/Cisco/ASA/model');
ver = extract_asa_version(asa);
if (isnull(ver)) audit(AUDIT_FN_FAIL, 'extract_asa_version');

if (
  model !~ '^55[0-9][0-9]($|[^0-9])' &&
  model !~ '^65[0-9][0-9]($|[^0-9])' &&
  model !~ '^76[0-9][0-9]($|[^0-9])' &&
  model !~ '^1000V'                  &&
  model !~ '^93[0-9][0-9]($|[^0-9])' && # Firepower ASA
  model !~ '^30[0-9][0-9]($|[^0-9])' && # ISA 3000
  model != 'v'                          # reported by ASAv
) audit(AUDIT_HOST_NOT, "ASA 5500 5000-X 6500 7600 1000V 9300 3000 or ASAv");

flag = 0;
override = 0;
local_check = 0;
fixed_ver = "";
report = "";

cbi = "CSCux29978 and CSCux42019";

# For each vulnerability, check for affected OS versions,
# set "fixed" os version, and perform any additional checks

# Determine if additional local checks can be performed
if (get_kb_item("Host/local_checks_enabled")) local_check = 1;

if (ver =~ "^7\.2[^0-9]" || ver =~ "^8\.3[^0-9]" || ver =~ "^8\.6[^0-9]")
{
  temp_flag++;
  fixed_ver = "9.1(6.11)";
}
else if (ver =~ "^8\.2[^0-9]" && check_asa_release(version:ver, patched:"8.2(5.59)"))
{
  temp_flag++;
  fixed_ver = "8.2(5.59)";
}
else if (ver =~ "^8\.4[^0-9]" && check_asa_release(version:ver, patched:"8.4(7.30)"))
{
  temp_flag++;
  fixed_ver = "8.4(7.30)";
}
else if (ver =~ "^8\.7[^0-9]" && check_asa_release(version:ver, patched:"8.7(1.18)"))
{
  temp_flag++;
  fixed_ver = "8.7(1.18)";
}
else if (ver =~ "^9\.0[^0-9]" && check_asa_release(version:ver, patched:"9.0(4.38)"))
{
  temp_flag++;
  fixed_ver = "9.0(4.38)";
}
else if (ver =~ "^9\.1[^0-9]" && check_asa_release(version:ver, patched:"9.1(6.11)"))
{
  temp_flag++;
  fixed_ver = "9.1(6.11)";
}
else if (ver =~ "^9\.2[^0-9]" && check_asa_release(version:ver, patched:"9.2(4.5)"))
{
  temp_flag++;
  fixed_ver = "9.2(4.5)";
}
else if (ver =~ "^9\.3[^0-9]" && check_asa_release(version:ver, patched:"9.3(3.7)"))
{
  temp_flag++;
  fixed_ver = "9.3(3.7)";
}
else if (ver =~ "^9\.4[^0-9]" && check_asa_release(version:ver, patched:"9.4(2.4)"))
{
  temp_flag++;
  fixed_ver = "9.4(2.4)";
}
else if (ver =~ "^9\.5[^0-9]" && check_asa_release(version:ver, patched:"9.5(2.2)"))
{
  temp_flag++;
  fixed_ver = "9.5(2.2)";
}

# Need to check that failover is enabled
# as well as the failover ipsec feature
if (local_check && temp_flag)
{
  temp_flag = 0;
  buf = cisco_command_kb_item(
    "Host/Cisco/Config/show_running-config_crypto_map",
    "show running-config crypto map | include interface"
  );
  # Output for vuln config will be like:
  # crypto map <some map name> interface <some interface name>
  if (check_cisco_result(buf))
  {
    if (preg(multiline:TRUE, pattern:"crypto map [^\s]+ interface [^\s]+", string:buf))
        temp_flag = 1;
  }
  else if (cisco_needs_enable(buf)) {temp_flag = 1; override = 1;}
}

if (temp_flag)
{
  report +=
    '\n  Cisco bug IDs     : ' + cbi +
    '\n  Installed release : ' + ver +
    '\n  Fixed release     : ' + fixed_ver + '\n';
  flag++;
}

if (flag)
{
  security_hole(port:0, extra:report + cisco_caveat(override));
  exit(0);
}
else audit(AUDIT_HOST_NOT, "affected");