Skip to content

Document NTLM legacy authentication guidance - #136154

Merged
rzikm merged 1 commit into
dotnet:mainfrom
svick:document-ntlm-legacy-auth
Nov 4, 2026
Merged

rzikm merged 1 commit into
dotnet:mainfrom
svick:document-ntlm-legacy-auth

Conversation

@svick

@svick svick commented Oct 20, 2026 •

Copy link
Copy Markdown
Member
  • Document that NTLM is a legacy authentication protocol intended only for compatibility with existing systems.
  • Clarify that Negotiate prefers Kerberos but can fall back to NTLM, and describe how applications can prevent NTLM selection.

Note

This pull request description was generated with GitHub Copilot.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

@svick
svick marked this pull request as ready for review October 20, 2026 14:20
@svick
svick requested a balanced review from Copilot October 20, 2026 14:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The server guidance incorrectly implies that selecting Kerberos alone prevents NTLM on Unix with default credentials.

1 open issue
What changed in this PR

Adds XML documentation to System.Net.Security describing NTLM’s legacy role without changing runtime behavior.

Changes:

  • Recommends NTLM only for compatibility with existing systems.
  • Explains Negotiate fallback and provides guidance for avoiding NTLM.

Builds and tests were not run; verification used source inspection.

File Description
src/​libraries/​System.Net.Security/​src/​System/​Net/​Security/​NegotiateAuthenticationServerOptions.cs Adds server authentication package guidance.
src/​libraries/​System.Net.Security/​src/​System/​Net/​Security/​NegotiateAuthenticationClientOptions.cs Adds client authentication package guidance.
src/​libraries/​System.Net.Security/​src/​System/​Net/​Security/​NegotiateAuthentication.cs Documents NTLM’s legacy status and alternatives.

Review effort: Balanced

@rzikm

rzikm commented Oct 20, 2026

Copy link
Copy Markdown
Member

This will not update the existing documentation online AFAIK, this will need porting to dotnet/dotnet-api-docs repo.

@rzikm
rzikm merged commit e82ef50 into dotnet:main Nov 4, 2026
89 of 91 checks passed
svick added a commit to dotnet/dotnet-api-docs that referenced this pull request Nov 4, 2026
Port dotnet/runtime#136154 to the API reference remarks.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: b3d325b9-b147-4c19-9b64-c556550f9c70
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 6, 2026
rzikm added a commit that referenced this pull request Nov 9, 2026
<!-- -->

## Summary

Unix `NegotiateAuthentication` servers using default credentials
currently acquire GSSAPI acceptor credentials for all mechanisms,
regardless of `NegotiateAuthenticationServerOptions.Package`.
Consequently, a server requesting `Kerberos` can accept NTLM, and a
server requesting `NTLM` can accept Kerberos. Windows already restricts
the server to the explicitly selected package.

- Pass the requested package through acceptor credential acquisition and
restrict GSSAPI credentials to the Kerberos or NTLM mechanism as
appropriate.
- Reject completed server contexts whose protocol does not match an
explicitly requested package, including credential paths that may
acquire broader credentials.
- Preserve the default `Negotiate` behavior, including NTLM fallback,
and document the explicit-package restriction.
- Add wrong-package rejection coverage, case-insensitive package checks,
and successful same-package/Negotiate controls. Use a server-specific
NTLM capability check so these initial-token tests run with OpenSSL 3
without enabling tests that require broken NTLM response generation.

Related discussion:
#136154 (comment)

## Compatibility

This intentionally changes Unix server behavior to match Windows:
applications that previously relied on an explicit package accepting
another mechanism must use `Negotiate` instead. Explicit mechanism
credentials also reject SPNEGO-wrapped tokens; clients should select the
server's explicit package, or the server should use `Negotiate`. Client
package selection is unchanged.

## Validation

Linux validation used an isolated WSL Ubuntu 25.10 checkout with the
same source changes. Windows validation used a short `subst` path to
avoid path-length failures.

