Bug 15876 - Windows security hardening locks out schannel'ed netlogon dc calls like netr_DsRGetDCName
Summary: Windows security hardening locks out schannel'ed netlogon dc calls like netr_...
Status: ASSIGNED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: DCE-RPCs and pipes (show other bugs)
Version: 4.22.2
Hardware: All All
: P5 critical (vote)
Target Milestone: ---
Assignee: Andreas Schneider
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-03 14:09 UTC by Guenther Deschner
Modified: 2025-07-10 05:06 UTC (History)
7 users (show)

See Also:


Attachments
Patch for 4.21 cherry-picked from master (14.59 KB, patch)
2025-07-07 12:57 UTC, Ralph Böhme
asn: review+
gd: review+
Details
Patch for 4.22 cherry-picked from master (14.59 KB, patch)
2025-07-07 12:59 UTC, Ralph Böhme
asn: review+
gd: review+
Details
Patch for v4-20, including extra commit from comment #13 (15.77 KB, patch)
2025-07-10 04:33 UTC, Martin Schwenke
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guenther Deschner 2025-07-03 14:09:20 UTC
Upcoming changes to Windows Server 2025 enforce security checks even on schannel secured NETLOGON connections causing winbind's netlogon dc discovery calls to fail.
Comment 1 Samba QA Contact 2025-07-07 10:45:03 UTC
This bug was referenced in samba master:

f86a4bf6848ade2db7229d182576db3320c3ece7
2560c9b3224816ffd371a62103f65b3aca301ad5
Comment 2 Guenther Deschner 2025-07-07 12:10:33 UTC
For completeness, here is the full list of affected Netlogon RPC calls:

DsrGetDcName
DsrGetDcNameEx
DsrGetSiteName
DsrAddressToSiteNamesW
DsrGetDcNameEx2
DsrAddressToSiteNamesExW
DsrGetDcSiteCoverageW
Comment 3 Ralph Böhme 2025-07-07 12:27:18 UTC
We've released the following info via the Samba mailing lists:

https://lists.samba.org/archive/samba-announce/2025/000693.html

On 8th of July, Microsoft will release an important security update for 
Active Directory Domain Controllers for Windows Server versions prior to 
2025.

This update includes a change to the Microsoft RPC Netlogon protocol, 
which improves security by tightening access checks for a set of RPC 
requests. Samba running as domain members in these environments will be 
impacted by this change if a specific configuration is used, see below 
for which configuration is affected.

Windows Server version 2025 is already equipped with these specific 
security hardenings, and Microsoft is now planning to deploy them to all 
supported Windows Server versions down to Windows Server 2008.


Who is affected?

Samba installations acting as member servers in Windows AD domains will 
be affected if they are configured to use the 'ad' idmapping backend. 
Samba servers not using this configuration will not be affected by the 
change – at least to our current knowledge and understanding of the 
change – and no further action is required.

Current versions of Samba with the affected configuration will no longer 
function correctly once the Microsoft update has been applied. Users 
will not be able to connect to the SMB service provided by Samba for any 
domain configured to use the 'ad' idmapping backend.


What the Samba Team is doing and what you should do

Members of the Samba team have been collaborating with Microsoft and 
changes to Samba are currently being developed and tested to ensure full 
compatibility between Samba and Microsoft products. The Samba team is 
aiming to provide updated Samba releases on Monday evening (UTC+2).


What you should do:

If you’re running Samba in a Windows AD environment, check your 
configuration. Keep an eye out for new Samba package updates early next 
week (starting 7 July).
Comment 4 Ralph Böhme 2025-07-07 12:57:29 UTC
Created attachment 18660 [details]
Patch for 4.21 cherry-picked from master
Comment 5 Ralph Böhme 2025-07-07 12:59:05 UTC
Created attachment 18661 [details]
Patch for 4.22 cherry-picked from master
Comment 6 Guenther Deschner 2025-07-07 13:40:28 UTC
Comment on attachment 18661 [details]
Patch for 4.22 cherry-picked from master

LGTM, RB+
Comment 7 Guenther Deschner 2025-07-07 13:41:10 UTC
Comment on attachment 18660 [details]
Patch for 4.21 cherry-picked from master

LGTM, RB+
Comment 8 Samba QA Contact 2025-07-07 15:43:02 UTC
This bug was referenced in samba v4-21-test:

