REDHAT-BUG-2585960: Medium severity Samba Samba vulnerability
ldbmatchbitmask() in lib/ldb/common/ldbmatch.c does not check whether the attribute it compares is inaccessible. ldbmatchmessage() skips ldbmustsuppressmatch() when the filter operation is LDBOPEXTENDED. The bitwise rules are that operation. Their callback is ldbmatchbitmask().
A search unpacks the record and calls the redact callback before the match. On an AD DC that callback is aclredactmsgforfilter() in source4/dsdb/samdb/ldbmodules/aclread.c. For an attribute named in the filter, aclredactattr() calls ldbmsgelementmarkinaccessible() when the caller lacks the access mask. A confidential attribute requires control access in addition to read property. A secret attribute is marked inaccessible for every caller. ldbmatchbitmask() then finds the element and calls ldbcomparatorbitmask(). That function parses the stored bytes and the filter value with strtoull(). The AND rule matches when every bit in the filter value is set in the stored value. The OR rule matches when any bit is set. The entry is selected when the comparison matches. aclreadcallback() later removes inaccessible values from the entry it sends on. A stored value that is not an integer makes ldbcomparatorbitmask() return LDBERRINVALIDATTRIBUTESYNTAX. A missing value does not match. ldbkvsearchandreturnbase() returns that syntax error. The full search stores LDBERROPERATIONSERROR.
The caller learns the integer. Each bit of an unreadable integer attribute selects or skips the entry, and the value is removed from the entry afterwards. msKds-CreateTime and msKds-UseStartTime are large integers, and msKds-Version is an integer. Provision stores them as decimal strings on the root key. msKds-RootKeyData is an octet string. The comparator does not return those bytes. The same comparison is the one that reports the syntax error when a non-integer value is present.
The caller is authenticated. aclreadcheckobjectvisible() allows the object when the caller has list rights on the parent. The container class default descriptor grants Authenticated Users read property and list contents. The root key class default descriptor grants read to Domain Admins, Enterprise Admins, and the system account. It does not grant that read to Authenticated Users. A confidential attribute also requires control access, which that user does not have, so the attribute is marked inaccessible. The search has no Domain Admin check.
The flaw is reachable in the default configuration of an AD DC. ldbinit() registers both bitwise rules. The acl search parameter defaults to true. The stock schema sets SEARCHFLAGCONFIDENTIAL on msKds-CreateTime, msKds-UseStartTime, and msKds-Version. Provision creates the root key that holds them.
Introduced on 14 February 2023 by Joseph Sutton in commit 9f31e4139c12262f5626108c6a883f07c4dd314e, "CVE-2023-0614 ldb: Centralise checking for inaccessible matches". The same change is in samba 4.16.10 (commit d60683e5e9daf243e9a2acc203b567c3a6c92567, ldb 2.5.3), samba 4.17.7 (commit b98f8c1af7770b49a447fdcc67ea64d98454955f, ldb 2.6.2), and samba 4.18.1 (commit 358894675d188b06cc0d24299012c898b394f99f, ldb 2.7.2). It is not in samba 4.16.9, samba 4.17.6, samba 4.18.0, or the 4.15 line through samba 4.15.13. It is present in samba 4.25.1 and on the current master branch.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
sambato a version that resolves this vulnerability.Fixed in 4.16.10 - Upgrade
Upgrade
sambato a version that resolves this vulnerability.Fixed in 4.17.7 - Upgrade
Upgrade
sambato a version that resolves this vulnerability.Fixed in 4.18.1 - Upgrade
Upgrade
sambato a version that resolves this vulnerability.Fixed in 4.25.1