-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Segmentation violation when doing server-side Kerberos authentication on macOS #71463
Comments
Tagging subscribers to this area: @dotnet/ncl, @vcsjones Issue DetailsThe following repo crashes with segmentation violation in Steps:
using System.Net;
using System.Net.Security;
NegotiateAuthenticationClientOptions clientOptions = new NegotiateAuthenticationClientOptions {
Credential = new NetworkCredential("user", "P@ssw0rd!", "corp2.identityintervention.com"),
TargetName = "HTTP/corp2.identityintervention.com"
};
NegotiateAuthenticationServerOptions serverOptions = new NegotiateAuthenticationServerOptions { };
NegotiateAuthentication clientNegotiateAuthentication = new NegotiateAuthentication(clientOptions);
NegotiateAuthentication serverNegotiateAuthentication = new NegotiateAuthentication(serverOptions);
NegotiateAuthenticationStatusCode statusCode;
byte[]? serverBlob = null;
byte[]? clientBlob = null;
do
{
clientBlob = clientNegotiateAuthentication.GetOutgoingBlob(serverBlob, out statusCode);
Console.WriteLine("client status: " + statusCode);
Console.WriteLine("client blob: " + (clientBlob == null ? "null" : Convert.ToHexString(clientBlob)));
if (clientBlob != null)
{
Console.WriteLine("client -> server ");
serverBlob = serverNegotiateAuthentication.GetOutgoingBlob(clientBlob, out statusCode);
Console.WriteLine("client -> server 2");
Console.WriteLine("server status: " + statusCode);
Console.WriteLine("server blob: " + (serverBlob == null ? "null" : Convert.ToHexString(serverBlob)));
}
}
while (serverBlob != null);
The output is
|
I'm trying to make a standalone repro but I wanted to log the issue first. |
Standalone repro: https://github.com/filipnavara/KerberosLoopback, just |
Native stack:
CLR stack:
|
It seems to be double-free. |
does it happen always or only on failure? This seems like some discrepancy between MIT and Heimdal? |
Not sure if it failed. I assume it did based on the Apple source code but I would need to add traces to see. It crashes before the status code is returned to the application.
Quite possibly. The |
Nevermind, I dumped a wrong variable. |
The problem is here: runtime/src/libraries/Common/src/System/Net/Security/NegotiateStreamPal.Unix.cs Lines 407 to 410 in 1e8eaef
The handle doesn't get updated if the native code released it. Also, |
The following repo crashes with segmentation violation in
gss_delete_sec_context
.Steps:
krb5.conf
file with the following content:krb5.keytab
file with the following command:KRB5_CONFIG
environment variable to path tokrb5.conf
from step 2KRB5_KTNAME
environment variable to path tokrb5.keytab
from step 3dotnet new console
and replace the content of Program.cs withnet7.0
(preview6+ is required)dotnet run
The output is
The text was updated successfully, but these errors were encountered: