Cisco IOS XR GNU C Library (glibc) Buffer Overflow (GHOST)

2015-03-02T00:00:00
ID CISCO-SA-20150128-GHOST-IOSXR_NCS6K.NASL
Type nessus
Reporter This script is Copyright (C) 2015-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
Modified 2020-06-02T00:00:00

Description

The remote Cisco device is running a version of Cisco IOS XR software that is potentially affected by a heap-based buffer overflow vulnerability in the GNU C Library (glibc) due to improperly validated user-supplied input to the __nss_hostname_digits_dots(), gethostbyname(), and gethostbyname2() functions. This allows a remote attacker to cause a buffer overflow, resulting in a denial of service condition or the execution of arbitrary code.

Note that this issue only affects Cisco Network Convergence System 6000 Series routers.

                                        
                                            #TRUSTED 7650b18d9881ab288de29fd139a3aa35dcc2160f980e8248ab3eb4a21569106552f4bc11be7c73d6700fd617b56ce49cb37f47a71a1975dc005d402c13db5d79174096666654c127c5efedf77bad004e23199bdd97fa2b75aee7985dc250200417f9a244dc5792543fc8d7f607c6a178ad6c1ff22c89fc165d0933230eef34f9f4e6ed8b9845d957d7b5ad18248edd76e5201e75eec902d80866f846c4e320a5fe3841b34f9a0a32bd881ce81b7d599c1d8c83cac1cd24a95825cfed144ba94343eeb31ed0843276e2368341c8267f3f96013ce72ddb77717cee8996cd300314338f041754ed78e35981ab48983e12441551b89edd15b643cf8cb4703f34ee9bf91c43793f0684a6461b57e8c6138d307f25691f16aa2ed23c80570d84423ac9a26766d19c4d2e57c0a4592e05d238b71a88b3fd0240ef5f45a2214a160b165b8be87e755dd3a660205d5bf11600fbf78fa044d1fe8b1e76427b7124bbfd8e33c6f34fb57fddd6680512a3df98aa756aecb59df269aeda7b224a528cd4f0c7394b44e5cfb3c99c9aa49d82bcef04e903a616cb3e6829f6c22570595d3c4300bc4e9c1c57423919ddcab9c2844a0f6fc36c151c38277d908b3a4e97db6a440412d0f9c986acfd7fa4737af8541a00bc4b8f5c966a26a79f123eef5ea308301ad2d991f4db1ca663ca538f1841a0f8746338d7b04352df770ddafd1c8a6545054d
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(81596);
  script_version("1.10");
  script_cvs_date("Date: 2019/11/25");

  script_cve_id("CVE-2015-0235");
  script_bugtraq_id(72325);
  script_xref(name:"CERT", value:"967332");
  script_xref(name:"CISCO-BUG-ID", value:"CSCus69517");
  script_xref(name:"CISCO-SA", value:"cisco-sa-20150128-ghost");

  script_name(english:"Cisco IOS XR GNU C Library (glibc) Buffer Overflow (GHOST)");
  script_summary(english:"Checks the IOS XR 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 device is running a version of Cisco IOS XR software
that is potentially affected by a heap-based buffer overflow
vulnerability in the GNU C Library (glibc) due to improperly
validated user-supplied input to the __nss_hostname_digits_dots(),
gethostbyname(), and gethostbyname2() functions. This allows a remote
attacker to cause a buffer overflow, resulting in a denial of service
condition or the execution of arbitrary code.

Note that this issue only affects Cisco Network Convergence System
6000 Series routers.");
  script_set_attribute(attribute:"see_also", value:"https://tools.cisco.com/bugsearch/bug/CSCus69517");
  # https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20150128-ghost
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?fd2144f8");
  # https://www.qualys.com/research/security-advisories/GHOST-CVE-2015-0235.txt
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?c7a6ddbd");
  script_set_attribute(attribute:"solution", value:
"Apply the relevant patch referenced in Cisco bug ID CSCus69517.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:H/RL:OF/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2015-0235");

  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"exploit_framework_core", value:"true");
  script_set_attribute(attribute:"exploited_by_malware", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'Exim GHOST (glibc gethostbyname) Buffer Overflow');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");
  script_set_attribute(attribute:"in_the_news", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2015/01/27");
  script_set_attribute(attribute:"patch_publication_date", value:"2015/02/18");
  script_set_attribute(attribute:"plugin_publication_date", value:"2015/03/02");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:cisco:ios_xr");
  script_end_attributes();

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

  script_copyright(english:"This script is Copyright (C) 2015-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("cisco_ios_xr_version.nasl");
  script_require_keys("Host/Cisco/IOS-XR/Version");

  exit(0);
}

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

device_name = "Cisco Network Convergence System 6000 Series Router";

# Check model
model = get_kb_item("CISCO/model");
if(
  !isnull(model)
  &&
  tolower(model) !~ "ncs(6008|6k)"
) audit(AUDIT_HOST_NOT, device_name);

# First source failed, try another source
if (isnull(model))
{
  model = get_kb_item_or_exit("Host/Cisco/IOS-XR/Model");
  if (
    "NCS6008" >!< model
    &&
    "NCS6k" >!< model
  ) audit(AUDIT_HOST_NOT, device_name);
}

# Check rough version
# 5.2.x / 5.4.x
version = get_kb_item_or_exit("Host/Cisco/IOS-XR/Version");
if (version !~ "^5\.[24]\.")
  audit(AUDIT_HOST_NOT, device_name + " 5.2.x / 5.4.x");

# Affected :
# 5.2.4.BASE, i.e., 5.2.4
# 5.4.0.BASE, i.e., 5.4.0
if (
  version == "5.2.4"
  ||
  version == "5.4.0"
)
{
  if (report_verbosity > 0)
  {
    report =
      '\n  Cisco bug ID      : CSCus69517' +
      '\n  Installed release : ' + version +
      '\n';
    security_hole(port:0, extra:report);
  }
  else security_hole(port:0);
}
else audit(AUDIT_INST_VER_NOT_VULN, device_name, version);