Lucene search

K
nessusThis script is Copyright (C) 2024 and is owned by Tenable, Inc. or an Affiliate thereof.REDHAT_UNPATCHED-SUDO-RHEL5.NASL
HistoryMay 11, 2024 - 12:00 a.m.

RHEL 5 : sudo (Unpatched Vulnerability)

2024-05-1100:00:00
This script is Copyright (C) 2024 and is owned by Tenable, Inc. or an Affiliate thereof.
www.tenable.com
2
rhel 5
sudo
unpatched
vulnerabilities
wordexp
selinux
symbolic link attack
information disclosure
impersonate user
directory-existence tests

7.3 High

AI Score

Confidence

Low

0.008 Low

EPSS

Percentile

81.2%

The remote Redhat Enterprise Linux 5 host has one or more packages installed that are affected by multiple vulnerabilities that have been acknowledged by the vendor but will not be patched.

  • sudo: noexec bypass via wordexp() (CVE-2016-7076)

  • sudo: symbolic link attack in SELinux-enabled sudoedit (CVE-2021-23240)

  • sudo_noexec.so in Sudo before 1.8.15 on Linux might allow local users to bypass intended noexec command restrictions via an application that calls the (1) system or (2) popen function. (CVE-2016-7032)

  • sudo: It was discovered that the default sudo configuration on Red Hat Enterprise Linux and possibly other Linux implementations preserves the value of INPUTRC which could lead to information disclosure. A local user with sudo access to a restricted program that uses readline could use this flaw to read content from specially formatted files with elevated privileges provided by sudo. (CVE-2016-7091)

  • In Sudo through 1.8.29, an attacker with access to a Runas ALL sudoer account can impersonate a nonexistent user by invoking sudo with a numeric uid that is not associated with any user. NOTE: The software maintainer believes that this is not a vulnerability because running a command via sudo as a user not present in the local password database is an intentional feature. Because this behavior surprised some users, sudo 1.8.30 introduced an option to enable/disable this behavior with the default being disabled.
    However, this does not change the fact that sudo was behaving as intended, and as documented, in earlier versions (CVE-2019-19232)

  • In Sudo through 1.8.29, the fact that a user has been blocked (e.g., by using the ! character in the shadow file instead of a password hash) is not considered, allowing an attacker (who has access to a Runas ALL sudoer account) to impersonate any blocked user. NOTE: The software maintainer believes that this CVE is not valid. Disabling local password authentication for a user is not the same as disabling all access to that user–the user may still be able to login via other means (ssh key, kerberos, etc). Both the Linux shadow(5) and passwd(1) manuals are clear on this. Indeed it is a valid use case to have local accounts that are only accessible via sudo and that cannot be logged into with a password. Sudo 1.8.30 added an optional setting to check the shell of the target user (not the encrypted password!) against the contents of /etc/shells but that is not the same thing as preventing access to users with an invalid password hash (CVE-2019-19234)

  • The sudoedit personality of Sudo before 1.9.5 may allow a local unprivileged user to perform arbitrary directory-existence tests by winning a sudo_edit.c race condition in replacing a user-controlled directory by a symlink to an arbitrary path. (CVE-2021-23239)

Note that Nessus has not tested for these issues but has instead relied on the package manager’s report that the package is installed.

#%NASL_MIN_LEVEL 80900
##
# (C) Tenable, Inc.
#
# The descriptive text and package checks in this plugin were
# extracted from Red Hat Security Advisory sudo. The text
# itself is copyright (C) Red Hat, Inc.
##

include('compat.inc');

