Skip to content
Browse files

Fix alternate chains certificate forgery issue

During certificate verfification, OpenSSL will attempt to find an
alternative certificate chain if the first attempt to build such a chain
fails. An error in the implementation of this logic can mean that an
attacker could cause certain checks on untrusted certificates to be
bypassed, such as the CA flag, enabling them to use a valid leaf
certificate to act as a CA and "issue" an invalid certificate.

This occurs where at least one cert is added to the first chain from the
trust store, but that chain still ends up being untrusted. In that case
ctx->last_untrusted is decremented in error.

Patch provided by the BoringSSL project.


Reviewed-by: Stephen Henson <>
  • Loading branch information...
mattcaswell committed Jun 24, 2015
1 parent 9cf315e commit 2aacec8f4a5ba1b365620a7b17fcce311ada93ad
Showing with 1 addition and 1 deletion.
  1. +1 −1 crypto/x509/x509_vfy.c
@@ -392,8 +392,8 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
xtmp = sk_X509_pop(ctx->chain);
ctx->last_untrusted = sk_X509_num(ctx->chain);
retry = 1;

0 comments on commit 2aacec8

Please sign in to comment.
You can’t perform that action at this time.