- Windows: `R:\build.cmd clr+libs -rc release` — passed.
- Windows: `.\.dotnet\dotnet.exe build
src\libraries\System.Net.Security\tests\UnitTests\System.Net.Security.Unit.Tests.csproj
/t:Test /p:RuntimeConfiguration=Release
/p:XunitClassName=System.Net.Security.Tests.NegotiateAuthenticationTests`
— 28 total, 0 failed, 4 skipped.
- Linux: `./build.sh clr+libs -rc release` and `./build.sh libs -rc
release` — passed.
- Linux: `dotnet build
src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj
/t:Test /p:RuntimeConfiguration=Release
/p:XunitClassName=System.Net.Security.Tests.NegotiateAuthenticationKerberosTest`
— before the fix, all four wrong-package cases failed because NTLM
returned `ContinueNeeded` or Kerberos returned `Completed`; after the
fix, all 15 cases passed without skips.
- Linux: `dotnet build
src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj
/t:Test /p:RuntimeConfiguration=Release` — 5,143 total, 0 failed, 8
skipped.
- Linux: `dotnet build
src/libraries/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj
/t:Test /p:RuntimeConfiguration=Release` — 138 total, 1 failed, 12
skipped. The existing `Package_Unsupported_NTLM` test expects
`Unsupported` but receives `ContinueNeeded` because its availability
predicate excludes OpenSSL 3 and does not enable managed NTLM on Ubuntu
25.10. Reverting the product fix and rebuilding reproduced the identical
failure and counts.
- `git diff --check` — passed.

macOS was not exercised. The Kerberos functional class is unsupported on
Windows; it was not counted as Windows execution coverage.

> [!NOTE]
> This pull request and its description were created with GitHub
Copilot.

---------

Co-authored-by: Copilot App <[email protected]>
svick pushed a commit that referenced this pull request Nov 11, 2026
…kages (#137246)

Fixes Issue <!-- Issue Number --> N/A; reported in
#136154 (comment).

main PR <!-- Link to PR if any that fixed this in the main branch. -->
#136958

# Customer Impact

<!-- What is the impact to customers of not taking this fix? -->

A Unix server explicitly configured for Kerberos can accept NTLM, and a
server configured for NTLM can accept Kerberos. Applications cannot rely
on the selected server package to enforce their intended authentication
protocol.

# Regression

<!-- Is this fixing a problem that was introduced in the most recent
release, ie., fixing a regression? -->

No known recent regression; this corrects a longstanding Unix/Windows
behavioral inconsistency.

# Testing

Added tests that check this in CI.

# Risk

Small, this makes the behavior consistent across platforms, so we may
break folks who rely on the inconsistent behavior, but that is exactly
what we want to fix.

> [!NOTE]
> This backport and its description were prepared with GitHub Copilot.

---------

Co-authored-by: Copilot App <[email protected]>
svick pushed a commit that referenced this pull request Nov 11, 2026
…kages (#137245)

Fixes Issue <!-- Issue Number --> N/A; reported in
#136154 (comment).

main PR <!-- Link to PR if any that fixed this in the main branch. -->
#136958

# Customer Impact

<!-- What is the impact to customers of not taking this fix? -->

A Unix server explicitly configured for Kerberos can accept NTLM, and a
server configured for NTLM can accept Kerberos. Applications cannot rely
on the selected server package to enforce their intended authentication
protocol.

# Regression

<!-- Is this fixing a problem that was introduced in the most recent
release, ie., fixing a regression? -->

No known recent regression; this corrects a longstanding Unix/Windows
behavioral inconsistency.

# Testing

Added tests that check this in CI.

# Risk

Small, this makes the behavior consistent across platforms, so we may
break folks who rely on the inconsistent behavior, but that is exactly
what we want to fix.

> [!NOTE]
> This backport and its description were prepared with GitHub Copilot.

---------

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants