Am I affected?

type your plug_cowboy version to check

Description

Allocation of Resources Without Limits or Throttling vulnerability in elixir-plug plug_cowboy allows unauthenticated remote denial of service via atom table exhaustion.

Plug.Cowboy.Conn.conn/1 in lib/plug/cowboy/conn.ex calls String.to_atom/1 on the value returned by :cowboy_req.scheme/1. For HTTP/2 connections, cowlib passes the client-supplied :scheme pseudo-header value through verbatim without validation. Each unique value permanently allocates a new entry in the BEAM atom table. Since atoms are never garbage-collected and the atom table has a fixed limit (default 1,048,576), an unauthenticated attacker can exhaust the table by sending HTTP/2 requests with unique :scheme values, causing the Erlang VM to abort with system_limit and taking down the entire node.

This vulnerability does not affect HTTP/1.1, where cowboy derives the scheme from the listener type rather than from a client-supplied header.

This issue affects plug_cowboy: from 2.0.0 before 2.8.1.

Weaknesses & attack patterns

Weakness

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

Attack patterns

CAPEC-125 · Flooding MITRE ↗

Affected — Hex / plug_cowboy Hex.pm ↗ Repository ↗

2.0.0 < 2.8.1 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:elixir-plug:plug_cowboy:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Plug.Cowboy.Conn'
source files lib/plug/cowboy/conn.ex
routines 'Elixir.Plug.Cowboy.Conn':conn/1

Affected — GitHub / elixir-plug/plug_cowboy Repository ↗

12ecfd0 < bfb34cb affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:elixir-plug:plug_cowboy:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Plug.Cowboy.Conn'
source files lib/plug/cowboy/conn.ex
routines 'Elixir.Plug.Cowboy.Conn':conn/1

Workarounds

Disable HTTP/2 on the Plug.Cowboy.https/3 listener by passing protocol_options: %{protocols: [:http]} in the cowboy options. This restricts the listener to HTTP/1.1, where the scheme is derived from the listener type and is not attacker-controlled.

References

Credits

Peter Ullrich Finder

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