Regular Expression Denial of Service in websocket-extensions (NPM package)

2020-06-05T16:16:12
ID GHSA-G78M-2CHM-R7QV
Type github
Reporter GitHub Advisory Database
Modified 2020-08-14T16:23:28

Description

Impact

The ReDoS flaw allows an attacker to exhaust the server's capacity to process incoming requests by sending a WebSocket handshake request containing a header of the following form:

Sec-WebSocket-Extensions: a; b="\c\c\c\c\c\c\c\c\c\c ...

That is, a header containing an unclosed string parameter value whose content is a repeating two-byte sequence of a backslash and some other character. The parser takes exponential time to reject this header as invalid, and this will block the processing of any other work on the same thread. Thus if you are running a single-threaded server, such a request can render your service completely unavailable.

Patches

Users should upgrade to version 0.1.4.

Workarounds

There are no known work-arounds other than disabling any public-facing WebSocket functionality you are operating.

References

  • https://blog.jcoglan.com/2020/06/02/redos-vulnerability-in-websocket-extensions/