vlv_value_compare() in source4/dsdb/samdb/ldb_modules/vlv_pagination.c uses the sort attribute's element without checking that it exists (master, lines 254-256): el = ldb_msg_find_element(result->msgs[0], target->attr); return target->comparison_fn(target->ldb, ac, &target->value, &el->values[0]); server_sort keeps entries that lack the sort attribute and places them at the end, so a by-value VLV search whose results include such an entry reaches this line with el == NULL. The same happens when aclread removes a sort attribute the caller cannot read. Reproduced on Samba 4.25.1 (Debian 4.25.1+dfsg-1, arm64, default prefork): an ordinary authenticated domain user searched CN=Users,DC=lab,DC=test, one level, filter (|(cn=canarya)(cn=canaryb)), attribute dn, with critical Server Side Sort on description (absent on both entries) and critical VLV by value "foo". The client got SERVER_DOWN; the LDAP worker logged Signal 11 and was restarted. A second client whose established connection was on the same worker was reset (errno 104). The same request by offset, and by value on a populated attribute, returned normally. Control values as sent: Server Side Sort (1.2.840.113556.1.4.473): 300f300d040b6465736372697074696f6e VLV (2.16.840.1.113730.3.4.9), by value "foo": 300b0201000201008103666f6f The unchecked access dates from the original VLV commit 79c58c2543790134ef8deb5307ec4b4ae069ea61 (first released in 4.5.0) and is unchanged in master (last change to the file: 48a0e7730f, which fixed a different NULL dereference in vlv_results()). I will follow up with a GitLab merge request containing a fix and a test in source4/dsdb/tests/python/vlv.py, and add it under See Also.
I'll get a CVE issued for this when we next get a batch, this is a public security bug as it is a DoS that we will eventually recover from.