if (description)
{
  script_id(195537);
  script_version("1.0");
  script_set_attribute(attribute:"plugin_modification_date", value:"2024/05/11");

  script_cve_id(
    "CVE-2016-7032",
    "CVE-2016-7076",
    "CVE-2016-7091",
    "CVE-2019-19232",
    "CVE-2019-19234",
    "CVE-2021-23239",
    "CVE-2021-23240"
  );
  script_xref(name:"IAVA", value:"2021-A-0053");

  script_name(english:"RHEL 5 : sudo (Unpatched Vulnerability)");

  script_set_attribute(attribute:"synopsis", value:
"The remote Red Hat 5 host is affected by multiple vulnerabilities that will not be patched.");
  script_set_attribute(attribute:"description", value:
"The remote Redhat Enterprise Linux 5 host has one or more packages installed that are affected by multiple
vulnerabilities that have been acknowledged by the vendor but will not be patched.

  - sudo: noexec bypass via wordexp() (CVE-2016-7076)

  - sudo: symbolic link attack in SELinux-enabled sudoedit (CVE-2021-23240)

  - sudo_noexec.so in Sudo before 1.8.15 on Linux might allow local users to bypass intended noexec command
    restrictions via an application that calls the (1) system or (2) popen function. (CVE-2016-7032)

  - sudo: It was discovered that the default sudo configuration on Red Hat Enterprise Linux and possibly other
    Linux implementations preserves the value of INPUTRC which could lead to information disclosure. A local
    user with sudo access to a restricted program that uses readline could use this flaw to read content from
    specially formatted files with elevated privileges provided by sudo. (CVE-2016-7091)

  - In Sudo through 1.8.29, an attacker with access to a Runas ALL sudoer account can impersonate a
    nonexistent user by invoking sudo with a numeric uid that is not associated with any user. NOTE: The
    software maintainer believes that this is not a vulnerability because running a command via sudo as a user
    not present in the local password database is an intentional feature. Because this behavior surprised some
    users, sudo 1.8.30 introduced an option to enable/disable this behavior with the default being disabled.
    However, this does not change the fact that sudo was behaving as intended, and as documented, in earlier
    versions (CVE-2019-19232)

  - In Sudo through 1.8.29, the fact that a user has been blocked (e.g., by using the ! character in the
    shadow file instead of a password hash) is not considered, allowing an attacker (who has access to a Runas
    ALL sudoer account) to impersonate any blocked user. NOTE: The software maintainer believes that this CVE
    is not valid. Disabling local password authentication for a user is not the same as disabling all access
    to that user--the user may still be able to login via other means (ssh key, kerberos, etc). Both the Linux
    shadow(5) and passwd(1) manuals are clear on this. Indeed it is a valid use case to have local accounts
    that are _only_ accessible via sudo and that cannot be logged into with a password. Sudo 1.8.30 added an
    optional setting to check the _shell_ of the target user (not the encrypted password!) against the
    contents of /etc/shells but that is not the same thing as preventing access to users with an invalid
    password hash (CVE-2019-19234)

  - The sudoedit personality of Sudo before 1.9.5 may allow a local unprivileged user to perform arbitrary
    directory-existence tests by winning a sudo_edit.c race condition in replacing a user-controlled directory
    by a symlink to an arbitrary path. (CVE-2021-23239)

Note that Nessus has not tested for these issues but has instead relied on the package manager's report that the package
is installed.");
  script_set_attribute(attribute:"solution", value:
"The vendor has acknowledged the vulnerabilities but no solution has been provided. Refer to the vendor for remediation
guidance.");
  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:POC/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:P/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2016-7076");
  script_set_attribute(attribute:"cvss3_score_source", value:"CVE-2021-23240");

  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"vendor_unpatched", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2016/08/24");
  script_set_attribute(attribute:"plugin_publication_date", value:"2024/05/11");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:redhat:enterprise_linux:5");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:redhat:enterprise_linux:6");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:redhat:enterprise_linux:7");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:redhat:enterprise_linux:compat-readline43");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:redhat:enterprise_linux:compat-readline5");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:redhat:enterprise_linux:readline");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:redhat:enterprise_linux:sudo");
  script_set_attribute(attribute:"generated_plugin", value:"current");
  script_set_attribute(attribute:"stig_severity", value:"I");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"Red Hat Local Security Checks");

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

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

  exit(0);
}


include('rpm.inc');
include('rhel.inc');

if (!get_kb_item("global_settings/vendor_unpatched"))
exit(0, "Unpatched Vulnerabilities Detection not active.");

