Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SslStream: Don't include "NT AUTHORITY" in Distinguished Names list of CertificateRequest. #60949

Closed
avparuch opened this issue Oct 28, 2021 · 2 comments · Fixed by #60988
Closed

Comments

@avparuch
Copy link

avparuch commented Oct 28, 2021

During client certificate authentication, it is necessary to configure trusted certificate authorities (CA) list in certain scenarios. This trusted CA list is configured in the Distinguished Names of the Certificate Request message of the TLS handshake.

In NET 6.0, the ability to configure Distinguished Names list was added to SslStream via #45456. The trusted CA list is set using any machine store on the server as shown here.

However, for servers using SslStream, in addition to the CA list from the configured store, there is an additional "NT AUTHORITY" string in the Distinguished Names during the TLS handshake. This is unexpected and breaks clients, especially in scenarios where the intention is to send an empty Distinguished Names list in the TLS handshake.

Below trace shows the expected behavior when the intention is to send an empty CA list in the Distinguished Names. (This trace was collected on http.sys (not SslStream)

The below snippet shows frame 55 from the attached wireshark capture. There are zero entries in the Distinguished Names because the CA list was configured with an empty store.

emptyCTL_expected

Below snippet shows the EmptyCTL store on the server that was used to configure the CA list.

EmptyCTL

On SslStream, below trace shows the unexpected behavior when the Distinguished Names is configured with an empty list. As shown below, the Distinguished Names list is not empty, it contains the string "NT AUTHORITY"

EmptyCTL3

This breaks the scenario and client does not send any certificate in the Certificate message of the TLS handshake as shown below.

EmptyCTL5

The expectation is to be able to configure the CA lists from the contents of the stores only and not have any additional strings (such as "NT AUTHORITY") in the Distinguished Names during TLS handshake.

Wireshark logs: serverhello.zip

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Net.Security untriaged New issue has not been triaged by the area owner labels Oct 28, 2021
@ghost
Copy link

ghost commented Oct 28, 2021

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

Issue Details

During client certificate authentication, it is necessary to configure a certificate trust list in certain scenarios. This certificate trust list is configured in the Distinguished Names of the Certificate Request message of the TLS handshake.

In NET 6.0, the ability to configure Distinguished Names list was added to SslStream via #45456. The trust list is set using any machine store on the server as shown here.

However, for servers using SslStream, in addition to the trust list from the configured store, there is an additional "NT AUTHORITY" string in the Distinguished Names during the TLS handshake. This is unexpected and breaks clients, especially in scenarios where the intention is to send an empty Distinguished Names list in the TLS handshake.

Below trace shows the expected behavior when the intention is to send a empty list in the DistinguishedNames. (This trace was collected on http.sys (not SslStream)

The below snippet shows frame 55 from the attached wireshark capture. There are zero entries in the Distinguished Names because the trust list was configured with an empty store.

EmptyCTL2

Below snippet shows the EmptyCTL store on the server that was used to configure the trust list.
EmptyCTL

Below trace shows the unexpected behavior when the Distinguished Names is configured with an empty list on SslStream. As you can see, the Distinguished Names list is not empty, it contains the string "NT AUTHORITY"

EmptyCTL3

This breaks the scenario and client does not send any certificate in the Certificate message of the TLS handshake as shown below.

EmptyCTL5

The expectation is to be able to configure the trust lists from the contents of the stores only and not have any additional strings (such as "NT AUTHORITY") in the DistinguishedNames during TLS handshake.

Wireshark logs: serverhello.zip

Author: avparuch
Assignees: -
Labels:

area-System.Net.Security, untriaged

Milestone: -

@avparuch avparuch changed the title SslStream: Don't include "NT Authority" in Distinguished Names list of CertificateRequest. SslStream: Don't include "NT AUTHORITY" in Distinguished Names list of CertificateRequest. Oct 28, 2021
@wfurt wfurt added os-windows and removed untriaged New issue has not been triaged by the area owner labels Oct 28, 2021
@wfurt wfurt self-assigned this Oct 28, 2021
@wfurt wfurt added this to the 7.0.0 milestone Oct 28, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Oct 28, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Nov 2, 2021
@wfurt wfurt reopened this Nov 17, 2021
@wfurt wfurt modified the milestones: 7.0.0, 6.0.x Nov 17, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Nov 22, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Dec 15, 2021
@karelz
Copy link
Member

karelz commented Dec 16, 2021

Fixed in main (7.0) in PR #60988 and in 6.0.2 in PR #61713.

@karelz karelz closed this as completed Dec 16, 2021
@dotnet dotnet locked as resolved and limited conversation to collaborators Jan 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants