85cfc188c0
By using non-DER or invalid encodings outside the signed portion of a
certificate the fingerprint can be changed without breaking the signature.
Although no details of the signed portion of the certificate can be changed
this can cause problems with some applications: e.g. those using the
certificate fingerprint for blacklists.
1. Reject signatures with non zero unused bits.
If the BIT STRING containing the signature has non zero unused bits reject
the signature. All current signature algorithms require zero unused bits.
2. Check certificate algorithm consistency.
Check the AlgorithmIdentifier inside TBS matches the one in the
certificate signature. NB: this will result in signature failure
errors for some broken certificates.
3. Check DSA/ECDSA signatures use DER.
Reencode DSA/ECDSA signatures and compare with the original received
signature. Return an error if there is a mismatch.
This will reject various cases including garbage after signature
(thanks to Antti Karjalainen and Tuomo Untinen from the Codenomicon CROSS
program for discovering this case) and use of BER or invalid ASN.1 INTEGERs
(negative or with leading zeroes).
CVE-2014-8275
Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit
|
||
---|---|---|
.. | ||
.cvsignore | ||
dsa.h | ||
dsa_ameth.c | ||
dsa_asn1.c | ||
dsa_depr.c | ||
dsa_err.c | ||
dsa_gen.c | ||
dsa_key.c | ||
dsa_lib.c | ||
dsa_locl.h | ||
dsa_ossl.c | ||
dsa_pmeth.c | ||
dsa_prn.c | ||
dsa_sign.c | ||
dsa_vrf.c | ||
dsagen.c | ||
dsatest.c | ||
fips186a.txt | ||
Makefile | ||
README |
The stuff in here is based on patches supplied to me by Steven Schoch <schoch@sheba.arc.nasa.gov> to do DSS. I have since modified a them a little but a debt of gratitude is due for doing the initial work.