CVE-2026-56813
Cookie attribute injection in Plug.Conn.Cookies.encode/2
Weakness Type (CWE)
CWE-141 — CWE-141 Improper Neutralization of Parameter/Argument Delimiters
CAPEC
Vulnerability description
Improper Neutralization of Parameter/Argument Delimiters vulnerability in elixir-plug plug allows an attacker to inject or override HTTP cookie attributes.
The Plug.Conn.Cookies.encode/2 function in lib/plug/conn/cookies.ex builds the Set-Cookie response header by interpolating the cookie value and its path, domain, same_site, and extra attributes directly into the header without neutralizing the ; delimiter that separates cookie attributes.
An application that places attacker-controlled data into a cookie value or attribute (for example via Plug.Conn.put_resp_cookie/4 when reflecting a username or preference) lets an attacker inject a ; to append or override cookie attributes (such as Domain and Path scope, or dropping the Secure and HttpOnly flags), enabling cookie tossing and session fixation. Carriage return, line feed, and null bytes are rejected by Plug.Conn header validation, so HTTP response splitting is not possible, but attribute injection through ; is not prevented.
This issue affects plug: from 0.1.0 before 1.16.6, from 1.17.0 before 1.17.4, from 1.18.0 before 1.18.5, from 1.19.0 before 1.19.5, from 1.20.0 before 1.20.3.
Affected
pkg:hex/plug
| Module | Source File | Routine |
|---|---|---|
Plug.Conn.Cookies
|
lib/plug/conn/cookies.ex
|
Plug.Conn.Cookies.encode/2
|
Plug.Conn
|
Plug.Conn.put_resp_cookie/4
|
| Status | Type | Version | Changes / Fixed in |
|---|---|---|---|
| affected | semver ⓘ | 0.1.0
|
< 1.16.6
|
| affected | semver ⓘ | 1.17.0
|
< 1.17.4
|
| affected | semver ⓘ | 1.18.0
|
< 1.18.5
|
| affected | semver ⓘ | 1.19.0
|
< 1.19.5
|
| affected | semver ⓘ | 1.20.0
|
< 1.20.3
|
pkg:github/elixir-plug/plug
| Module | Source File | Routine |
|---|---|---|
Plug.Conn.Cookies
|
lib/plug/conn/cookies.ex
|
Plug.Conn.Cookies.encode/2
|
Plug.Conn
|
Plug.Conn.put_resp_cookie/4
|
| Status | Type | Version | Changes / Fixed in |
|---|---|---|---|
| affected | git ⓘ | f26876aa67
|
|
Workarounds
Validate or reject the ; delimiter in any untrusted data before passing it as a cookie value or attribute to Plug.Conn.put_resp_cookie/4 or Plug.Conn.Cookies.encode/2. Carriage return, line feed, and null bytes are already rejected by Plug.Conn header validation.
References
- https://github.com/elixir-plug/plug/security/advisories/GHSA-wpmj-jh88-rpgm vendor-advisory related
- https://osv.dev/vulnerability/EEF-CVE-2026-56813 related
- https://github.com/elixir-plug/plug/commit/c6575800b2c4e15af1904df87522ca8a23da020c patch
Credits
- Finder: Peter Ullrich
- Remediation developer: José Valim
- Analyst: Jonatan Männchen
CVE record as JSON:
GET /cves/CVE-2026-56813.json
OSV record as JSON:
GET /osv/EEF-CVE-2026-56813.json