Ubuntu 20.04 LTS / 22.04 LTS : Samba vulnerabilities (USN-5542-1)

high Nessus Plugin ID 163679


The remote Ubuntu host is missing one or more security updates.


The remote Ubuntu 20.04 LTS / 22.04 LTS host has packages installed that are affected by multiple vulnerabilities as referenced in the USN-5542-1 advisory.

- samba: MaxQueryDuration not honoured in Samba AD DC LDAP (CVE-2021-3670)

- The KDC and the kpasswd service share a single account and set of keys. In certain cases, this makes the two services susceptible to confusion. When a user's password has expired, that user is requested to change their password. Until doing so, the user is restricted to only acquiring tickets to kpasswd.
However, a vulnerability meant that the kpasswd's principal, when canonicalized, was set to that of the TGS (Ticket-Granting Service), thus yielding TGTs from ordinary kpasswd requests. These TGTs could be used to perform an Elevation of Privilege attack by obtaining service tickets and using services in the forest.
This vulnerability existed in versions of Samba built with Heimdal Kerberos. A separate vulnerability in Samba versions below 4.16, and in Samba built with MIT Kerberos, led the KDC to accept kpasswd tickets as if they were TGTs, with the same overall outcome. On the reverse side of the issue, password changes could be effected by presenting TGTs as if they were kpasswd tickets. TGTs having potentially longer lifetimes than kpasswd tickets, the value of a stolen cache containing a TGT was hence increased to an attacker, with the possibility of indefinite control over an account by means of a password change. Finally, kpasswd service tickets would be accepted for changes to one's own password, contrary to the requirement that tickets be acquired with an initial KDC request in such cases. As part of the mitigations, the lifetime of kpasswd tickets has been restricted to a maximum of two minutes. The KDC will not longer accept TGTs with two minutes or less left to live, to make sure it does not accept kpasswd tickets. (CVE-2022-2031)

- Please note that only versions of Samba prior to 4.11.0 are vulnerable to this bug by default. Samba versions 4.11.0 and above disable SMB1 by default, and will only be vulnerable if the administrator has deliberately enabled SMB1 in the smb.conf file. All versions of Samba with SMB1 enabled are vulnerable to a server memory information leak bug over SMB1 if a client can write data to a share. Some SMB1 write requests were not correctly range checked to ensure the client had sent enough data to fulfill the write, allowing server memory contents to be written into the file (or printer) instead of client supplied data.
The client cannot control the area of the server memory that is written to the file (or printer).

- Tickets received by the kpasswd service were decrypted without specifying that only that service's own keys should be tried. By setting the ticket's server name to a principal associated with their own account, or by exploiting a fallback where known keys would be tried until a suitable one was found, an attacker could have the server accept tickets encrypted with any key, including their own. A user could thus change the password of the Administrator account and gain total control over the domain. Full loss of confidentiality and integrity would be possible, as well as of availability by denying users access to their accounts. In addition, the kpasswd service would accept tickets encrypted by the krbtgt key of an RODC, in spite of the fact that RODCs should not have been able to authorise password changes.

- Due to incorrect values used as the limit for a loop and as the 'count' parameter to memcpy(), the server, receiving a specially crafted message, leaves an array of structures partially uninitialised, or accesses an arbitrary element beyond the end of an array. Outcomes achievable by an attacker include segmentation faults and corresponding loss of availability. Depending on the contents of the uninitialised memory, confidentiality may also be affected. (CVE-2022-32745)

- Some database modules make a shallow copy of an LDAP add/delete message so they can make modifications to its elements without affecting the original message. Each element in a message points to an array of values, and these arrays are shared between the original message and the copy. The issue arises when a database module adds new values to an existing array. A call to realloc() increases the array's size to accommodate new elements, but at the same time, frees the old array. This leaves the original message element with a dangling pointer to a now-freed array. When the database audit logging module subsequently logs the details of the original message, it will access this freed data, generally resulting in corrupted log output or a crash. The code paths susceptible to this issue are reachable when certain specific attributes, such as userAccountControl, are added or modified. These attributes are not editable by default without having a privilege assigned, such as Write Property. (CVE-2022-32746)

Note that Nessus has not tested for these issues but has instead relied only on the application's self-reported version number.


Update the affected packages.

See Also


Plugin Details

Severity: High

ID: 163679

File Name: ubuntu_USN-5542-1.nasl

Version: 1.6

Type: local

Agent: unix

Published: 8/1/2022

Updated: 7/10/2023

Supported Sensors: Agentless Assessment, Frictionless Assessment Agent, Frictionless Assessment AWS, Frictionless Assessment Azure, Nessus Agent

Risk Information


Risk Factor: Medium

Score: 5.9


Risk Factor: High

Base Score: 9.4

Temporal Score: 7

Vector: CVSS2#AV:N/AC:L/Au:N/C:C/I:N/A:C

CVSS Score Source: CVE-2022-32745


Risk Factor: High

Base Score: 8.8

Temporal Score: 7.7

Vector: CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Temporal Vector: CVSS:3.0/E:U/RL:O/RC:C

CVSS Score Source: CVE-2022-32744

Vulnerability Information

CPE: cpe:/o:canonical:ubuntu_linux:20.04:-:lts, cpe:/o:canonical:ubuntu_linux:22.04:-:lts, p-cpe:/a:canonical:ubuntu_linux:ctdb, p-cpe:/a:canonical:ubuntu_linux:libnss-winbind, p-cpe:/a:canonical:ubuntu_linux:libpam-winbind, p-cpe:/a:canonical:ubuntu_linux:libsmbclient, p-cpe:/a:canonical:ubuntu_linux:libsmbclient-dev, p-cpe:/a:canonical:ubuntu_linux:libwbclient-dev, p-cpe:/a:canonical:ubuntu_linux:libwbclient0, p-cpe:/a:canonical:ubuntu_linux:python3-samba, p-cpe:/a:canonical:ubuntu_linux:registry-tools, p-cpe:/a:canonical:ubuntu_linux:samba, p-cpe:/a:canonical:ubuntu_linux:samba-common, p-cpe:/a:canonical:ubuntu_linux:samba-common-bin, p-cpe:/a:canonical:ubuntu_linux:samba-dev, p-cpe:/a:canonical:ubuntu_linux:samba-dsdb-modules, p-cpe:/a:canonical:ubuntu_linux:samba-libs, p-cpe:/a:canonical:ubuntu_linux:samba-testsuite, p-cpe:/a:canonical:ubuntu_linux:samba-vfs-modules, p-cpe:/a:canonical:ubuntu_linux:smbclient, p-cpe:/a:canonical:ubuntu_linux:winbind

Required KB Items: Host/cpu, Host/Ubuntu, Host/Ubuntu/release, Host/Debian/dpkg-l

Exploit Ease: No known exploits are available

Patch Publication Date: 8/1/2022

Vulnerability Publication Date: 7/8/2022

Reference Information

CVE: CVE-2021-3670, CVE-2022-2031, CVE-2022-32742, CVE-2022-32744, CVE-2022-32745, CVE-2022-32746

IAVA: 2022-A-0299-S

USN: 5542-1