#%NASL_MIN_LEVEL 80900
##
# (C) Tenable, Inc.
#
# The package checks in this plugin were extracted from
# the CentOS Stream Build Service.
##
include('compat.inc');
if (description)
{
script_id(191201);
script_version("1.1");
script_set_attribute(attribute:"plugin_modification_date", value:"2024/04/26");
script_cve_id(
"CVE-2022-41723",
"CVE-2022-41724",
"CVE-2022-41725",
"CVE-2023-24534",
"CVE-2023-24536",
"CVE-2023-24538",
"CVE-2023-24539",
"CVE-2023-24540",
"CVE-2023-25173",
"CVE-2023-29400"
);
script_name(english:"CentOS 9 : buildah-1.30.0-2.el9");
script_set_attribute(attribute:"synopsis", value:
"The remote CentOS host is missing one or more security updates for buildah.");
script_set_attribute(attribute:"description", value:
"The remote CentOS Linux 9 host has packages installed that are affected by multiple vulnerabilities as referenced in the
buildah-1.30.0-2.el9 build changelog.
- A maliciously crafted HTTP/2 stream could cause excessive CPU consumption in the HPACK decoder, sufficient
to cause a denial of service from a small number of small requests. (CVE-2022-41723)
- Large handshake records may cause panics in crypto/tls. Both clients and servers may send large TLS
handshake records which cause servers and clients, respectively, to panic when attempting to construct
responses. This affects all TLS 1.3 clients, TLS 1.2 clients which explicitly enable session resumption
(by setting Config.ClientSessionCache to a non-nil value), and TLS 1.3 servers which request client
certificates (by setting Config.ClientAuth >= RequestClientCert). (CVE-2022-41724)
- A denial of service is possible from excessive resource consumption in net/http and mime/multipart.
Multipart form parsing with mime/multipart.Reader.ReadForm can consume largely unlimited amounts of memory
and disk files. This also affects form parsing in the net/http package with the Request methods FormFile,
FormValue, ParseMultipartForm, and PostFormValue. ReadForm takes a maxMemory parameter, and is documented
as storing up to maxMemory bytes +10MB (reserved for non-file parts) in memory. File parts which cannot
be stored in memory are stored on disk in temporary files. The unconfigurable 10MB reserved for non-file
parts is excessively large and can potentially open a denial of service vector on its own. However,
ReadForm did not properly account for all memory consumed by a parsed form, such as map entry overhead,
part names, and MIME headers, permitting a maliciously crafted form to consume well over 10MB. In
addition, ReadForm contained no limit on the number of disk files created, permitting a relatively small
request body to create a large number of disk temporary files. With fix, ReadForm now properly accounts
for various forms of memory overhead, and should now stay within its documented limit of 10MB + maxMemory
bytes of memory consumption. Users should still be aware that this limit is high and may still be
hazardous. In addition, ReadForm now creates at most one on-disk temporary file, combining multiple form
parts into a single temporary file. The mime/multipart.File interface type's documentation states, If
stored on disk, the File's underlying concrete type will be an *os.File.. This is no longer the case when
a form contains more than one file part, due to this coalescing of parts into a single file. The previous
behavior of using distinct files for each form part may be reenabled with the environment variable
GODEBUG=multipartfiles=distinct. Users should be aware that multipart.ReadForm and the http.Request
methods that call it do not limit the amount of disk consumed by temporary files. Callers can limit the
size of form data with http.MaxBytesReader. (CVE-2022-41725)
- HTTP and MIME header parsing can allocate large amounts of memory, even when parsing small inputs,
potentially leading to a denial of service. Certain unusual patterns of input data can cause the common
function used to parse HTTP and MIME headers to allocate substantially more memory than required to hold
the parsed headers. An attacker can exploit this behavior to cause an HTTP server to allocate large
amounts of memory from a small request, potentially leading to memory exhaustion and a denial of service.
With fix, header parsing now correctly allocates only the memory required to hold parsed headers.
(CVE-2023-24534)
- Multipart form parsing can consume large amounts of CPU and memory when processing form inputs containing
very large numbers of parts. This stems from several causes: 1. mime/multipart.Reader.ReadForm limits the
total memory a parsed multipart form can consume. ReadForm can undercount the amount of memory consumed,
leading it to accept larger inputs than intended. 2. Limiting total memory does not account for increased
pressure on the garbage collector from large numbers of small allocations in forms with many parts. 3.
ReadForm can allocate a large number of short-lived buffers, further increasing pressure on the garbage
collector. The combination of these factors can permit an attacker to cause an program that parses
multipart forms to consume large amounts of CPU and memory, potentially resulting in a denial of service.
This affects programs that use mime/multipart.Reader.ReadForm, as well as form parsing in the net/http
package with the Request methods FormFile, FormValue, ParseMultipartForm, and PostFormValue. With fix,
ReadForm now does a better job of estimating the memory consumption of parsed forms, and performs many
fewer short-lived allocations. In addition, the fixed mime/multipart.Reader imposes the following limits
on the size of parsed forms: 1. Forms parsed with ReadForm may contain no more than 1000 parts. This limit
may be adjusted with the environment variable GODEBUG=multipartmaxparts=. 2. Form parts parsed with
NextPart and NextRawPart may contain no more than 10,000 header fields. In addition, forms parsed with
ReadForm may contain no more than 10,000 header fields across all parts. This limit may be adjusted with
the environment variable GODEBUG=multipartmaxheaders=. (CVE-2023-24536)
- Templates do not properly consider backticks (`) as Javascript string delimiters, and do not escape them
as expected. Backticks are used, since ES6, for JS template literals. If a template contains a Go template
action within a Javascript template literal, the contents of the action can be used to terminate the
literal, injecting arbitrary Javascript code into the Go template. As ES6 template literals are rather
complex, and themselves can do string interpolation, the decision was made to simply disallow Go template
actions from being used inside of them (e.g. var a = {{.}}), since there is no obviously safe way to
allow this behavior. This takes the same approach as github.com/google/safehtml. With fix, Template.Parse
returns an Error when it encounters templates like this, with an ErrorCode of value 12. This ErrorCode is
currently unexported, but will be exported in the release of Go 1.21. Users who rely on the previous
behavior can re-enable it using the GODEBUG flag jstmpllitinterp=1, with the caveat that backticks will
now be escaped. This should be used with caution. (CVE-2023-24538)
- Angle brackets (<>) are not considered dangerous characters when inserted into CSS contexts. Templates
containing multiple actions separated by a '/' character can result in unexpectedly closing the CSS
context and allowing for injection of unexpected HTML, if executed with untrusted input. (CVE-2023-24539)
- Not all valid JavaScript whitespace characters are considered to be whitespace. Templates containing
whitespace characters outside of the character set \t\n\f\r\u0020\u2028\u2029 in JavaScript contexts
that also contain actions may not be properly sanitized during execution. (CVE-2023-24540)
- containerd is an open source container runtime. A bug was found in containerd prior to versions 1.6.18 and
1.5.18 where supplementary groups are not set up properly inside a container. If an attacker has direct
access to a container and manipulates their supplementary group access, they may be able to use
supplementary group access to bypass primary group restrictions in some cases, potentially gaining access
to sensitive information or gaining the ability to execute code in that container. Downstream applications
that use the containerd client library may be affected as well. This bug has been fixed in containerd
v1.6.18 and v.1.5.18. Users should update to these versions and recreate containers to resolve this issue.
Users who rely on a downstream application that uses containerd's client library should check that
application for a separate advisory and instructions. As a workaround, ensure that the `USER $USERNAME`
Dockerfile instruction is not used. Instead, set the container entrypoint to a value similar to
`ENTRYPOINT [su, -, user]` to allow `su` to properly set up supplementary groups. (CVE-2023-25173)
- Templates containing actions in unquoted HTML attributes (e.g. attr={{.}}) executed with empty input can
result in output with unexpected results when parsed due to HTML normalization rules. This may allow
injection of arbitrary attributes into tags. (CVE-2023-29400)
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://kojihub.stream.centos.org/koji/buildinfo?buildID=33739");
script_set_attribute(attribute:"solution", value:
"Update the CentOS 9 Stream buildah package.");
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:POC/RL:OF/RC: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_cvss3_temporal_vector("CVSS:3.0/E:P/RL:O/RC:C");
script_set_attribute(attribute:"cvss_score_source", value:"CVE-2023-24540");
script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
script_set_attribute(attribute:"exploit_available", value:"true");
script_set_attribute(attribute:"vuln_publication_date", value:"2023/02/15");
script_set_attribute(attribute:"patch_publication_date", value:"2023/06/14");
script_set_attribute(attribute:"plugin_publication_date", value:"2024/02/29");
script_set_attribute(attribute:"plugin_type", value:"local");
script_set_attribute(attribute:"cpe", value:"cpe:/a:centos:centos:9");
script_set_attribute(attribute:"cpe", value:"p-cpe:/a:centos:centos:buildah");
script_set_attribute(attribute:"cpe", value:"p-cpe:/a:centos:centos:buildah-tests");
script_set_attribute(attribute:"generated_plugin", value:"current");
script_end_attributes();
script_category(ACT_GATHER_INFO);
script_family(english:"CentOS 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");
script_require_keys("Host/local_checks_enabled", "Host/CentOS/release", "Host/CentOS/rpm-list", "Host/cpu");
exit(0);
}
include('rpm.inc');
include('rhel.inc');
if (!get_kb_item('Host/local_checks_enabled')) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
var os_release = get_kb_item('Host/CentOS/release');
if (isnull(os_release) || 'CentOS' >!< os_release) audit(AUDIT_OS_NOT, 'CentOS');
var os_ver = pregmatch(pattern: "CentOS(?: Stream)?(?: Linux)? release ([0-9]+)", string:os_release);
if (isnull(os_ver)) audit(AUDIT_UNKNOWN_APP_VER, 'CentOS');
os_ver = os_ver[1];
if (!rhel_check_release(operator: 'ge', os_version: os_ver, rhel_version: '9')) audit(AUDIT_OS_NOT, 'CentOS 9.x', 'CentOS ' + os_ver);
if (!get_kb_item('Host/CentOS/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, 'CentOS', cpu);
var pkgs = [
{'reference':'buildah-1.30.0-2.el9', 'cpu':'aarch64', 'release':'9', 'rpm_spec_vers_cmp':TRUE, 'epoch':'1'},
{'reference':'buildah-1.30.0-2.el9', 'cpu':'s390x', 'release':'9', 'rpm_spec_vers_cmp':TRUE, 'epoch':'1'},
{'reference':'buildah-1.30.0-2.el9', 'cpu':'x86_64', 'release':'9', 'rpm_spec_vers_cmp':TRUE, 'epoch':'1'},
{'reference':'buildah-tests-1.30.0-2.el9', 'cpu':'aarch64', 'release':'9', 'rpm_spec_vers_cmp':TRUE, 'epoch':'1'},
{'reference':'buildah-tests-1.30.0-2.el9', 'cpu':'s390x', 'release':'9', 'rpm_spec_vers_cmp':TRUE, 'epoch':'1'},
{'reference':'buildah-tests-1.30.0-2.el9', 'cpu':'x86_64', 'release':'9', 'rpm_spec_vers_cmp':TRUE, 'epoch':'1'}
];
var flag = 0;
foreach var package_array ( pkgs ) {
var reference = NULL;
var _release = NULL;
var sp = NULL;
var _cpu = NULL;
var el_string = NULL;
var rpm_spec_vers_cmp = NULL;
var epoch = NULL;
var allowmaj = NULL;
if (!empty_or_null(package_array['reference'])) reference = package_array['reference'];
if (!empty_or_null(package_array['release'])) _release = 'CentOS-' + package_array['release'];
if (!empty_or_null(package_array['sp'])) sp = package_array['sp'];
if (!empty_or_null(package_array['cpu'])) _cpu = package_array['cpu'];
if (!empty_or_null(package_array['el_string'])) el_string = package_array['el_string'];
if (!empty_or_null(package_array['rpm_spec_vers_cmp'])) rpm_spec_vers_cmp = package_array['rpm_spec_vers_cmp'];
if (!empty_or_null(package_array['epoch'])) epoch = package_array['epoch'];
if (!empty_or_null(package_array['allowmaj'])) allowmaj = package_array['allowmaj'];
if (reference && _release) {
if (rpm_check(release:_release, sp:sp, cpu:_cpu, reference:reference, epoch:epoch, el_string:el_string, rpm_spec_vers_cmp:rpm_spec_vers_cmp, allowmaj:allowmaj)) flag++;
}
}
if (flag)
{
security_report_v4(
port : 0,
severity : SECURITY_HOLE,
extra : rpm_report_get()
);
exit(0);
}
else
{
var tested = pkg_tests_get();
if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
else audit(AUDIT_PACKAGE_NOT_INSTALLED, 'buildah / buildah-tests');
}
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation