Fwd: [Eventletdev] important security fix test required

16 views
Skip to first unread message

Victor Stinner

unread,
Feb 28, 2016, 3:54:46 PM2/28/16
to python-tulip
Hi,

I got this email from the eventlet mailing list. Does asyncio have a
similar issue?

Victor


---------- Forwarded message ----------
From: Sergey Shepelev <tem...@gmail.com>
Date: 2016-02-28 21:25 GMT+01:00
Subject: [Eventletdev] important security fix test required
To: eventletdev <event...@lists.secondlife.com>


Hello.

TL;DR: if you use SSL and Eventlet in one program, please run this
version, DoS attack fixed. If there are no regressions, it will be
released shortly.

Details: most likely you had a server with similar loop:

while True:
conn, _ = server_sock.accept()
spawn(process, conn)

Which is fine, but if server socket already was SSL wrapped, then by
default accept() tries to perform SSL handshake before returning the
connection. But handshake is a blocking operation so malicious client
could just connect and not start handshake and thus block server
before next accept().

--
Sergey Shepelev
Skype: sergey.shepelev
+79996126031
http://temoto.ru/

_______________________________________________
Click here to unsubscribe or manage your list subscription:
https://lists.secondlife.com/cgi-bin/mailman/listinfo/eventletdev

Guido van Rossum

unread,
Feb 28, 2016, 9:51:04 PM2/28/16
to Victor Stinner, python-tulip
It looks like asyncio is much more sophisticated, but you should
probably ask Antoine.
--
--Guido van Rossum (python.org/~guido)

Andrew Svetlov

unread,
Feb 29, 2016, 8:10:59 AM2/29/16
to Guido van Rossum, Victor Stinner, python-tulip
IIRC latest asyncio uses BIO (not socket wrapper) for SSL processing,
so it does never block.
--
Thanks,
Andrew Svetlov

Victor Stinner

unread,
Feb 29, 2016, 10:50:59 AM2/29/16
to Andrew Svetlov, Guido van Rossum, python-tulip
2016-02-29 14:10 GMT+01:00 Andrew Svetlov <andrew....@gmail.com>:
> IIRC latest asyncio uses BIO (not socket wrapper) for SSL processing,
> so it does never block.

What about Python 3.4 which doesn't support BIO? Do you think that the
SSL/TLS handshake can block? We use it in asynchronous mode, no?

_SelectorSslTransport:
...
sslsock = sslcontext.wrap_socket(rawsock, do_handshake_on_connect=False, ...)
...

The socket is in non-blocking mode, no?

In the C code, _ssl__SSLSocket_do_handshake_impl():

nonblocking = (sock->sock_timeout >= 0);
BIO_set_nbio(SSL_get_rbio(self->ssl), nonblocking);
BIO_set_nbio(SSL_get_wbio(self->ssl), nonblocking);
...
ret = SSL_do_handshake(self->ssl);
...
} else if (sockstate == SOCKET_IS_NONBLOCKING) {
break;

Victor
Reply all
Reply to author
Forward
0 new messages