The remote Ubuntu 20.04 LTS / 22.04 LTS host has packages installed that are affected by multiple vulnerabilities as referenced in the USN-6355-1 advisory.
There’s a possible overflow in handle_image() when shim tries to load and execute crafted EFI executables;
The handle_image() function takes into account the SizeOfRawData field from each section to be loaded. An attacker can leverage this to perform out-of-bound writes into memory. Arbitrary code execution is not discarded in such scenario. (CVE-2022-28737)
A crafted 16-bit grayscale PNG image may lead to a out-of-bounds write in the heap area. An attacker may take advantage of that to cause heap data corruption or eventually arbitrary code execution and circumvent secure boot protections. This issue has a high complexity to be exploited as an attacker needs to perform some triage over the heap layout to achieve signifcant results, also the values written into the memory are repeated three times in a row making difficult to produce valid payloads. This flaw affects grub2 versions prior grub-2.12. (CVE-2021-3695)
A heap out-of-bounds write may heppen during the handling of Huffman tables in the PNG reader. This may lead to data corruption in the heap space. Confidentiality, Integrity and Availablity impact may be considered Low as it’s very complex to an attacker control the encoding and positioning of corrupted Huffman entries to achieve results such as arbitrary code execution and/or secure boot circumvention. This flaw affects grub2 versions prior grub-2.12. (CVE-2021-3696)
A crafted JPEG image may lead the JPEG reader to underflow its data pointer, allowing user-controlled data to be written in heap. To a successful to be performed the attacker needs to perform some triage over the heap layout and craft an image with a malicious format and payload. This vulnerability can lead to data corruption and eventual code execution or secure boot circumvention. This flaw affects grub2 versions prior grub-2.12. (CVE-2021-3697)
A flaw in grub2 was found where its configuration file, known as grub.cfg, is being created with the wrong permission set allowing non privileged users to read its content. This represents a low severity confidentiality issue, as those users can eventually read any encrypted passwords present in grub.cfg.
This flaw affects grub2 2.06 and previous versions. This issue has been fixed in grub upstream but no version with the fix is currently released. (CVE-2021-3981)
Integer underflow in grub_net_recv_ip4_packets; A malicious crafted IP packet can lead to an integer underflow in grub_net_recv_ip4_packets() function on rsm->total_len value. Under certain circumstances the total_len value may end up wrapping around to a small integer number which will be used in memory allocation. If the attack succeeds in such way, subsequent operations can write past the end of the buffer. (CVE-2022-28733)
Out-of-bounds write when handling split HTTP headers; When handling split HTTP headers, GRUB2 HTTP code accidentally moves its internal data buffer point by one position. This can lead to a out-of-bound write further when parsing the HTTP request, writing a NULL byte past the buffer. It’s conceivable that an attacker controlled set of packets can lead to corruption of the GRUB2’s internal memory metadata.
(CVE-2022-28734)
The GRUB2’s shim_lock verifier allows non-kernel files to be loaded on shim-powered secure boot systems.
Allowing such files to be loaded may lead to unverified code and modules to be loaded in GRUB2 breaking the secure boot trust-chain. (CVE-2022-28735)
There’s a use-after-free vulnerability in grub_cmd_chainloader() function; The chainloader command is used to boot up operating systems that doesn’t support multiboot and do not have direct support from GRUB2.
When executing chainloader more than once a use-after-free vulnerability is triggered. If an attacker can control the GRUB2’s memory allocation pattern sensitive data may be exposed and arbitrary code execution can be achieved. (CVE-2022-28736)
When rendering certain unicode sequences, grub2’s font code doesn’t proper validate if the informed glyph’s width and height is constrained within bitmap size. As consequence an attacker can craft an input which will lead to a out-of-bounds write into grub2’s heap, leading to memory corruption and availability issues. Although complex, arbitrary code execution could not be discarded. (CVE-2022-3775)
Note that Nessus has not tested for these issues but has instead relied only on the application’s self-reported version number.
#%NASL_MIN_LEVEL 80900
##
# (C) Tenable, Inc.
#
# The descriptive text and package checks in this plugin were
# extracted from Ubuntu Security Notice USN-6355-1. The text
# itself is copyright (C) Canonical, Inc. See
# <https://ubuntu.com/security/notices>. Ubuntu(R) is a registered
# trademark of Canonical, Inc.
##
include('compat.inc');
if (description)
{
script_id(181178);
script_version("1.1");
script_set_attribute(attribute:"plugin_modification_date", value:"2024/01/17");
script_cve_id(
"CVE-2021-3695",
"CVE-2021-3696",
"CVE-2021-3697",
"CVE-2021-3981",
"CVE-2022-3775",
"CVE-2022-28733",
"CVE-2022-28734",
"CVE-2022-28735",
"CVE-2022-28736",
"CVE-2022-28737"
);
script_xref(name:"USN", value:"6355-1");
script_name(english:"Ubuntu 20.04 LTS / 22.04 LTS : GRUB2 vulnerabilities (USN-6355-1)");
script_set_attribute(attribute:"synopsis", value:
"The remote Ubuntu host is missing one or more security updates.");
script_set_attribute(attribute:"description", value:
"The remote Ubuntu 20.04 LTS / 22.04 LTS host has packages installed that are affected by multiple vulnerabilities as
referenced in the USN-6355-1 advisory.
- There's a possible overflow in handle_image() when shim tries to load and execute crafted EFI executables;
The handle_image() function takes into account the SizeOfRawData field from each section to be loaded. An
attacker can leverage this to perform out-of-bound writes into memory. Arbitrary code execution is not
discarded in such scenario. (CVE-2022-28737)
- A crafted 16-bit grayscale PNG image may lead to a out-of-bounds write in the heap area. An attacker may
take advantage of that to cause heap data corruption or eventually arbitrary code execution and circumvent
secure boot protections. This issue has a high complexity to be exploited as an attacker needs to perform
some triage over the heap layout to achieve signifcant results, also the values written into the memory
are repeated three times in a row making difficult to produce valid payloads. This flaw affects grub2
versions prior grub-2.12. (CVE-2021-3695)
- A heap out-of-bounds write may heppen during the handling of Huffman tables in the PNG reader. This may
lead to data corruption in the heap space. Confidentiality, Integrity and Availablity impact may be
considered Low as it's very complex to an attacker control the encoding and positioning of corrupted
Huffman entries to achieve results such as arbitrary code execution and/or secure boot circumvention. This
flaw affects grub2 versions prior grub-2.12. (CVE-2021-3696)
- A crafted JPEG image may lead the JPEG reader to underflow its data pointer, allowing user-controlled data
to be written in heap. To a successful to be performed the attacker needs to perform some triage over the
heap layout and craft an image with a malicious format and payload. This vulnerability can lead to data
corruption and eventual code execution or secure boot circumvention. This flaw affects grub2 versions
prior grub-2.12. (CVE-2021-3697)
- A flaw in grub2 was found where its configuration file, known as grub.cfg, is being created with the wrong
permission set allowing non privileged users to read its content. This represents a low severity
confidentiality issue, as those users can eventually read any encrypted passwords present in grub.cfg.
This flaw affects grub2 2.06 and previous versions. This issue has been fixed in grub upstream but no
version with the fix is currently released. (CVE-2021-3981)
- Integer underflow in grub_net_recv_ip4_packets; A malicious crafted IP packet can lead to an integer
underflow in grub_net_recv_ip4_packets() function on rsm->total_len value. Under certain circumstances the
total_len value may end up wrapping around to a small integer number which will be used in memory
allocation. If the attack succeeds in such way, subsequent operations can write past the end of the
buffer. (CVE-2022-28733)
- Out-of-bounds write when handling split HTTP headers; When handling split HTTP headers, GRUB2 HTTP code
accidentally moves its internal data buffer point by one position. This can lead to a out-of-bound write
further when parsing the HTTP request, writing a NULL byte past the buffer. It's conceivable that an
attacker controlled set of packets can lead to corruption of the GRUB2's internal memory metadata.
(CVE-2022-28734)
- The GRUB2's shim_lock verifier allows non-kernel files to be loaded on shim-powered secure boot systems.
Allowing such files to be loaded may lead to unverified code and modules to be loaded in GRUB2 breaking
the secure boot trust-chain. (CVE-2022-28735)
- There's a use-after-free vulnerability in grub_cmd_chainloader() function; The chainloader command is used
to boot up operating systems that doesn't support multiboot and do not have direct support from GRUB2.
When executing chainloader more than once a use-after-free vulnerability is triggered. If an attacker can
control the GRUB2's memory allocation pattern sensitive data may be exposed and arbitrary code execution
can be achieved. (CVE-2022-28736)
- When rendering certain unicode sequences, grub2's font code doesn't proper validate if the informed
glyph's width and height is constrained within bitmap size. As consequence an attacker can craft an input
which will lead to a out-of-bounds write into grub2's heap, leading to memory corruption and availability
issues. Although complex, arbitrary code execution could not be discarded. (CVE-2022-3775)
Note that Nessus has not tested for these issues but has instead relied only on the application's self-reported version
number.");
script_set_attribute(attribute:"see_also", value:"https://ubuntu.com/security/notices/USN-6355-1");
script_set_attribute(attribute:"solution", value:
"Update the affected packages.");
script_set_cvss_base_vector("CVSS2#AV:L/AC:M/Au:N/C:C/I:C/A:C");
script_set_cvss_temporal_vector("CVSS2#E:U/RL:OF/RC:C");
script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H");
script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C");
script_set_attribute(attribute:"cvss_score_source", value:"CVE-2021-3696");
script_set_attribute(attribute:"cvss3_score_source", value:"CVE-2022-28733");
script_set_attribute(attribute:"exploitability_ease", value:"No known exploits are available");
script_set_attribute(attribute:"exploit_available", value:"false");
script_set_attribute(attribute:"vuln_publication_date", value:"2020/07/30");
script_set_attribute(attribute:"patch_publication_date", value:"2023/09/08");
script_set_attribute(attribute:"plugin_publication_date", value:"2023/09/08");
script_set_attribute(attribute:"plugin_type", value:"local");
script_set_attribute(attribute:"cpe", value:"cpe:/o:canonical:ubuntu_linux:20.04:-:lts");
script_set_attribute(attribute:"cpe", value:"cpe:/o:canonical:ubuntu_linux:22.04:-:lts");
script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:grub-efi-amd64");
script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:grub-efi-amd64-bin");
script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:grub-efi-amd64-signed");
script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:grub-efi-arm64");
script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:grub-efi-arm64-bin");
script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:grub-efi-arm64-signed");
script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:shim");
script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:shim-signed");
script_set_attribute(attribute:"generated_plugin", value:"current");
script_end_attributes();
script_category(ACT_GATHER_INFO);
script_family(english:"Ubuntu Local Security Checks");
script_copyright(english:"Ubuntu Security Notice (C) 2023-2024 Canonical, Inc. / NASL script (C) 2023-2024 and is owned by Tenable, Inc. or an Affiliate thereof.");
script_dependencies("ssh_get_info.nasl");
script_require_keys("Host/cpu", "Host/Ubuntu", "Host/Ubuntu/release", "Host/Debian/dpkg-l");
exit(0);
}
include('debian_package.inc');
if ( ! get_kb_item('Host/local_checks_enabled') ) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
var os_release = get_kb_item('Host/Ubuntu/release');
if ( isnull(os_release) ) audit(AUDIT_OS_NOT, 'Ubuntu');
os_release = chomp(os_release);
if (! ('20.04' >< os_release || '22.04' >< os_release)) audit(AUDIT_OS_NOT, 'Ubuntu 20.04 / 22.04', 'Ubuntu ' + os_release);
if ( ! get_kb_item('Host/Debian/dpkg-l') ) 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) audit(AUDIT_LOCAL_CHECKS_NOT_IMPLEMENTED, 'Ubuntu', cpu);
var pkgs = [
{'osver': '20.04', 'pkgname': 'grub-efi-amd64', 'pkgver': '2.06-2ubuntu14.1'},
{'osver': '20.04', 'pkgname': 'grub-efi-amd64-bin', 'pkgver': '2.06-2ubuntu14.1'},
{'osver': '20.04', 'pkgname': 'grub-efi-amd64-signed', 'pkgver': '1.187.3~20.04.1+2.06-2ubuntu14.1'},
{'osver': '20.04', 'pkgname': 'grub-efi-arm64', 'pkgver': '2.06-2ubuntu14.1'},
{'osver': '20.04', 'pkgname': 'grub-efi-arm64-bin', 'pkgver': '2.06-2ubuntu14.1'},
{'osver': '20.04', 'pkgname': 'grub-efi-arm64-signed', 'pkgver': '1.187.3~20.04.1+2.06-2ubuntu14.1'},
{'osver': '20.04', 'pkgname': 'shim', 'pkgver': '15.7-0ubuntu1'},
{'osver': '20.04', 'pkgname': 'shim-signed', 'pkgver': '1.40.9+15.7-0ubuntu1'},
{'osver': '22.04', 'pkgname': 'grub-efi-amd64', 'pkgver': '2.06-2ubuntu14.1'},
{'osver': '22.04', 'pkgname': 'grub-efi-amd64-bin', 'pkgver': '2.06-2ubuntu14.1'},
{'osver': '22.04', 'pkgname': 'grub-efi-amd64-signed', 'pkgver': '1.187.3~22.04.1+2.06-2ubuntu14.1'},
{'osver': '22.04', 'pkgname': 'grub-efi-arm64', 'pkgver': '2.06-2ubuntu14.1'},
{'osver': '22.04', 'pkgname': 'grub-efi-arm64-bin', 'pkgver': '2.06-2ubuntu14.1'},
{'osver': '22.04', 'pkgname': 'grub-efi-arm64-signed', 'pkgver': '1.187.3~22.04.1+2.06-2ubuntu14.1'},
{'osver': '22.04', 'pkgname': 'shim', 'pkgver': '15.7-0ubuntu1'},
{'osver': '22.04', 'pkgname': 'shim-signed', 'pkgver': '1.51.3+15.7-0ubuntu1'}
];
var flag = 0;
foreach package_array ( pkgs ) {
var osver = NULL;
var pkgname = NULL;
var pkgver = NULL;
if (!empty_or_null(package_array['osver'])) osver = package_array['osver'];
if (!empty_or_null(package_array['pkgname'])) pkgname = package_array['pkgname'];
if (!empty_or_null(package_array['pkgver'])) pkgver = package_array['pkgver'];
if (osver && pkgname && pkgver) {
if (ubuntu_check(osver:osver, pkgname:pkgname, pkgver:pkgver)) flag++;
}
}
if (flag)
{
security_report_v4(
port : 0,
severity : SECURITY_WARNING,
extra : ubuntu_report_get()
);
exit(0);
}
else
{
var tested = ubuntu_pkg_tests_get();
if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
else audit(AUDIT_PACKAGE_NOT_INSTALLED, 'grub-efi-amd64 / grub-efi-amd64-bin / grub-efi-amd64-signed / etc');
}
Vendor | Product | Version | CPE |
---|---|---|---|
canonical | ubuntu_linux | 20.04 | cpe:/o:canonical:ubuntu_linux:20.04:-:lts |
canonical | ubuntu_linux | 22.04 | cpe:/o:canonical:ubuntu_linux:22.04:-:lts |
canonical | ubuntu_linux | grub-efi-amd64 | p-cpe:/a:canonical:ubuntu_linux:grub-efi-amd64 |
canonical | ubuntu_linux | grub-efi-amd64-bin | p-cpe:/a:canonical:ubuntu_linux:grub-efi-amd64-bin |
canonical | ubuntu_linux | grub-efi-amd64-signed | p-cpe:/a:canonical:ubuntu_linux:grub-efi-amd64-signed |
canonical | ubuntu_linux | grub-efi-arm64 | p-cpe:/a:canonical:ubuntu_linux:grub-efi-arm64 |
canonical | ubuntu_linux | grub-efi-arm64-bin | p-cpe:/a:canonical:ubuntu_linux:grub-efi-arm64-bin |
canonical | ubuntu_linux | grub-efi-arm64-signed | p-cpe:/a:canonical:ubuntu_linux:grub-efi-arm64-signed |
canonical | ubuntu_linux | shim | p-cpe:/a:canonical:ubuntu_linux:shim |
canonical | ubuntu_linux | shim-signed | p-cpe:/a:canonical:ubuntu_linux:shim-signed |
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3695
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3696
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3697
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3981
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-28733
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-28734
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-28735
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-28736
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-28737
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-3775
ubuntu.com/security/notices/USN-6355-1