{"id":"CVE-2021-21294","aliases":["CVE-2021-21294","GHSA-xhv5-w9c5-2r2w"],"related":["CVE-2021-21293"],"kind":"vulnerability","state":"published","title":"Unbounded connection acceptance in http4s-blaze-server","summary":"Http4s (http4s-blaze-server) is a minimal, idiomatic Scala interface for HTTP services. Http4s before versions 0.21.17, 0.22.0-M2, and 1.0.0-M14 have a vulnerability which can lead to a denial-of-service. Blaze-core, a library underlying http4s-blaze-server, accepts connections unboundedly on its selector pool. This has the net effect of amplifying degradation in services that are unable to handle their current request load, since incoming connections are still accepted and added to an unbounded queue. Each connection allocates a socket handle, which drains a scarce OS resource. This can also confound higher level circuit breakers which work based on detecting failed connections. http4s provides a general \"MaxActiveRequests\" middleware mechanism for limiting open connections, but it is enforced inside the Blaze accept loop, after the connection is accepted and the socket opened. Thus, the limit only prevents the number of connections which can be simultaneously processed, not the number of connections which can be held open. In 0.21.17, 0.22.0-M2, and 1.0.0-M14, a new \"maxConnections\" property, with a default value of 1024, has been added to the `BlazeServerBuilder`. Setting the value to a negative number restores unbounded behavior, but is strongly disrecommended. The NIO2 backend does not respect `maxConnections`. Its use is now deprecated in http4s-0.21, and the option is removed altogether starting in http4s-0.22. There are several possible workarounds described in the refrenced GitHub Advisory GHSA-xhv5-w9c5-2r2w.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Http4s (http4s-blaze-server) is a minimal, idiomatic Scala interface for HTTP services. Http4s before versions 0.21.17, 0.22.0-M2, and 1.0.0-M14 have a vulnerability which can lead to a denial-of-service. Blaze-core, a library underlying http4s-blaze-server, accepts connections unboundedly on its selector pool. This has the net effect of amplifying degradation in services that are unable to handle their current request load, since incoming connections are still accepted and added to an unbounded queue. Each connection allocates a socket handle, which drains a scarce OS resource. This can also confound higher level circuit breakers which work based on detecting failed connections. http4s provides a general \"MaxActiveRequests\" middleware mechanism for limiting open connections, but it is enforced inside the Blaze accept loop, after the connection is accepted and the socket opened. Thus, the limit only prevents the number of connections which can be simultaneously processed, not the number of connections which can be held open. In 0.21.17, 0.22.0-M2, and 1.0.0-M14, a new \"maxConnections\" property, with a default value of 1024, has been added to the `BlazeServerBuilder`. Setting the value to a negative number restores unbounded behavior, but is strongly disrecommended. The NIO2 backend does not respect `maxConnections`. Its use is now deprecated in http4s-0.21, and the option is removed altogether starting in http4s-0.22. There are several possible workarounds described in the refrenced GitHub Advisory GHSA-xhv5-w9c5-2r2w.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nblaze-core, a library underlying http4s-blaze-server, accepts connections unboundedly on its selector pool. This has the net effect of amplifying degradation in services that are unable to handle their current request load, since incoming connections are still accepted and added to an unbounded queue. Each connection allocates a socket handle, which drains a scarce OS resource. This can also confound higher level circuit breakers which work based on detecting failed connections.\n\nhttp4s provides a general `MaxActiveRequests` middleware mechanism for limiting open connections, but it is enforced inside the Blaze accept loop, after the connection is accepted and the socket opened. Thus, the limit only prevents the number of connections which can be simultaneously processed, not the number of connections which can be held open.\n\n### Patches\n\nIn 0.21.18, 0.22.0-M3, and 1.0.0-M16, a new`maxConnections` property, with a default value of 1024, has been added to the `BlazeServerBuilder`.  Setting the value to a negative number restores unbounded behavior, but is strongly disrecommended.  \n\nThe NIO2 backend does not respect `maxConnections`.  Its use is now deprecated in http4s-0.21, and the option is removed altogether starting in http4s-0.22.\n\nThe connections are bounded in 0.21.17, 0.22.0-M2, and 1.0.0-M14, but the `maxConnections` parameter was passed incorrectly, making it impossible to change the Blaze default of 512. \n\n### Workarounds\n* An Nginx side-car acting as a reverse proxy for the local http4s-blaze-server instance would be able to apply a connection limiting semantic before the sockets reach blaze-core. Nginx’s connection bounding is both asynchronous and properly respects backpressure.\n* http4s-ember-server is an alternative to http4s-blaze-server, but does not yet have HTTP/2 or web socket support.  Its performance in terms of RPS is appreciably behind Blaze’s, and as the newest backend, has substantially less industrial uptake.\n* http4s-jetty is an alternative to http4s-blaze-server, but does not yet have web socket support.  Its performance in terms of requests per second is somewhat behind Blaze’s, and despite Jetty's industrial adoption, the http4s integration has substantially less industrial uptake.\n* http4s-tomcat is an alternative to http4s-blaze-server, but does not yet have HTTP/2 web socket support.  Its performance in terms of requests per second is somewhat behind Blaze’s, and despite Jetty's industrial adoption, the http4s integration has substantially less industrial uptake.\n\n### References\n\nSee [the Blaze GHSA](https://github.com/http4s/blaze/security/advisories/GHSA-xmw9-q7x9-j5qc) for more on the underlying issue.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [http4s/http4s](http://github.com/http4s/http4s)\n* Contact us according to the [http4s security policy](https://github.com/http4s/http4s/security/policy)","format":"markdown","source":"ghsa"},{"lang":"es","text":"Http4s (http4s-blaze-server) es una interfaz Scala mínima e idiomática para servicios HTTP.&#xa0;Http4s anterior a versiones 0.21.17, 0.22.0-M2 y 1.0.0-M14, presentan una vulnerabilidad que puede conllevar a una denegación de servicio.&#xa0;Blaze-core, una biblioteca subyacente a http4s-blaze-server, acepta conexiones ilimitadas en su grupo de selectores.&#xa0;Esto tiene el efecto neto de amplificar la degradación en los servicios que no pueden manejar su carga de peticiones actual, ya que las conexiones entrantes aún se aceptan y agregan a una cola ilimitada.&#xa0;Cada conexión asigna un identificador de socket, lo que agota un recurso escaso del sistema operativo.&#xa0;Esto también puede confundir a los disyuntores de nivel superior que funcionan basándose en la detección de conexiones en fallo.&#xa0;http4s proporciona un mecanismo de middleware \"MaxActiveRequests\" general para limitar las conexiones abiertas, pero se aplica dentro del bucle de aceptación de Blaze,&#xa0;después de que se acepta la conexión y se abre el socket.&#xa0;Por lo tanto, el límite solo impide el número de conexiones que se pueden procesar simultáneamente, no el número de conexiones que se pueden mantener abiertas.&#xa0;En 0.21.17, 0.22.0-M2 y 1.0.0-M14, se agregó una nueva propiedad \"maxConnections\", con un valor predeterminado de 1024, al \"BlazeServerBuilder\".&#xa0;Establecer el valor en un número negativo restaura el comportamiento ilimitado, pero se desaconseja enérgicamente.&#xa0;El backend de NIO2 no respeta \"maxConnections\".&#xa0;Su uso ahora es obsoleto en http4s-0.21, y la opción se elimina por completo a partir de http4s-0.22.&#xa0;Existen varias posibles soluciones que se describen en el Aviso de GitHub referenciado GHSA-xhv5-w9c5-2r2w","source":"nvd"}],"published":"2021-02-02T21:40:19.000Z","modified":"2026-06-17T03:35:13.220Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:N/C:N/I:N/A:P","score":5,"rating":"MEDIUM"}],"cwes":["CWE-400","CWE-770"],"affected":[{"ranges":[{"version":"< 0.21.17","status":"affected"}],"vendor":"http4s","product":"http4s","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.21.17"}],"ecosystem":"Maven","package":"org.http4s:http4s-blaze-server_2.12","purl":"pkg:maven/org.http4s/http4s-blaze-server_2.12","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.21.17"}],"ecosystem":"Maven","package":"org.http4s:http4s-blaze-server_2.13","purl":"pkg:maven/org.http4s/http4s-blaze-server_2.13","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.21.17"}],"vendor":"typelevel","product":"http4s","cpe":"cpe:2.3:a:typelevel:http4s:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/http4s/http4s/security/advisories/GHSA-xhv5-w9c5-2r2w","tags":["third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/http4s/blaze/security/advisories/GHSA-xmw9-q7x9-j5qc","tags":["third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/http4s/http4s/commit/987d6589ef79545b9bb2324ac4bdebf82d9a0171","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-21294","tags":["advisory"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-21294","url":"https://www.cve.org/CVERecord?id=CVE-2021-21294","licence":"CVE Terms of Use","modified":"2024-08-03T18:09:15.169Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-xhv5-w9c5-2r2w","url":"https://github.com/advisories/GHSA-xhv5-w9c5-2r2w","licence":"CC-BY-4.0","modified":"2026-02-04T02:36:50.236Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-21294","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-21294","licence":"Public domain","modified":"2026-06-17T03:35:13.220Z"}],"updatedAt":"2026-11-25T22:57:59.779Z","epss":{"score":0.02172,"percentile":0.8281,"date":"2026-12-01T12:00:22.000Z"}}