Amazon Linux AMI : kernel (ALAS-2017-845) (Stack Clash) - Nessus

High   Plugin ID: 100874

This page contains detailed information about the Amazon Linux AMI : kernel (ALAS-2017-845) (Stack Clash) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 100874
Name: Amazon Linux AMI : kernel (ALAS-2017-845) (Stack Clash)
Filename: ala_ALAS-2017-845.nasl
Vulnerability Published: N/A
This Plugin Published: 2017-06-20
Last Modification Time: 2019-04-10
Plugin Version: 3.9
Plugin Type: local
Plugin Family: Amazon Linux Local Security Checks
Dependencies: ssh_get_info.nasl
Required KB Items [?]: Host/AmazonLinux/release, Host/AmazonLinux/rpm-list, Host/local_checks_enabled

Vulnerability Information


Severity: High
Vulnerability Published: N/A
Patch Published: 2017-06-19
CVE [?]: CVE-2017-1000364, CVE-2017-1000371
CPE [?]: cpe:/o:amazon:linux, p-cpe:/a:amazon:linux:kernel, p-cpe:/a:amazon:linux:kernel-debuginfo, p-cpe:/a:amazon:linux:kernel-debuginfo-common-i686, p-cpe:/a:amazon:linux:kernel-debuginfo-common-x86_64, p-cpe:/a:amazon:linux:kernel-devel, p-cpe:/a:amazon:linux:kernel-doc, p-cpe:/a:amazon:linux:kernel-headers, p-cpe:/a:amazon:linux:kernel-tools, p-cpe:/a:amazon:linux:kernel-tools-debuginfo, p-cpe:/a:amazon:linux:kernel-tools-devel, p-cpe:/a:amazon:linux:perf, p-cpe:/a:amazon:linux:perf-debuginfo
In the News: True

Synopsis

The remote Amazon Linux AMI host is missing a security update.

Description

An issue was discovered in the size of the stack guard page on Linux, specifically a 4k stack guard page is not sufficiently large and can be jmp'ed over, this affects Linux Kernel versions 4.11.5 and earlier (the stackguard page was introduced in 2010). (CVE-2017-1000364)

The offset2lib patch as used by the Linux Kernel contains a vulnerability, if RLIMIT_STACK is set to RLIMIT_INFINITY and 1 Gigabyte of memory is allocated (the maximum under the 1/4 restriction) then the stack will be grown down to 0x80000000, and as the PIE binary is mapped above 0x80000000 the minimum distance between the end of the PIE binary's read-write segment and the start of the stack becomes small enough that the stack guard page can be jumped over by an attacker. This is a different issue than CVE-2017-1000370 and CVE-2017-1000365 . (CVE-2017-1000371)

Solution

Run 'yum update kernel' to update your system.

Public Exploits


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

Here's the list of publicly known exploits and PoCs for verifying the Amazon Linux AMI : kernel (ALAS-2017-845) (Stack Clash) vulnerability:

  1. Metasploit: exploit/solaris/local/rsh_stack_clash_priv_esc
    [rsh_stack_clash_priv_esc.rb]
  2. Metasploit: exploit/solaris/local/rsh_stack_clash_priv_esc
    [Solaris RSH Stack Clash Privilege Escalation]
  3. Exploit-DB: exploits/linux_x86/local/42273.c
    [EDB-42273: Linux Kernel - 'offset2lib' Stack Clash]
  4. Exploit-DB: exploits/linux_x86/local/42276.c
    [EDB-42276: Linux Kernel (Debian 9/10 / Ubuntu 14.04.5/16.04.2/17.04 / Fedora 23/24/25) - 'ldso_dynamic Stack Clash' Local Privilege Escalation]
  5. Exploit-DB: exploits/solaris/local/45625.rb
    [EDB-45625: Solaris - RSH Stack Clash Privilege Escalation (Metasploit)]
  6. GitHub: https://github.com/pelucky/Read-Wechat-Subscription-in-email
    [CVE-2017-1000364]
  7. GitHub: https://github.com/ferovap/Tools
    [CVE-2017-1000371]
  8. GitHub: https://github.com/spencerdodd/kernelpop
    [CVE-2017-1000371]

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:L/AC:L/Au:N/C:C/I:C/A:C/E:F/RL:OF/RC:C
CVSS Base Score:7.2 (High)
Impact Subscore:10.0
Exploitability Subscore:3.9
CVSS Temporal Score:6.0 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:6.0 (Medium)
CVSS V3 Vector: CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C
CVSS Base Score:7.8 (High)
Impact Subscore:5.9
Exploitability Subscore:1.8
CVSS Temporal Score:7.2 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:7.2 (High)

