Am I affected?

type your erlang.org/otp version to check

Description

The Erlang/OTP httpc HTTP client does not enforce a limit on the total size of response headers received from a server. The max_header_size option defaults to nolimit, and httpc_response:parse_headers/6 accumulates every header into a list before the length check runs (which only fires after the terminating CRLF CRLF is received).

A malicious or compromised HTTP server can send an arbitrarily large number of headers, or headers with very large values, causing the client process to allocate unbounded memory until the system runs out of memory or the BEAM VM crashes. A proof-of-concept server sending 100,000 headers of roughly 4000 bytes each caused the client VM to allocate over 13 GB of memory in under 30 seconds.

Any application using httpc:request/4,5 to connect to untrusted servers is affected. No authentication is required: any server the client connects to (including via a redirect or man-in-the-middle) can trigger the exhaustion.

This issue affects OTP from OTP 17.0 before OTP 27.3.4.17, from OTP 28.0 before OTP 28.5.0.6, and from OTP 29.0 before OTP 29.0.6, corresponding to inets from 5.10 before 9.3.2.7, from 9.4 before 9.6.2.3, and from 9.7 before 9.7.2. Whether OTP before OTP 17.0, corresponding to inets before 5.10, is affected is unknown.

Weaknesses & attack patterns

Weakness

CWE-770 · Allocation of Resources Without Limits or Throttling in catalog → MITRE ↗

Attack patterns

CAPEC-130 · Excessive Allocation MITRE ↗

Affected — Erlang

< 17.0 status unknown
17.0 < 27.3.4.17 affected
maint-28 28.0 < 28.5.0.6 affected
maint-29 29.0 < 29.0.6 affected
every other version: unaffected
cpe cpe:2.3:a:erlang:erlang/otp:*:*:*:*:*:*:*:*
modules · source files · routines
modules httpc_response · httpc_handler · httpc
source files src/http_client/httpc_response.erl · src/http_client/httpc_handler.erl · src/http_client/httpc.erl
routines httpc_response:parse_headers/6 · httpc:request/4 · httpc:request/5

Affected — pkg:otp/inets Repository ↗

< 5.10 status unknown
5.10 < 9.3.2.7 affected
9.4 < 9.6.2.3 affected
9.7 < 9.7.2 affected
every other version: unaffected
cpe cpe:2.3:a:erlang:erlang/otp:*:*:*:*:*:*:*:*

Affected — GitHub / erlang/otp Repository ↗

84adefa and up affected
aba0fe8 not affected
e3be1cf not affected
every other version: unaffected
cpe cpe:2.3:a:erlang:erlang/otp:*:*:*:*:*:*:*:*
modules · source files · routines
modules httpc_response · httpc_handler · httpc
source files src/http_client/httpc_response.erl · src/http_client/httpc_handler.erl · src/http_client/httpc.erl
routines httpc_response:parse_headers/6 · httpc:request/4 · httpc:request/5

Workarounds

  • Restrict httpc to trusted servers only, and avoid using it to fetch resources from arbitrary or user-supplied URLs.
  • Apply operating-system memory limits (cgroups,ulimit) to contain the blast radius of a runaway client process.
  • Use an alternative HTTP client library that enforces a response header size limit.

References

Credits

Konrad Pietrzak / Ericsson Remediation developer

CVSS breakdown

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