if (!get_kb_item('Host/local_checks_enabled')) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
var os_release = get_kb_item('Host/RedHat/release');
if (isnull(os_release) || 'Red Hat' >!< os_release) audit(AUDIT_OS_NOT, 'Red Hat');
var os_ver = pregmatch(pattern: "Red Hat Enterprise Linux.*release ([0-9]+(\.[0-9]+)?)", string:os_release);
if (isnull(os_ver)) audit(AUDIT_UNKNOWN_APP_VER, 'Red Hat');
os_ver = os_ver[1];
if (!rhel_check_release(operator: 'ge', os_version: os_ver, rhel_version: '5')) audit(AUDIT_OS_NOT, 'Red Hat 5.x', 'Red Hat ' + os_ver);

if (!get_kb_item('Host/RedHat/rpm-list')) audit(AUDIT_PACKAGE_LIST_MISSING);

var cpu = get_kb_item('Host/cpu');
if (isnull(cpu)) audit(AUDIT_UNKNOWN_ARCH);
if ('x86_64' >!< cpu && cpu !~ "^i[3-6]86$" && 's390' >!< cpu && 'aarch64' >!< cpu && 'ppc' >!< cpu) audit(AUDIT_LOCAL_CHECKS_NOT_IMPLEMENTED, 'Red Hat', cpu);

var constraints = [
  {
    'pkgs': [
      {'reference':'compat-readline43', 'release':'5', 'rpm_spec_vers_cmp':TRUE, 'unpatched_pkg':'compat-readline43', 'cves':['CVE-2016-7091']},
      {'reference':'readline', 'release':'5', 'rpm_spec_vers_cmp':TRUE, 'unpatched_pkg':'readline', 'cves':['CVE-2016-7091']},
      {'reference':'sudo', 'release':'5', 'rpm_spec_vers_cmp':TRUE, 'unpatched_pkg':'sudo'}
    ]
  }
];


var flag = 0;
foreach var constraint_array ( constraints ) {
  var repo_relative_urls = NULL;
  var enterprise_linux_flag = rhel_repo_urls_has_content_dist_rhel(repo_urls:repo_relative_urls);
  foreach var pkg ( constraint_array['pkgs'] ) {
    var unpatched_pkg = NULL;
    var _release = NULL;
    var sp = NULL;
    var el_string = NULL;
    var rpm_spec_vers_cmp = NULL;
    var exists_check = NULL;
    var cves = NULL;
    if (!empty_or_null(pkg['unpatched_pkg'])) unpatched_pkg = pkg['unpatched_pkg'];
    if (!empty_or_null(pkg['release'])) _release = 'RHEL' + pkg['release'];
    if (!empty_or_null(pkg['sp'])) sp = pkg['sp'];
    if (!empty_or_null(pkg['rpm_spec_vers_cmp'])) rpm_spec_vers_cmp = pkg['rpm_spec_vers_cmp'];
    if (!empty_or_null(pkg['exists_check'])) exists_check = pkg['exists_check'];
    if (!empty_or_null(pkg['cves'])) cves = pkg['cves'];
    if (unpatched_pkg &&
        _release &&
        (!exists_check || rpm_exists(release:_release, rpm:exists_check)) &&
        unpatched_package_exists(release:_release, package:unpatched_pkg, cves: cves)) flag++;
  }
}

if (flag)
{
  var extra = NULL;
  security_report_v4(
      port       : 0,
      severity   : SECURITY_HOLE,
      extra      : unpatched_packages_report()
  );
  exit(0);
}
else
{
  var tested = pkg_tests_get();
  if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
  else audit(AUDIT_PACKAGE_NOT_INSTALLED, 'compat-readline43 / readline / sudo');
}
VendorProductVersionCPE
redhatenterprise_linux5cpe:/o:redhat:enterprise_linux:5
redhatenterprise_linux6cpe:/o:redhat:enterprise_linux:6
redhatenterprise_linux7cpe:/o:redhat:enterprise_linux:7
redhatenterprise_linuxcompat-readline43p-cpe:/a:redhat:enterprise_linux:compat-readline43
redhatenterprise_linuxcompat-readline5p-cpe:/a:redhat:enterprise_linux:compat-readline5
redhatenterprise_linuxreadlinep-cpe:/a:redhat:enterprise_linux:readline
redhatenterprise_linuxsudop-cpe:/a:redhat:enterprise_linux:sudo