Go back to menu.

Plugin Source


This is the ala_ALAS-2017-845.nasl nessus plugin source code. This script is Copyright (C) 2017-2019 and is owned by Tenable, Inc. or an Affiliate thereof.

#
# (C) Tenable Network Security, Inc.
#
# The descriptive text and package checks in this plugin were
# extracted from Amazon Linux AMI Security Advisory ALAS-2017-845.
#

include("compat.inc");

if (description)
{
  script_id(100874);
  script_version("3.9");
  script_cvs_date("Date: 2019/04/10 16:10:16");

  script_cve_id("CVE-2017-1000364", "CVE-2017-1000371");
  script_xref(name:"ALAS", value:"2017-845");

  script_name(english:"Amazon Linux AMI : kernel (ALAS-2017-845) (Stack Clash)");
  script_summary(english:"Checks rpm output for the updated packages");

  script_set_attribute(
    attribute:"synopsis", 
    value:"The remote Amazon Linux AMI host is missing a security update."
  );
  script_set_attribute(
    attribute:"description", 
    value:
"An issue was discovered in the size of the stack guard page on Linux,
specifically a 4k stack guard page is not sufficiently large and can
be jmp'ed over, this affects Linux Kernel versions 4.11.5 and earlier
(the stackguard page was introduced in 2010). (CVE-2017-1000364)

The offset2lib patch as used by the Linux Kernel contains a
vulnerability, if RLIMIT_STACK is set to RLIMIT_INFINITY and 1
Gigabyte of memory is allocated (the maximum under the 1/4
restriction) then the stack will be grown down to 0x80000000, and as
the PIE binary is mapped above 0x80000000 the minimum distance between
the end of the PIE binary's read-write segment and the start of the
stack becomes small enough that the stack guard page can be jumped
over by an attacker. This is a different issue than CVE-2017-1000370
and CVE-2017-1000365 . (CVE-2017-1000371)"
  );
  script_set_attribute(
    attribute:"see_also",
    value:"https://alas.aws.amazon.com/ALAS-2017-845.html"
  );
  script_set_attribute(
    attribute:"solution", 
    value:"Run 'yum update kernel' to update your system."
  );
  script_set_cvss_base_vector("CVSS2#AV:L/AC:L/Au:N/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:F/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:"metasploit_name", value:'rsh_stack_clash_priv_esc.rb');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:kernel");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:kernel-debuginfo");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:kernel-debuginfo-common-i686");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:kernel-debuginfo-common-x86_64");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:kernel-devel");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:kernel-doc");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:kernel-headers");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:kernel-tools");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:kernel-tools-debuginfo");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:kernel-tools-devel");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:perf");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:perf-debuginfo");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:amazon:linux");

  script_set_attribute(attribute:"patch_publication_date", value:"2017/06/19");
  script_set_attribute(attribute:"in_the_news", value:"true");
  script_set_attribute(attribute:"plugin_publication_date", value:"2017/06/20");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_copyright(english:"This script is Copyright (C) 2017-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");
  script_family(english:"Amazon Linux Local Security Checks");

  script_dependencies("ssh_get_info.nasl");
  script_require_keys("Host/local_checks_enabled", "Host/AmazonLinux/release", "Host/AmazonLinux/rpm-list");

  exit(0);
}


include("audit.inc");
include("global_settings.inc");
include("rpm.inc");


if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);

release = get_kb_item("Host/AmazonLinux/release");
if (isnull(release) || !strlen(release)) audit(AUDIT_OS_NOT, "Amazon Linux");
os_ver = pregmatch(pattern: "^AL(A|\d)", string:release);
if (isnull(os_ver)) audit(AUDIT_UNKNOWN_APP_VER, "Amazon Linux");
os_ver = os_ver[1];
if (os_ver != "A")
{
  if (os_ver == 'A') os_ver = 'AMI';
  audit(AUDIT_OS_NOT, "Amazon Linux AMI", "Amazon Linux " + os_ver);
}

