CVE-2026-125635: Libldb: samba: libldb: bitwise ldap match discloses unreadable integer attributes
A missing authorization check has been found in the ldbmatchbitmask() function in ldbmatch.c of the LDAP matching module in the libldb library of Samba. The directory marks an attribute the caller is not allowed to read, and the bitwise comparison uses that value anyway. A low-privileged network attacker or user who can list a directory object searches for one bit of an integer attribute on that object. The directory includes the object when that bit is set, and it removes the attribute from the answer. Repeating the search for each bit discloses the integer. A value that is not an integer, including a password or a key stored as bytes, is not returned as a number.
Other sources
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.
— Red Hat
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 4.16.10 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 4.17.7 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 4.18.1
Event History
Frequently Asked Questions
Who can exploit this issue?
A low-privileged network user or attacker who can search/list a directory object can exploit it. The attacker must be able to submit LDAP searches using bitwise matching rules against the target object.
What information can be disclosed?
The issue can disclose the value of an integer attribute that the caller is not authorized to read. By testing individual bits through repeated searches, an attacker can reconstruct the integer even though the attribute is omitted from search results.
Are passwords or keys exposed through this method?
No. Values that are not integers, including passwords or keys stored as byte values, are not returned as numbers by this behavior.
What configuration condition is required for exposure?
Exposure requires an unreadable integer attribute on a directory object that can still be targeted in LDAP bitwise-match searches by a user able to list that object. The provided information does not state whether this condition exists in a default deployment.