EEF-CVE-2026-120287

Source
https://cna.erlef.org/osv/EEF-CVE-2026-120287.html
Import Source
https://cna.erlef.org/osv/EEF-CVE-2026-120287.json
JSON Data
https://api.osv.dev/v1/vulns/EEF-CVE-2026-120287
Aliases
  • GHSA-qj4r-jh2r-rw3f
  • CVE-2026-120287
Published
2026-11-17T16:53:38Z
Modified
2026-11-17T17:01:04Z
Severity
  • 6.9 (Medium) CVSS_V4 - 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 CVSS Calculator
Summary
Multipart `:length` limit not charged for part and header framing in Plug.Parsers.MULTIPART
Details

Summary

Allocation of Resources Without Limits or Throttling vulnerability in Plug.Parsers.MULTIPART in elixir-plug plug allows an unauthenticated remote attacker to exhaust memory via a multipart request body built from parts without headers, or from header lines without a name and a value. The parser charges the :length limit only with the name and value bytes of each part header and the bytes of each part body. The part delimiter, the header separator, and the line endings cost nothing.

In lib/plug/parsers/multipart.ex, Plug.Parsers.MULTIPART.parse_multipart_headers/5 keeps an entry for every part without a content-disposition header, together with its header list, until the whole body is read. A request made of such parts does not reach the limit at any size, and the parser process holds a multiple of the request size in memory until parsing completes. Any endpoint that uses Plug.Parsers with the :multipart parser is reachable.

This issue affects plug: from 1.13.0 before 1.20.4.

Details

1. What the limit counts. Plug.Parsers.MULTIPART.parse_multipart_headers/5 subtracts the result of headers_size/1 from the remaining :length limit. headers_size/1 sums byte_size(key) + byte_size(value) for each header. The part delimiter, the colon and CRLF of each header line, and the blank line that ends the header block are not counted.

2. Inputs that cost zero. A part without headers has an empty header list, so its charge is 0. A header line that holds only : followed by CRLF also costs 0, because :plug_multipart.parse_hd_name/3 accepts the empty name and returns the header {"", ""}.

3. Retention. multipart_type/1 returns {:binary, nil} for a part without a content-disposition header. The parser then prepends {nil, headers, body} to its accumulator for that part. Plug.Parsers.MULTIPART.multipart_to_params/3 drops these entries, but only after the whole request body is read.

4. Limits that stay in effect. Plug.Conn.read_part_headers/2 limits one header block to the smaller of :length and :read_length. No limit applies to the sum over all parts.

On plug 1.20.3 with length: 100_000, a 4.5 MB body of 500,001 parts without headers parsed successfully with a peak of 92 MiB in the parser process. A 4.5 MB body of 50 parts with 30,000 : header lines each peaked at 283 MiB.

Proof of concept

  1. Build a multipart body with the boundary b that holds 500,001 parts without headers: the opening --b\r\n\r\n, then \r\n--b\r\n\r\n repeated 500,000 times, then \r\n--b--\r\n. The body is 4.5 MB.
  2. Create a connection with Plug.Test.conn(:post, "/", body) and the request header content-type: multipart/form-data; boundary=b.
  3. Call Plug.Parsers.MULTIPART.parse/5 with the options from Plug.Parsers.MULTIPART.init(length: 100_000).
  4. Observe that the call returns {:ok, %{}, conn} and not {:error, :too_large, conn}, and that the memory of the calling process rises to about 20 times the body size during the call.
  5. Repeat with 50 parts that each hold 30,000 header lines of :\r\n. The result is the same, with about 65 times the body size.

Impact

One request makes the process that parses it hold many times the request size in memory until parsing completes, and concurrent requests add up. An application that accepts multipart requests from unauthenticated clients can run out of memory.

Workarounds

Limit the request body size in a reverse proxy in front of the application, for example with client_max_body_size in nginx. The proxy rejects a larger body before it reaches the parser. This limits the memory that one request can hold but does not remove the multiplication: a body below the proxy limit still passes the :length limit.

Database specific
{
    "capec_ids":  [
        "CAPEC-130"
    ],
    "cpe_ids":  [
        "cpe:2.3:a:elixir-plug:plug:*:*:*:*:*:*:*:*"
    ],
    "cwe_ids":  [
        "CWE-770"
    ]
}
References
Credits
    • Neil Berkman / Xuku LLC - FINDER
    • Neil Berkman / Xuku LLC - REPORTER
    • José Valim - REMEDIATION_DEVELOPER
    • Jonatan Männchen / EEF - COORDINATOR

Affected packages

Hex / plug

Package

Name
plug
Purl
pkg:hex/plug

Affected ranges

Type
SEMVER
Events
Introduced
1.13.0
Fixed
1.20.4

Affected versions

1.*
1.13.0
1.13.1
1.13.2
1.13.3
1.13.4
1.13.5
1.13.6
1.14.0
1.14.1
1.14.2
1.15.0
1.15.1
1.15.2
1.15.3
1.15.4
1.15.5
1.15.6
1.16.0
1.16.1
1.16.2
1.16.3
1.16.4
1.16.5
1.16.6
1.17.0
1.17.1
1.17.2
1.17.3
1.17.4
1.18.0
1.18.1
1.18.2
1.18.3
1.18.4
1.18.5
1.19.0
1.19.1
1.19.2
1.19.3
1.19.4
1.19.5
1.20.0
1.20.1
1.20.2
1.20.3

Database specific

source
"https://cna.erlef.org/osv/EEF-CVE-2026-120287.json"

Git / github.com/elixir-plug/plug

Affected ranges

Affected versions

v1.*
v1.13.0
v1.13.1
v1.13.2
v1.13.3
v1.13.4
v1.13.5
v1.14.0
v1.14.1
v1.14.2
v1.15.0
v1.15.1
v1.15.2
v1.15.3
v1.16.0
v1.16.1
v1.17.0
v1.18.0
v1.18.1
v1.19.1
v1.20.0
v1.20.1
v1.20.3

Database specific

source
"https://cna.erlef.org/osv/EEF-CVE-2026-120287.json"