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

Do CA checks to verify authentication by default #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brozs
Copy link

@brozs brozs commented Feb 15, 2025

This is a follow-up to b665b28.

An attacker that is able to login into a token could bypass authentication by using its own certificate with any valid signature.

This change makes the default "ca, signature" with the only way to disable CA check by using "no_ca".

This, however, also makes the "none" option disabling CRL and OCSP checks only.

Resolves #80

This is a follow-up to b665b28.

An attacker that is able to login into a token could bypass
authentication by using its own certificate with any valid signature.

This change makes the default "ca, signature" with the only way to
disable CA check by using "no_ca".

This, however, also makes the "none" option disabling CRL and OCSP
checks only.
@@ -467,7 +467,7 @@ int verify_certificate(X509 * x509, cert_policy *policy)
X509_STORE_CTX *ctx = NULL;

/* if neither ca nor crl check are requested skip */
if ( (policy->ca_policy==0) && (policy->crl_policy==CRLP_NONE) ) {
if ( (!policy->no_ca_policy==0) && (policy->crl_policy==CRLP_NONE) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be more readable to write this as

Suggested change
if ( (!policy->no_ca_policy==0) && (policy->crl_policy==CRLP_NONE) ) {
if ( (policy->no_ca_policy==1) && (policy->crl_policy==CRLP_NONE) ) {

@@ -408,7 +408,7 @@ static X509_STORE * setup_store(cert_policy *policy) {
}
}
/* add needed hash dir pathname entries */
if ( (policy->ca_policy) && (is_dir(policy->ca_dir)>0) ) {
if ( (!policy->no_ca_policy) && (is_dir(policy->ca_dir)>0) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be better readable as

Suggested change
if ( (!policy->no_ca_policy) && (is_dir(policy->ca_dir)>0) ) {
if ( (policy->no_ca_policy==0) && (is_dir(policy->ca_dir)>0) ) {

(similarly the following change)

# CRLs
# "signature" Does a signature check to ensure that private
# and public key matches
# "no_signature" The only value that disables signature check
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated also in the documentation. I initially missed that, but I think the xml source is here:

https://github.com/OpenSC/pam_pkcs11/blob/master/doc/pam_pkcs11.xml#L616

If I see right, the no_signature part is not documented here either.

Having example files as the only documentation is not very good practice.

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.

Checking signature without checking CA is as bad as not checking the signature
2 participants