Am I affected?

type your hackney version to check

Description

Allocation of Resources Without Limits or Throttling vulnerability in benoitc hackney allows Flooding.

The WebSocket client in src/hackney_ws.erl imposes no upper bound on memory consumption in three code paths. First, read_handshake_response/3 accumulates received bytes into a growing buffer with no size cap; the per-receive timeout resets on every chunk, so a server that streams bytes without ever sending \r\n\r\n causes the buffer to grow until memory is exhausted. Second, parse_payload/9 and parse_active_payload/8 do not validate the declared frame payload length against any limit; because RFC 6455 allows payload lengths up to 2⁻¹–¹ bytes, a server that announces a very large frame and dribbles bytes causes the accumulation buffer to grow until OOM. Third, the frag_buffer field in #ws_data{} accumulates continuation frames indefinitely; a server that sends an endless stream of non-final (nofin) fragmented frames without ever sending a final (fin) frame grows frag_buffer without bound.

In all three cases the attacker only needs to control the WebSocket server the hackney client connects to, with no authentication or special client configuration required.

This issue affects hackney: from 2.0.0 before 4.0.1.

Weaknesses & attack patterns

Weakness

CWE-400 · Uncontrolled Resource Consumption in catalog → MITRE ↗

Attack patterns

CAPEC-125 · Flooding MITRE ↗

Affected — Hex / hackney Hex.pm ↗ Repository ↗

2.0.0 < 4.0.1 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:benoitc:hackney:*:*:*:*:*:*:*:*
modules · source files · routines
modules hackney_ws
source files src/hackney_ws.erl
routines hackney_ws:read_handshake_response/3 · hackney_ws:parse_payload/9 · hackney_ws:parse_active_payload/8

Affected — GitHub / benoitc/hackney Repository ↗

690ceca < ce0109e affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:benoitc:hackney:*:*:*:*:*:*:*:*
modules · source files · routines
modules hackney_ws
source files src/hackney_ws.erl
routines hackney_ws:read_handshake_response/3 · hackney_ws:parse_payload/9 · hackney_ws:parse_active_payload/8

References

Credits

Peter Ullrich Finder
Benoit Chesneau Remediation developer
Jonatan Männchen / EEF Analyst

CVSS breakdown

CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
« All CVEs