openwrtv3/package/libs/cyassl/patches/200-SSL_accept-handle-hello-garbage.patch
Jo-Philipp Wich 6945d722e6 cyassl: add a patch to better check legacy SSLv2 client hello records
If junk data is received during SSL_accept(), cyassl will treat it as legacy SSLv2
record without performing further plausibility checks. Change the legacy code path
to return UNKNOWN_HANDSHAKE_TYPE if the value of the third byte isn't 0x01 the
hello message type.

SVN-Revision: 33675
2012-10-09 16:41:36 +00:00

13 lines
545 B
Diff

--- a/src/cyassl_int.c
+++ b/src/cyassl_int.c
@@ -1588,6 +1588,10 @@
b1 =
ssl->buffers.inputBuffer.buffer[ssl->buffers.inputBuffer.idx++];
ssl->curSize = ((b0 & 0x7f) << 8) | b1;
+
+ /* does not appear to a be a SSLv2 client hello */
+ if ( ssl->buffers.inputBuffer.buffer[ssl->buffers.inputBuffer.idx] != 1 )
+ return UNKNOWN_HANDSHAKE_TYPE;
}
else {
ssl->options.processReply = getRecordLayerHeader;