Bug 2108215 (CVE-2022-32746)

Summary: CVE-2022-32746 samba: AD users can induce a use-after-free in the server process with an LDAP add or modify request
Product: [Other] Security Response Reporter: Mauro Matteo Cascella <mcascell>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: abokovoy, anoopcs, asn, dkarpele, gdeschner, iboukris, jhrozek, jrivera, jstephen, kyoshida, lmohanty, lslebodn, madam, pfilipen, rhs-smb, sbose, security-response-team, sgallagh, ssorce
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: samba 4.16.4, samba 4.15.9, samba 4.14.14 Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in the Samba AD LDAP server. The AD DC database audit logging module can access LDAP message values freed by a preceding database module, resulting in a use-after-free issue. This issue is only possible when modifying certain privileged attributes, such as userAccountControl.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-05 23:03:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2109016, 2109017, 2111734, 2111735, 2111743    
Bug Blocks: 2095310, 2095313    

Description Mauro Matteo Cascella 2022-07-18 15:36:49 UTC
As per samba upstream advisory:

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.

Comment 2 Sandipan Roy 2022-07-28 04:09:37 UTC
Created libldb tracking bugs for this issue:

Affects: fedora-all [bug 2111735]


Created samba tracking bugs for this issue:

Affects: fedora-all [bug 2111734]

Comment 4 errata-xmlrpc 2022-11-08 10:18:32 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2022:7730 https://access.redhat.com/errata/RHSA-2022:7730

Comment 5 errata-xmlrpc 2022-11-15 10:56:11 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9

Via RHSA-2022:8318 https://access.redhat.com/errata/RHSA-2022:8318

Comment 6 Product Security DevOps Team 2022-12-05 23:03:19 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2022-32746