CVE-2026-125628: Samba: samba4: extended response type confusion in ldapsrv_do_call crashes the ad dc ldap worker
A type confusion has been found in the ldapsrvdocall() function in ldapbackend.c of the LDAP server in the Samba package. The function reads an extended response as an extended request while checking a connection that has not authenticated. A network attacker or user sends an extended response as the first LDAP message. The process that accepted the connection also serves other LDAP clients. That process exits, which disconnects those clients, and the directory starts a replacement process. Sending the message again crashes the replacement, and each further crash waits longer before the next replacement starts, so repeating the message keeps the LDAP service from staying available.
Other sources
ldapsrvdocall() in source4/ldapserver/ldapbackend.c uses the wrong message tag in the check that decides whether to log a connection that has not bound. When authzlogged is false, the arm labeled LDAPTAGExtendedResponse reads call->request->r.ExtendedRequest and calls strcmp() on oid.
ldapdecode() in libcli/ldap/ldapmessage.c stores an extended response in r.ExtendedResponse. ldapdecoderesponse() writes the result code into the ldapResult at the start of that arm. The oid field of ldapExtendedRequest occupies those same leading bytes. ldapsrvcallreaddone() decodes the packet and queues the call. ldapsrvprocesscalltrigger() calls ldapsrvdocall() with no bind check. The connection is allocated with talloczero(), so authzlogged is false for the first message. A later switch in ldapsrvdocall() calls ldapsrvExtendedRequest() for LDAPTAGExtendedRequest and calls ldapsrvunwilling() for a tag it does not list. The logging check runs before that switch. The wrong tag is present in samba 4.7.0rc1, in samba 4.25.1, and on the current master branch.
strcmp() dereferences the value in those leading bytes. Those bytes hold the result code and the alignment padding after it. They are not an OID string. The dereference faults the ldap worker. faultsetup() installs sigfault() for SIGSEGV, sigfault() calls faultreport(), and faultreport() calls smbpanic(), which aborts the worker. In the default prefork model the ldap service has its own master and workers, and each worker serves more than one client connection. Those connections end when the process exits. The prefork master starts a replacement worker. The first restart delay is 0. Each later exit of that worker adds the prefork backoff increment to the delay, up to the prefork maximum backoff. Those defaults are 10 seconds and 120 seconds. The default number of prefork children is 4. A caller who repeats the extended response can exit the ldap workers and leave them stopped for that delay. The rpc and kdc services are separate prefork services.
The caller is not authenticated. The logging check runs while authzlogged is false, which is the state of a new connection. The message is an LDAP extended response, and it is the first message on the connection.
The flaw is reachable in the default configuration of an AD DC. The serviceldap module is built when the AD DC build is enabled. ldapsrvtaskinit() starts the LDAP server only when the server role is an Active Directory domain controller, and that server listens on port 389. The default server services list includes ldap, and the samba process model defaults to prefork.
Introduced in samba 4.7.0rc1 by commit f4a4522d1f8c19fdf142e12760160b15de1557ec (Andrew Bartlett, 3 March 2017), when logging of LDAP access before a bind was added. The wrong tag has been in that logging check since that commit. It is present in samba 4.7.0rc1, in samba 4.7.0, in samba 4.25.1, and on the current master branch. samba 4.6.16 does not contain the commit.
— Red Hat
Affected Software
Event History
Frequently Asked Questions
Which deployments are exposed to this denial-of-service?
Samba deployments running the LDAP server are exposed where an attacker can send LDAP messages to it. The affected process also serves other LDAP clients, so each crash disconnects those clients.
Does exploitation require authentication or user interaction?
No. The issue is triggered when an extended response is sent as the first LDAP message on a connection that has not authenticated, and the CVSS vector indicates no privileges or user interaction are required.
How can an attacker sustain the outage?
The attacker can repeatedly send the malformed first LDAP message after the directory starts a replacement worker. Repeated crashes increase the delay before replacement workers start, preventing the LDAP service from remaining available.