Fix alternate chains certificate forgery issue
authorMatt Caswell <matt@openssl.org>
Wed, 24 Jun 2015 14:55:36 +0000 (15:55 +0100)
committerMatt Caswell <matt@openssl.org>
Tue, 7 Jul 2015 20:48:55 +0000 (21:48 +0100)
commit21376d8ae310cf0455ca2b73c8e9f77cafeb28dd
tree6e05fa1d5323071baed5c6c68e3f349d177d3d4d
parentc0b674b7cbd9146982850523293c74b9131b26d5
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.

CVE-2015-1793

Reviewed-by: Stephen Henson <steve@openssl.org>
crypto/x509/x509_vfy.c