if (!get_kb_item("Host/AmazonLinux/rpm-list")) audit(AUDIT_PACKAGE_LIST_MISSING);


flag = 0;
if (rpm_check(release:"ALA", reference:"kernel-4.9.27-14.33.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"kernel-debuginfo-4.9.27-14.33.amzn1")) flag++;
if (rpm_check(release:"ALA", cpu:"i686", reference:"kernel-debuginfo-common-i686-4.9.27-14.33.amzn1")) flag++;
if (rpm_check(release:"ALA", cpu:"x86_64", reference:"kernel-debuginfo-common-x86_64-4.9.27-14.33.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"kernel-devel-4.9.27-14.33.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"kernel-doc-4.9.27-14.33.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"kernel-headers-4.9.27-14.33.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"kernel-tools-4.9.27-14.33.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"kernel-tools-debuginfo-4.9.27-14.33.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"kernel-tools-devel-4.9.27-14.33.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"perf-4.9.27-14.33.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"perf-debuginfo-4.9.27-14.33.amzn1")) flag++;

if (flag)
{
  if (report_verbosity > 0) security_hole(port:0, extra:rpm_report_get());
  else security_hole(0);
  exit(0);
}
else
{
  tested = pkg_tests_get();
  if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
  else audit(AUDIT_PACKAGE_NOT_INSTALLED, "kernel / kernel-debuginfo / kernel-debuginfo-common-i686 / etc");
}

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

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

Go back to menu.

How to Run


Here is how to run the Amazon Linux AMI : kernel (ALAS-2017-845) (Stack Clash) 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 Amazon Linux Local Security Checks plugin family.
  6. On the right side table select Amazon Linux AMI : kernel (ALAS-2017-845) (Stack Clash) plugin ID 100874.
  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 ala_ALAS-2017-845.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a ala_ALAS-2017-845.nasl -t <IP/HOST>

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

/opt/nessus/bin/nasl -T - ala_ALAS-2017-845.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 ala_ALAS-2017-845.nasl -t <IP/HOST>

Go back to menu.

References


ALAS | Amazon Linux Security Advisory: See also: Similar and related Nessus plugins:
  • 100876 - Debian DLA-993-2 : linux regression update (Stack Clash)
  • 100877 - Debian DSA-3886-1 : linux - security update (Stack Clash)
  • 100888 - Oracle Linux 7 : kernel (ELSA-2017-1484)
  • 100889 - Oracle Linux 6 : kernel (ELSA-2017-1486)
  • 100893 - RHEL 5 : kernel (RHSA-2017:1483) (Stack Clash)
  • 100894 - RHEL 7 : kernel (RHSA-2017:1484) (Stack Clash)
  • 100895 - RHEL 7 : kernel (RHSA-2017:1485) (Stack Clash)
  • 100896 - RHEL 6 : kernel (RHSA-2017:1486) (Stack Clash)
  • 100897 - RHEL 6 : kernel (RHSA-2017:1487) (Stack Clash)
  • 100898 - RHEL 6 : kernel (RHSA-2017:1488) (Stack Clash)
  • 100899 - RHEL 6 : kernel (RHSA-2017:1489) (Stack Clash)
  • 100900 - RHEL 6 : kernel (RHSA-2017:1490) (Stack Clash)
  • 100901 - RHEL 6 : kernel (RHSA-2017:1491) (Stack Clash)
  • 100905 - Scientific Linux Security Update : kernel on SL6.x i386/x86_64 (20170619) (Stack Clash)
  • 100906 - Scientific Linux Security Update : kernel on SL7.x x86_64 (20170619) (Stack Clash)
  • 100912 - SUSE SLES11 Security Update : kernel (SUSE-SU-2017:1613-1) (Stack Clash)
  • 100914 - SUSE SLES12 Security Update : kernel (SUSE-SU-2017:1615-1) (Stack Clash)

Version


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

Go back to menu.