diff --git a/ChangeLog b/ChangeLog index e847b65bc..90c6e6bcf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,10 @@ Bugfix * Fix a potential integer overflow in the version verification for DER encoded X509 certificates. The overflow would enable maliciously constructed certificates to bypass the certificate verification check. + * Fix potential integer overflow in the version verification for DER + encoded X509 CSRs. The overflow would enable maliciously constructed CSRs + to bypass the version verification check. Found by Peng Li/Yueh-Hsun Lin, + KNOX Security, Samsung Research America = mbed TLS 1.3.20 branch released 2017-06-21 diff --git a/library/x509_csr.c b/library/x509_csr.c index 9bdfe884f..b3c8f29b7 100644 --- a/library/x509_csr.c +++ b/library/x509_csr.c @@ -169,14 +169,14 @@ int x509_csr_parse_der( x509_csr *csr, return( ret ); } - csr->version++; - - if( csr->version != 1 ) + if( csr->version != 0 ) { x509_csr_free( csr ); return( POLARSSL_ERR_X509_UNKNOWN_VERSION ); } + csr->version++; + /* * subject Name */