fc13e0918fddac18800790926a71a9e60f8b95df
1967ce819985be2e223c258284d5153713549108
Comment 9 Samba QA Contact 2025-07-07 15:44:02 UTC
This bug was referenced in samba v4-22-test:

b197ce8c6f155e7d7dd3bd7a9b77172553eb78f7
78d69a9eebe080aa2bcdf62be8360b581dd1e5f0
Comment 10 Samba QA Contact 2025-07-07 16:13:52 UTC
This bug was referenced in samba v4-21-stable (Release samba-4.21.7):

fc13e0918fddac18800790926a71a9e60f8b95df
1967ce819985be2e223c258284d5153713549108
Comment 11 Samba QA Contact 2025-07-07 16:21:37 UTC
This bug was referenced in samba v4-22-stable (Release samba-4.22.3):

b197ce8c6f155e7d7dd3bd7a9b77172553eb78f7
78d69a9eebe080aa2bcdf62be8360b581dd1e5f0
Comment 12 Martin Schwenke 2025-07-08 00:16:32 UTC
Is it OK for me to attach an unofficial patch for v4-20-stable here, to potentially help others?

The only difference is a conflict in removed code due to commit 814ae222ca15ff7093a71639cdcc97b9937670ce not being in v4-20-stable.
Comment 13 Andreas Schneider 2025-07-08 08:07:07 UTC
Yes, I think that is fine.

We also backported the following patches to older releases in addition:

e47ce1d 2024-12-05 16:46 +0000 Stefan Metzmacher  o s3:libsmb: let discover_dc_netbios() return DOMAIN_CONTROLLER_NOT_FOUND
712ffbf 2024-05-10 01:35 +0000 Stefan Metzmacher  o s3:libsmb: allow store_cldap_reply() to work with a ipv6 response
2b66663 2024-04-05 12:24 +0000 Stefan Metzmacher  o s3:libsmb/dsgetdcname: use NETLOGON_NT_VERSION_AVOID_NT4EMUL
f55a357 2023-03-09 19:12 +0000 Nathaniel W. Turn~ o dsgetdcname: do not assume local system uses IPv4
Comment 14 Salvatore Bonaccorso 2025-07-08 12:23:10 UTC
Hi Andreas,

(In reply to Andreas Schneider from comment #13)

How far did you go back with backporting fixes if I might ask?

For Debian I have applied all of

e47ce1d 2024-12-05 16:46 +0000 Stefan Metzmacher  o s3:libsmb: let discover_dc_netbios() return DOMAIN_CONTROLLER_NOT_FOUND
712ffbf 2024-05-10 01:35 +0000 Stefan Metzmacher  o s3:libsmb: allow store_cldap_reply() to work with a ipv6 response
2b66663 2024-04-05 12:24 +0000 Stefan Metzmacher  o s3:libsmb/dsgetdcname: use NETLOGON_NT_VERSION_AVOID_NT4EMUL

(modulo the first one, which is already present) in Debian bookworm's version
based on 4.17.12. The proposed work is here:
https://salsa.debian.org/samba-team/samba/-/merge_requests/68

I was looking as well at 4.13.13 based version, but know this is completely
out of scope for Samba team.
Comment 15 Andreas Schneider 2025-07-08 13:49:18 UTC
We backported down to 4.15, see https://gitlab.com/samba-redhat/samba

Samba < 4.15 doesn't have async dns lookups!
Comment 16 Martin Schwenke 2025-07-10 04:33:29 UTC
Created attachment 18670 [details]
Patch for v4-20, including extra commit from comment #13

This patch is for information only, just in case someone out there wants to patch 4.20.8.  Because this is unofficial, I'll explain the patch in some detail.

This includes the 1st of 4 additional commits mentioned by Andreas in comment #13 - the other 3 are already in 4.20.8.

Following this, the 1st commit of the bug fix is marked "backported" (rather than "cherry picked") because a conflict had to be resolved.  This occurred because commit 
814ae222ca15ff7093a71639cdcc97b9937670ce is not in 4.20.8, so some code in removed function get_dc_name_via_netlogon() was not matched by the bug fix patch.  The resolution is clearly to remove the function.

The 2nd commit of the bug fix cherry-picks cleanly.
Comment 17 Douglas Bagnall 2025-07-10 05:06:48 UTC
(In reply to Andreas Schneider from comment #15)
> Samba < 4.15 doesn't have async dns lookups!

4.14 does, but 4.13, no.