-
Notifications
You must be signed in to change notification settings - Fork 293
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
TdsParser.ProcessSSPI in NetCore uses ArrayPool.Shared.Rent which might return an non zero-initialized array #2441
Comments
The problem is in Lines 392 to 414 in faf9b95
|
If we need to respect the actual size of the negTokenResp, which is available in Maybe a |
PR #2447 is under review to solve this issue. |
Describe the bug
TdsParser for NetCore uses ArrayPool.Shared.Rent(...) which might return an non-zero-initialized array.
SqlClient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs
Lines 8654 to 8683 in faf9b95
The first bytes of that array are then replaced with the negTokenResp.
But as the array has some bytes set from the beginning, there might be some additional data after the actual negTokenResp, which causes the MIT-krb5 implementation to fail with a DEFECTIVE-TOKEN here.
To reproduce
I'm using an application with multiple connection-strings which - for testing purposes - queries the database very often, afterwards it invokes
SqlConnection.ClearAllPools();
. And this is done in an endless loop -> This causes the client to establish new security-contexts heavily which causes the error to appear.Expected behavior
Only the negTokenResp bytes are sent to the underlying GSSAPI implementation
Further technical details
Microsoft.Data.SqlClient version: (found on the nuget or Microsoft.Data.SqlClient.dll)
.NET target: (e.g. .NET6)
SQL Server version: Microsoft SQL Server 2019
Operating system: aspnet:7.0-bookworm-slim
Additional context
I event tried the latest debian distro, but there the latest krb5 version is 1.20 which still does that check. In 1.21 they kind of revamped that check, but it's not available for debian as it stands now.
The text was updated successfully, but these errors were encountered: