Skip to content

[Breaking change] Make managed NTLM authentication opt-in in .NET 12 #136174

Open

Description

@wfurt

Summary

For .NET 12, make the managed NTLM authentication implementation disabled by default and require applications that still need it for legacy compatibility to explicitly opt in with the existing System.Net.Security.UseManagedNtlm AppContext switch.

This is a behavioral breaking change, not a proposal to remove the implementation or add a new public API.

Related documentation work: #136154.

Motivation

NTLM is a legacy authentication protocol and should not be selected implicitly by the managed implementation. Applications should migrate to Kerberos or another modern authentication mechanism rather than acquire an NTLM dependency through automatic fallback.

This follows the Windows direction:

The distinction matters: removal of NTLMv1 does not mean that all NTLM versions have already been removed from Windows. The broader NTLM deprecation and default-disablement direction motivate changing the .NET managed implementation default as well.

Current behavior

The existing switch does not currently provide a consistent opt-in boundary:

  • LocalAppContextSwitches.UseManagedNtlm defaults to true on macOS, iOS, Mac Catalyst, OpenBSD, and Linux with a linux-bionic- runtime identifier. It defaults to false elsewhere on the Unix PAL path.
  • When enabled, the Unix PAL selects managed NTLM for an explicit NTLM package and managed SPNEGO for Negotiate, allowing NTLM fallback.
  • Android and tvOS select the managed-only PAL through project build conditions. That PAL currently creates managed NTLM/SPNEGO without checking the AppContext switch.

Proposed .NET 12 behavior

  • Default System.Net.Security.UseManagedNtlm to false on every platform that supports the managed implementation.
  • Require an explicit true value before using managed NTLM, both when Package = "NTLM" is requested and when NTLM would be selected through Negotiate/managed SPNEGO.
  • Apply the same gate to the managed-only Android/tvOS path; changing only the Unix switch default is insufficient.
  • Preserve native Kerberos authentication where available. Do not silently re-enable managed NTLM when Kerberos or native authentication is unavailable; surface the existing appropriate authentication failure/unsupported result.
  • Preserve explicit opt-in as a compatibility escape hatch for applications that cannot yet migrate.

This issue is specifically about the managed NTLM implementation. The switch is not a global NTLM prohibition: Windows SSPI and native GSSAPI providers can still support or select NTLM according to their own configuration and operating-system policy. Changing those native-provider policies is outside this issue.

Breaking-change impact and migration

Applications that currently depend on managed NTLM being enabled implicitly can fail authentication after upgrading to .NET 12. This includes callers of NegotiateAuthentication and higher-level consumers such as NegotiateStream and HttpClient when they reach the managed authentication implementation.

Preferred migration: use Kerberos or another modern authentication protocol. Where supported, explicitly requesting Kerberos prevents NTLM selection; Negotiate alone is not a guarantee that NTLM will never be used.

For temporary legacy compatibility, explicitly enable the existing switch before authentication is initialized:

AppContext.SetSwitch("System.Net.Security.UseManagedNtlm", true);

Or configure it in the application runtime configuration:

{
  "runtimeOptions": {
    "configProperties": {
      "System.Net.Security.UseManagedNtlm": true
    }
  }
}

Opting in does not restore NTLM support on a remote server or override Windows policies that disable it.

Acceptance criteria

  • With the switch unset or explicitly false, no supported platform uses managed NTLM, either directly or through managed SPNEGO fallback.
  • Explicit true preserves supported managed NTLM compatibility scenarios.
  • Tests cover unset/false/true, explicit NTLM and Negotiate fallback, and both Unix and managed-only platform paths.
  • Native Kerberos scenarios remain functional; the managed switch is not documented as blocking native NTLM.
  • Publish .NET 12 breaking-change documentation describing affected platforms, authentication failures, preferred migration, and the compatibility switch; update switch/authentication documentation accordingly.

Activity

  1. added this to the 12.0.0 milestone on Oct 20, 2026
  2. dotnet-policy-service commented on Oct 20, 2026

    @dotnet-policy-service
    Contributor

    Added needs-breaking-change-doc-created label because this issue has the breaking-change label.

    1. Create and link to this issue a matching issue in the dotnet/docs repo using the breaking change documentation template, then remove this needs-breaking-change-doc-created label.

    Tagging @dotnet/compat for awareness of the breaking change.

  3. MihuBot commented on Oct 20, 2026

    @MihuBot

    cc: @dotnet/ncl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Net.Securitybreaking-changeIssue or PR that represents a breaking API or functional change over a previous release.needs-breaking-change-doc-createdBreaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions