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

check if client certificate verification succeed #154

Merged

Conversation

yomgui1
Copy link
Contributor

@yomgui1 yomgui1 commented Jan 13, 2020

gnutls_certificate_verify_peers2() returns GNUTLS_E_SUCCESS (0) even in case of certificate verification errors.
The client_cert_status parameters must be checked as noticed in gnutls documentation (see [1]).
This patch adds this check and goes in error branch.
Without this check you can accept a non-trusted certificate and MITM attacks can be done.

[1] https://gnutls.org/manual/gnutls.html#gnutls_005fcertificate_005fverify_005fpeers2

gnutls_certificate_verify_peers2() returns GNUTLS_E_SUCCESS (0) even in case of certificate verification errors.
The client_cert_status parameters must be checked as noticed in gnutls documentation (see [1]).
This patch adds this check and goes in error branch.
Without this check you can accept a non-trusted certificate and MITM attacks can be done.

[1] https://gnutls.org/manual/gnutls.html#gnutls_005fcertificate_005fverify_005fpeers2
@yomgui1
Copy link
Contributor Author

yomgui1 commented Jan 13, 2020

I've found that the framework.c test is also broken as the provided server certificate is self-signed, and not signed by the provided CA certificate as it should be.
This is the reason of test failure of my patch.

@babelouest
Copy link
Owner

Thanks, although the tests full with this fix. I need verify that before merging, but thanks a lot for pointing out the bug!

@yomgui1
Copy link
Contributor Author

yomgui1 commented Jan 13, 2020

@babelouest I suggest you keep the current self-signed certificate as a "wrong" certificate to add a new test for the case of non-trusted client certificate.

@babelouest
Copy link
Owner

I will improve the ca tests in framework.c to test additional cases using on-the-fly generated certificates

babelouest added a commit that referenced this pull request Jan 13, 2020
The certificate tests were broken and I didn't know it until #154, add more test cases to avoid that in the future, also generate key files and cert files on demand to make sure the tests will succeed in the far future
@babelouest babelouest merged commit 341d46e into babelouest:master Jan 13, 2020
@babelouest
Copy link
Owner

Tests fixed and PR merged.

Merci beaucoup @yomgui1 !

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

Successfully merging this pull request may close these issues.

None yet

2 participants