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

Fido2NetLib.Fido2VerificationException: SafetyNet response security token validation failed when attempting to register from android device. #291

Open
lycandroid opened this issue Apr 1, 2022 · 4 comments

Comments

@lycandroid
Copy link

Hi, can anyone give me any clues on this error please.

I get the error when trying to call fido2.MakeNewCredentialAsync. The error only happens when trying to register on an android device. It works ok when I use windows hello on a windows device.

Registration failed:System.AggregateException: One or more errors occurred. ---> Fido2NetLib.Fido2VerificationException: SafetyNet response security token validation failed ---> Microsoft.IdentityModel.Tokens.SecurityTokenInvalidSignatureException: IDX10503: Signature validation failed. Keys tried: 'Microsoft.IdentityModel.Tokens.RsaSecurityKey , KeyId:
Microsoft.IdentityModel.Tokens.RsaSecurityKey , KeyId:
Microsoft.IdentityModel.Tokens.RsaSecurityKey , KeyId:
'.
Exceptions caught:
'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Security.Cryptography.RSA.VerifyData(Byte[] data, Byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at Microsoft.IdentityModel.Tokens.AsymmetricAdapter.<>c__DisplayClass49_0.b__0(RSA rsaArg, Byte[] dataArg, Byte[] signatureArg, String algorithmArg)
at Microsoft.IdentityModel.Tokens.AsymmetricAdapter.Pkcs1VerifyData(Byte[] input, Byte[] signature)
at Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider.Verify(Byte[] input, Byte[] signature)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(Byte[] encodedBytes, Byte[] signature, SecurityKey key, String algorithm, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters)
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Security.Cryptography.RSA.VerifyData(Byte[] data, Byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at Microsoft.IdentityModel.Tokens.AsymmetricAdapter.<>c__DisplayClass49_0.b__0(RSA rsaArg, Byte[] dataArg, Byte[] signatureArg, String algorithmArg)
at Microsoft.IdentityModel.Tokens.AsymmetricAdapter.Pkcs1VerifyData(Byte[] input, Byte[] signature)
at Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider.Verify(Byte[] input, Byte[] signature)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(Byte[] encodedBytes, Byte[] signature, SecurityKey key, String algorithm, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters)
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Security.Cryptography.RSA.VerifyData(Byte[] data, Byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at Microsoft.IdentityModel.Tokens.AsymmetricAdapter.<>c__DisplayClass49_0.b__0(RSA rsaArg, Byte[] dataArg, Byte[] signatureArg, String algorithmArg)
at Microsoft.IdentityModel.Tokens.AsymmetricAdapter.Pkcs1VerifyData(Byte[] input, Byte[] signature)
at Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider.Verify(Byte[] input, Byte[] signature)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(Byte[] encodedBytes, Byte[] signature, SecurityKey key, String algorithm, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters)
'.
token: '{"alg":"RS256","x5c":["MIIFbjCCBFagAwIBAgIQAa3OKOdoTY4QAAAAAA3XXDANBgkqhkiG9w0BAQsFADBGMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzETMBEGA1UEAxMKR1RTIENBIDFENDAeFw0yMjAzMjAyMTE1MjFaFw0yMjA2MTgyMTE1MjBaMB0xGzAZBgNVBAMTEmF0dGVzdC5hbmRyb2lkLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALmqLBXV4CZA5sT5cTfuXcw11WD2YUW3eAJvdq+XIbHDgMNMBrsx/XDx6Lm9OmJCU4vCpWIN4WCH20T9Ofe6HdyNvEei3zhlzN0Z/YTyoTepWp5H/mrnGosSsmpJu45w9RXnnJlIkG59t3tWRhasYenFcHecFhlmhvnTBtGkMUoEFDFgjymgkpQGd2lhiOXXbp315IyFlGTTZo4DAa6b0zvTfP9uzGQIdxfksyMIFfbCaWzN3OjpumR00x6IVcd7r9Lo9PeUl9kozr8Eh4CY/OB+D9Q/V6xEZbTsGyw4iAqCKo14CEzCEQH0FVY45pX7ob+mhf/ZJmcs/MxnVFnLzl0CAwEAAaOCAn8wggJ7MA4GA1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBg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GWh0dHA6Ly9vY3NwLnBraS5nb29nL2dzcjEwKQYIKwYBBQUHMAKGHWh0dHA6Ly9wa2kuZ29vZy9nc3IxL2dzcjEuY3J0MDIGA1UdHwQrMCkwJ6AloCOGIWh0dHA6Ly9jcmwucGtpLmdvb2cvZ3NyMS9nc3IxLmNybDA7BgNVHSAENDAyMAgGBmeBDAECATAIBgZngQwBAgIwDQYLKwYBBAHWeQIFAwIwDQYLKwYBBAHWeQIFAwMwDQYJKoZIhvcNAQELBQADggEBADSkHrEoo9C0dhemMXoh6dFSPsjbdBZBiLg9NR3t5P+T4Vxfq7vqfM/b5A3Ri1fyJm9bvhdGaJQ3b2t6yMAYN/olUazsaL+yyEn9WprKASOshIArAoyZl+tJaox118fessmXn1hIVw41oeQa1v1vg4Fv74zPl6/AhSrw9U5pCZEt4Wi4wStz6dTZ/CLANx8LZh1J7QJVj2fhMtfTJr9w4z30Z209fOU0iOMy+qduBmpvvYuR7hZL6Dupszfnw0Skfths18dG9ZKb59UhvmaSGZRVbNQpsg3BZlvid0lIKO2d1xozclOzgjXPYovJJIultzkMu34qQb9Sz/yilrbCgj8="]}.{"nonce":"snogGpQE+rmtSohYVDd2wKu9kbsBdffpnzVRU5BbMQY=","timestampMs":1648818894632,"apkPackageName":"com.google.android.gms","apkDigestSha256":"C2tcgScaPXVO/APPF/YaRO7eiqeic27AgL7ug9dtVUw=","ctsProfileMatch":true,"apkCertificateDigestSha256":["8P1sW0EPJcslw7UzRsiXL64w+O50Ed+RBICtay1g24M="],"basicIntegrity":true,"evaluationType":"BASIC,HARDWARE_BACKED"}'.
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
at Fido2NetLib.AndroidSafetyNet.Verify()
--- End of inner exception stack trace ---
at Fido2NetLib.AndroidSafetyNet.Verify()
at Fido2NetLib.AuthenticatorAttestationResponse.d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Fido2NetLib.Fido2.d__6.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at SummitWeb.PkAuth.Register(String credential, CredentialCreateOptions options, String BESGroup, String& error)
---> (Inner Exception #0) Fido2NetLib.Fido2VerificationException: SafetyNet response security token validation failed ---> Microsoft.IdentityModel.Tokens.SecurityTokenInvalidSignatureException: IDX10503: Signature validation failed. Keys tried: 'Microsoft.IdentityModel.Tokens.RsaSecurityKey , KeyId:
Microsoft.IdentityModel.Tokens.RsaSecurityKey , KeyId:
Microsoft.IdentityModel.Tokens.RsaSecurityKey , KeyId:
'.
Exceptions caught:
'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Security.Cryptography.RSA.VerifyData(Byte[] data, Byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at Microsoft.IdentityModel.Tokens.AsymmetricAdapter.<>c__DisplayClass49_0.b__0(RSA rsaArg, Byte[] dataArg, Byte[] signatureArg, String algorithmArg)
at Microsoft.IdentityModel.Tokens.AsymmetricAdapter.Pkcs1VerifyData(Byte[] input, Byte[] signature)
at Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider.Verify(Byte[] input, Byte[] signature)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(Byte[] encodedBytes, Byte[] signature, SecurityKey key, String algorithm, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters)
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Security.Cryptography.RSA.VerifyData(Byte[] data, Byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at Microsoft.IdentityModel.Tokens.AsymmetricAdapter.<>c__DisplayClass49_0.b__0(RSA rsaArg, Byte[] dataArg, Byte[] signatureArg, String algorithmArg)
at Microsoft.IdentityModel.Tokens.AsymmetricAdapter.Pkcs1VerifyData(Byte[] input, Byte[] signature)
at Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider.Verify(Byte[] input, Byte[] signature)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(Byte[] encodedBytes, Byte[] signature, SecurityKey key, String algorithm, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters)
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Security.Cryptography.RSA.VerifyData(Byte[] data, Byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at Microsoft.IdentityModel.Tokens.AsymmetricAdapter.<>c__DisplayClass49_0.b__0(RSA rsaArg, Byte[] dataArg, Byte[] signatureArg, String algorithmArg)
at Microsoft.IdentityModel.Tokens.AsymmetricAdapter.Pkcs1VerifyData(Byte[] input, Byte[] signature)
at Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider.Verify(Byte[] input, Byte[] signature)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(Byte[] encodedBytes, Byte[] signature, SecurityKey key, String algorithm, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters)
'.
token: '{"alg":"RS256","x5c":["MIIFbjCCBFagAwIBAgIQAa3OKOdoTY4QAAAAAA3XXDANBgkqhkiG9w0BAQsFADBGMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzETMBEGA1UEAxMKR1RTIENBIDFENDAeFw0yMjAzMjAyMTE1MjFaFw0yMjA2MTgyMTE1MjBaMB0xGzAZBgNVBAMTEmF0dGVzdC5hbmRyb2lkLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALmqLBXV4CZA5sT5cTfuXcw11WD2YUW3eAJvdq+XIbHDgMNMBrsx/XDx6Lm9OmJCU4vCpWIN4WCH20T9Ofe6HdyNvEei3zhlzN0Z/YTyoTepWp5H/mrnGosSsmpJu45w9RXnnJlIkG59t3tWRhasYenFcHecFhlmhvnTBtGkMUoEFDFgjymgkpQGd2lhiOXXbp315IyFlGTTZo4DAa6b0zvTfP9uzGQIdxfksyMIFfbCaWzN3OjpumR00x6IVcd7r9Lo9PeUl9kozr8Eh4CY/OB+D9Q/V6xEZbTsGyw4iAqCKo14CEzCEQH0FVY45pX7ob+mhf/ZJmcs/MxnVFnLzl0CAwEAAaOCAn8wggJ7MA4GA1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMB0GA1Ud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EwKQYIKwYBBQUHMAKGHWh0dHA6Ly9wa2kuZ29vZy9nc3IxL2dzcjEuY3J0MDIGA1UdHwQrMCkwJ6AloCOGIWh0dHA6Ly9jcmwucGtpLmdvb2cvZ3NyMS9nc3IxLmNybDA7BgNVHSAENDAyMAgGBmeBDAECATAIBgZngQwBAgIwDQYLKwYBBAHWeQIFAwIwDQYLKwYBBAHWeQIFAwMwDQYJKoZIhvcNAQELBQADggEBADSkHrEoo9C0dhemMXoh6dFSPsjbdBZBiLg9NR3t5P+T4Vxfq7vqfM/b5A3Ri1fyJm9bvhdGaJQ3b2t6yMAYN/olUazsaL+yyEn9WprKASOshIArAoyZl+tJaox118fessmXn1hIVw41oeQa1v1vg4Fv74zPl6/AhSrw9U5pCZEt4Wi4wStz6dTZ/CLANx8LZh1J7QJVj2fhMtfTJr9w4z30Z209fOU0iOMy+qduBmpvvYuR7hZL6Dupszfnw0Skfths18dG9ZKb59UhvmaSGZRVbNQpsg3BZlvid0lIKO2d1xozclOzgjXPYovJJIultzkMu34qQb9Sz/yilrbCgj8="]}.{"nonce":"snogGpQE+rmtSohYVDd2wKu9kbsBdffpnzVRU5BbMQY=","timestampMs":1648818894632,"apkPackageName":"com.google.android.gms","apkDigestSha256":"C2tcgScaPXVO/APPF/YaRO7eiqeic27AgL7ug9dtVUw=","ctsProfileMatch":true,"apkCertificateDigestSha256":["8P1sW0EPJcslw7UzRsiXL64w+O50Ed+RBICtay1g24M="],"basicIntegrity":true,"evaluationType":"BASIC,HARDWARE_BACKED"}'.
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
at Fido2NetLib.AndroidSafetyNet.Verify()
--- End of inner exception stack trace ---
at Fido2NetLib.AndroidSafetyNet.Verify()
at Fido2NetLib.AuthenticatorAttestationResponse.d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Fido2NetLib.Fido2.d__6.MoveNext()<---

Many thanks.

@aseigler
Copy link
Collaborator

I tried to reproduce this, but I am unable to with the current build. Which version of the library are you using? I don't see anything immediately wrong with the data in the token supplied, not real sure what's happening here.

@lycandroid
Copy link
Author

Thanks for taking a look. I am using v2.0.2 via nuget. The only somewhat unusual thing is that this is for a classic asp.net website, i.e. not a web application, and is not using MVC. I couldn't see why that would matter, but worth stating anyway.

Possibly stating the obvious, but the error doesn't happen if I switch off attestation, i.e. using AttestationConveyancePreference.None on the RequestNewCredential call

fido2.RequestNewCredential(user, existingKeys, AuthenticatorSelection.Default, AttestationConveyancePreference.None);

We've decided that, in our case, we don't actually need attestation, so the problem has gone away as it happens.

@abergs
Copy link
Collaborator

abergs commented May 6, 2022

While only slightly related to this issue, we should probably improve documentation to instruct people to turn of attestation. Very few actually need it, and those who do probably already know to turn it on and verify.

@aseigler
Copy link
Collaborator

aseigler commented May 6, 2022

Yeah, we should probably make this configurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants