Am I affected?

type your cowboy version to check

Description

Allocation of Resources Without Limits or Throttling vulnerability in ninenines cowboy allows an unauthenticated remote attacker to exhaust connection process memory over HTTP/1.1.

The HTTP/1.1 handler in cowboy_http enforces the max_headers limit by counting the number of distinct header names in a map (maps:size(Headers)). When a request contains multiple header lines with the same name, the values are concatenated into a single ever-growing binary stored under that one map key (", " for regular headers, "; " for cookies), so the map size stays at one and the max_headers cap (default 100) is never reached. Because no accumulator bounds the total number of header lines or the total byte size of the header block (only per-line max_header_name_length and max_header_value_length apply), an unauthenticated client can send an arbitrary number of header lines with the same name and grow the connection process's binary memory to arbitrary size within the request window.

The impact per connection is bounded by request_timeout (default 5 seconds, not reset by header data), and by max_heap_size when set (the offending connection process is killed once its heap grows past the limit). When max_heap_size is left at the default (unset), sustained abuse can drive the Erlang VM into out-of-memory conditions.

This issue affects cowboy from 2.0.0-pre.4 before 2.18.0.

Weaknesses & attack patterns

Weakness

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

Attack patterns

CAPEC-130 · Excessive Allocation MITRE ↗

Affected — Hex / cowboy Hex.pm ↗ Repository ↗

2.0.0-pre.4 < 2.18.0 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:ninenines:cowboy:*:*:*:*:*:*:*:*
modules · source files · routines
modules cowboy_http
source files src/cowboy_http.erl
routines cowboy_http:parse_header/3 · cowboy_http:parse_hd_value/6

Affected — GitHub / ninenines/cowboy Repository ↗

309780a < 3a34d8c affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:ninenines:cowboy:*:*:*:*:*:*:*:*
modules · source files · routines
modules cowboy_http
source files src/cowboy_http.erl
routines cowboy_http:parse_header/3 · cowboy_http:parse_hd_value/6

References

Credits

Qiyi Deng / Wuhan University Finder
Min Shi / Wuhan University Finder
Yongkang Xiao / Wuhan University Finder
Jing Chen / Wuhan University Finder
Loïc Hoguin 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:L/SC:N/SI:N/SA:N
« All CVEs