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.
*** Bug 16113 has been marked as a duplicate of this bug. ***
This bug was referenced in samba master: a7a5de8d951969d60a7f0c40798fc97f6ee873fa
Created attachment 19138 [details] Patch for v4-24-test
Created attachment 19139 [details] Patch for v4-23-test
This bug was referenced in samba v4-24-test: 6d174ef3c6ec737f0883b073d6c8a47cf6e31c1e
This bug was referenced in samba v4-23-test: f06a8849afc05340fbfc031167bab66a8025f377
This bug was referenced in samba v4-23-stable (Release samba-4.23.11): f06a8849afc05340fbfc031167bab66a8025f377
This bug was referenced in samba v4-24-stable (Release samba-4.24.6): 6d174ef3c6ec737f0883b073d6c8a47cf6e31c1e