Bug 16094 - source4/dsdb/samdb/cracknames.c doesn't use ldb_binary_encode_string() consistently
Summary: source4/dsdb/samdb/cracknames.c doesn't use ldb_binary_encode_string() consis...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: AD: LDB/DSDB/SAMDB (show other bugs)
Version: 4.24.3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba release manager
QA Contact: Samba QA Contact
URL: https://gitlab.com/samba-team/samba/-...
Keywords:
: 16113 (view as bug list)
Depends on:
Blocks:
 
Reported: 2026-05-28 15:33 UTC by Stefan Metzmacher
Modified: 2026-08-13 14:31 UTC (History)
3 users (show)

See Also:


Attachments
Patch for v4-24-test (1.87 KB, text/plain)
2026-07-28 16:39 UTC, Stefan Metzmacher
metze: review? (gary)
gary: review+
Details
Patch for v4-23-test (1.87 KB, text/plain)
2026-07-28 16:39 UTC, Stefan Metzmacher
metze: review? (gary)
gary: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Metzmacher 2026-05-28 15:33:17 UTC
A client provided value can be passed into a filter
without going through ldb_binary_encode_string()

But the value is only appended via a to "name=%s",
so there's no leading "(", which means 
in lib/ldb/common/ldb_parse.c:356: the value-parsing loop terminates
at the first unescaped ')', so a payload like "users)(hidden=*" collapses to
"(name=users)" with the trailing bytes silently discarded. An escaped "\)" makes
ldb_parse_tree() return NULL rather than admit injection. Combined with
LDB_SCOPE_ONELEVEL, the attribute list restricted to ["name"], and the fact that
a DRSUAPI-authenticated client can already issue arbitrary LDAP searches via
dcesrv_samdb_connect_as_user(), there is no escalation surface.

This was reported by Arjun Basnet with Securin Labs.
Comment 1 Stefan Metzmacher 2026-06-27 09:06:42 UTC
*** Bug 16113 has been marked as a duplicate of this bug. ***
Comment 2 Samba QA Contact 2026-07-02 09:34:19 UTC
This bug was referenced in samba master:

a7a5de8d951969d60a7f0c40798fc97f6ee873fa
Comment 3 Stefan Metzmacher 2026-07-28 16:39:17 UTC
Created attachment 19138 [details]
Patch for v4-24-test
Comment 4 Stefan Metzmacher 2026-07-28 16:39:38 UTC
Created attachment 19139 [details]
Patch for v4-23-test
Comment 5 Samba QA Contact 2026-07-29 12:13:11 UTC
This bug was referenced in samba v4-24-test:

6d174ef3c6ec737f0883b073d6c8a47cf6e31c1e
Comment 6 Samba QA Contact 2026-07-30 23:12:03 UTC
This bug was referenced in samba v4-23-test:

f06a8849afc05340fbfc031167bab66a8025f377
Comment 7 Samba QA Contact 2026-08-03 19:37:17 UTC
This bug was referenced in samba v4-23-stable (Release samba-4.23.11):

f06a8849afc05340fbfc031167bab66a8025f377
Comment 8 Samba QA Contact 2026-08-13 14:31:20 UTC
This bug was referenced in samba v4-24-stable (Release samba-4.24.6):

6d174ef3c6ec737f0883b073d6c8a47cf6e31c1e