View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003392 | libmicrohttpd | HTTPS (TLS) | public | 2014-04-30 14:02 | 2021-09-02 17:54 |
| Reporter | gmsoft | Assigned To | Christian Grothoff | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 0.9.34 | ||||
| Target Version | 0.9.37 | Fixed in Version | 0.9.37 | ||
| Summary | 0003392: Infinite loop when HTTPS connection is reset (Denial of Service) | ||||
| Description | When a SSL connection is reset, socket errno is set to ECONNRESET in recv_tls_adapter(). Unfortunately, do_read() in connection.c treat this as non fatal (same a EINTR, EAGAIN and EWOULDBLOCK) and happily tries to read again and again from that connection. When using multiple threads, each thread affected will use 100% CPU and no resource will be freed. | ||||
| Steps To Reproduce | Establish an HTTPS connection and reset it before the reply. | ||||
| Additional Information | The attached fix solves the problem for me by simply closing the connection on ECONNRESET. | ||||
| Tags | No tags attached. | ||||
| Attached Files | libmicrohttp-ECONNRESET.diff (811 bytes)
Fix infinite loop (DoS) when HTTP connection is reset.
Signed-off-by: Guy Martin <gmsoft@tuxicoman.be>
Index: src/microhttpd/connection.c
===================================================================
--- src/microhttpd/connection.c (revision 33148)
+++ src/microhttpd/connection.c (working copy)
@@ -1612,9 +1612,13 @@
if (bytes_read < 0)
{
const int err = MHD_socket_errno_;
- if ((EINTR == err) || (EAGAIN == err) || (ECONNRESET == err)
- || (EWOULDBLOCK == err))
+ if ((EINTR == err) || (EAGAIN == err) || (EWOULDBLOCK == err))
return MHD_NO;
+ if (ECONNRESET == err)
+ {
+ CONNECTION_CLOSE_ERROR(connection, NULL);
+ return MHD_NO;
+ }
#if HAVE_MESSAGES
#if HTTPS_SUPPORT
if (0 != (connection->daemon->options & MHD_USE_SSL))
| ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2014-04-30 14:02 | gmsoft | New Issue | |
| 2014-04-30 14:02 | gmsoft | File Added: libmicrohttp-ECONNRESET.diff | |
| 2014-05-02 20:24 | Christian Grothoff | Note Added: 0008275 | |
| 2014-05-02 20:24 | Christian Grothoff | Status | new => resolved |
| 2014-05-02 20:24 | Christian Grothoff | Fixed in Version | => 0.9.35 |
| 2014-05-02 20:24 | Christian Grothoff | Resolution | open => fixed |
| 2014-05-02 20:24 | Christian Grothoff | Assigned To | => Christian Grothoff |
| 2014-05-02 20:24 | Christian Grothoff | Target Version | => 0.9.35 |
| 2014-05-02 20:52 | Christian Grothoff | Status | resolved => closed |
| 2014-06-02 00:12 | Christian Grothoff | Target Version | 0.9.35 => 0.9.37 |
| 2014-06-02 00:15 | Christian Grothoff | Fixed in Version | 0.9.35 => 0.9.37 |
| 2021-09-02 17:54 | Christian Grothoff | Changeset attached | => libmicrohttpd master 312d11ec |
| 2021-09-02 17:54 | Christian Grothoff | Note Added: 0018207 | |
| 2024-01-21 13:25 | Christian Grothoff | Category | HTTPS (SSL) => HTTPS (TLS) |