GHSA-xhv5-w9c5-2r2w

Suggest an improvement
Source
https://github.com/advisories/GHSA-xhv5-w9c5-2r2w
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2021/02/GHSA-xhv5-w9c5-2r2w/GHSA-xhv5-w9c5-2r2w.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-xhv5-w9c5-2r2w
Aliases
Published
2021-02-02T21:42:56Z
Modified
2023-11-08T04:04:40.414283Z
Severity
  • 7.5 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
Unbounded connection acceptance in http4s-blaze-server
Details

Impact

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.

Patches

In 0.21.18, 0.22.0-M3, and 1.0.0-M16, a newmaxConnections 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.

The 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.

Workarounds

  • 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.
  • 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.
  • 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.
  • 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.

References

See the Blaze GHSA for more on the underlying issue.

For more information

If you have any questions or comments about this advisory: * Open an issue in http4s/http4s * Contact us according to the http4s security policy

Database specific
{
    "nvd_published_at": "2021-02-02T22:15:00Z",
    "github_reviewed_at": "2021-02-02T21:42:25Z",
    "severity": "HIGH",
    "github_reviewed": true,
    "cwe_ids": [
        "CWE-400",
        "CWE-770"
    ]
}
References

Affected packages

Maven / org.http4s:http4s-blaze-server_2.12

Package

Name
org.http4s:http4s-blaze-server_2.12
View open source insights on deps.dev
Purl
pkg:maven/org.http4s/http4s-blaze-server_2.12

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.21.17

Affected versions

0.*

0.10.0-M10
0.15.0
0.15.0a
0.15.1
0.15.1a
0.15.2
0.15.2a
0.15.3
0.15.3a
0.15.4
0.15.4a
0.15.5
0.15.5a
0.15.6
0.15.6a
0.15.7
0.15.7a
0.15.8
0.15.8a
0.15.9
0.15.9a
0.15.10
0.15.10a
0.15.11
0.15.11a
0.15.12
0.15.12a
0.15.13
0.15.13a
0.15.14
0.15.14a
0.15.15
0.15.15a
0.15.16
0.15.16a
0.16.0-M1
0.16.0-M2
0.16.0-M3
0.16.0-RC1
0.16.0-RC2
0.16.0-RC3
0.16.0
0.16.0a-M1
0.16.0a-M2
0.16.0a-M3
0.16.0a-RC1
0.16.0a-RC2
0.16.0a-RC3
0.16.0a
0.16.1
0.16.1a
0.16.2
0.16.2a
0.16.3
0.16.3a
0.16.4
0.16.4a
0.16.5
0.16.5a
0.16.6
0.16.6a
0.17.0-M1
0.17.0-M2
0.17.0-M3
0.17.0-RC1
0.17.0-RC2
0.17.0-RC3
0.17.0
0.17.1
0.17.2
0.17.3
0.17.4
0.17.5
0.17.6
0.18.0-M1
0.18.0-M2
0.18.0-M3
0.18.0-M4
0.18.0-M5
0.18.0-M6
0.18.0-M7
0.18.0-M8
0.18.0-M9
0.18.0
0.18.1
0.18.2
0.18.3
0.18.4
0.18.5
0.18.6
0.18.7
0.18.8
0.18.9
0.18.10
0.18.11
0.18.12
0.18.13
0.18.14
0.18.15
0.18.16
0.18.17
0.18.18
0.18.19
0.18.20
0.18.21
0.18.22
0.18.23
0.18.24
0.18.25
0.18.26
0.19.0-M1
0.19.0-M2
0.19.0-M3
0.19.0-M4
0.19.0
0.20.0-M1
0.20.0-M2
0.20.0-M3
0.20.0-M4
0.20.0-M5
0.20.0-M6
0.20.0-M7
0.20.0-RC1
0.20.0
0.20.1
0.20.2
0.20.3
0.20.4
0.20.5
0.20.6
0.20.7
0.20.8
0.20.9
0.20.10
0.20.11
0.20.12
0.20.13
0.20.14
0.20.15
0.20.16
0.20.17
0.20.18
0.20.19
0.20.20
0.20.21
0.20.22
0.20.23
0.21.0-M1
0.21.0-M2
0.21.0-M3
0.21.0-M4
0.21.0-M5
0.21.0-M6
0.21.0-RC1
0.21.0-RC2
0.21.0-RC3
0.21.0-RC4
0.21.0-RC5
0.21.0
0.21.1
0.21.2
0.21.3
0.21.4
0.21.5
0.21.6
0.21.7
0.21.8
0.21.9
0.21.11
0.21.12
0.21.13
0.21.14
0.21.15
0.21.16

Maven / org.http4s:http4s-blaze-server_2.13

Package

Name
org.http4s:http4s-blaze-server_2.13
View open source insights on deps.dev
Purl
pkg:maven/org.http4s/http4s-blaze-server_2.13

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.21.17

Affected versions

0.*

0.10.0-M10
0.21.0-M1
0.21.0-M2
0.21.0-M3
0.21.0-M4
0.21.0-M5
0.21.0-M6
0.21.0-RC1
0.21.0-RC2
0.21.0-RC3
0.21.0-RC4
0.21.0-RC5
0.21.0
0.21.1
0.21.2
0.21.3
0.21.4
0.21.5
0.21.6
0.21.7
0.21.8
0.21.9
0.21.11
0.21.12
0.21.13
0.21.14
0.21.15
0.21.16