<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div>Hello,</div><div><br></div><div>I am using OpenSSL 1.0.1i 6 Aug 2014 version...</div><div><br></div><div><div>Following is my understanding of the issue:</div><div><br></div><div>This is an implementation specific issue and there is no general patch available. The vulnerability depends on how the padding bytes in TLS data are handled in CBC mode and is more specific to TLS v1.0. If the padding bytes in the TLS data received, are handled in the same way as SSLv3 i.e. they are ignored then this issue can arise. If the TLS data padding bytes are handled as per standard i.e. every byte in the padding data should be filled with the total padding length value, then this vulnerability does not occur. </div><div><br></div><div>I have tested this with a TLS v1.0 browser connecting to my server, and the code flow and debug statements show that during decryption of cipher, function tls1_cbc_remove_padding() in file libssl/ssl/s3_cbc.c is invoked which handles padding data. This function checks for validity of every pad byte value with the last pad byte which holds the total pad length and returns success or failure as per the validation. <br></div><div>In file libssl/ssl/s3_pkt.c, function ssl3_get_record is called to decrypt the cipher. Below is a code snippet of this function: </div><div>  </div><div>    /* decrypt in place in 'rr->input' */ </div><div>    rr->data=rr->input; </div><div>    enc_err = s->method->ssl3_enc->enc(s,0); // Calls TLS decrypt function i.e. invoke tls1_enc function in file t1_enc.c that calls tls1_cbc_remove_padding </div><div>    /* enc_err is: </div><div>     * 0: (in non-constant time) if the record is publically invalid. </div><div>     * 1: if the padding is valid </div><div>     * -1: if the padding is invalid */ </div><div>    if (enc_err == 0) </div><div>        { </div><div>        al=SSL_AD_DECRYPTION_FAILED; </div><div>        SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_BLOCK_CIPHER_PAD_IS_WRONG); </div><div>        goto f_err; </div><div>        } </div><div><br></div><div>As seen from above, error is thrown only for 0 return value and -1 return value is not handled. So if i change the code  if (enc_err == 0)  to  if (enc_err <= 0) will solve my problem? </div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px;background-color:rgb(240,240,240)">There was no specific way to reproduce this issue and it was seen very sporadically.</span><br></div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px;background-color:rgb(240,240,240)"><br></span></div><div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:20px;background-color:rgb(240,240,240)">- Shyamal</span></div><div><br></div></div></div></div></div>