我们的UC – KEEL工具发现do_ssl3_write一个空指针引用错误(ssl/s3_pkt.c)用于提醒挂起SSL_MODE_RELEASE_BUFFERS标志。这个错误影响最新的1.0.1分支。
do_ssl3_write() 中代码先检测缓冲区是否为NULL
644 if (wb->buf == NULL)645 if (!ssl3_setup_write_buffer(s))646 return -1;
然后,它会传输所有等待的提示
653 /* If we have an alert to send, lets send it */654 if (s->s3->alert_dispatch)655 {656 i=s->method->ssl_dispatch_alert(s);
ssl3_dispatch_alert() 再次调用 do_ssl3_write()
1501 i = do_ssl3_write(s, SSL3_RT_ALERT, &s->s3->send_alert[0], 2, 0);
调用 ssl3_write_pending():
852 /* we now just need to write the buffer */853 return ssl3_write_pending(s,type,buf,len);
如果使用SSL_MODE_RELEASE_BUFFERS ,则写入缓冲区
894 if (s->mode & SSL_MODE_RELEASE_BUFFERS &&895 SSL_version(s) != DTLS1_VERSION && SSL_version(s) != DTLS1_BAD_VER)896 ssl3_release_write_buffer(s);
当控制初始化调用do_ssl3_write() , wb->buf 已经被设置成NULL ,然后发生在743行 *(p++)=type&0xff; 引用空指针。
调用 ssl->dispatch_alert() 之后做二次校验是很有必要的,添加一个计数器就能避免任何的调用和操作把 ssl_st 释放到缓冲区。
References:
http://seclists.org/oss-sec/2014/q2/233
http://rt.openssl.org/Ticket/Display.html?user=guest&pass=guest&id=3321
http://anoncvs.estpak.ee/cgi-bin/cgit/openbsd-src/commit/lib/libssl?id=e76e308f1fab2253ab5b4ef52a1865c5ffecdf21
http://ftp.openbsd.org/pub/OpenBSD/patches/5.5/common/005_openssl.patch.sig
via:
http://pastebin.com/YkrbPDCv