Am I affected?

type your plug version to check

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.

Weaknesses & attack patterns

Weakness

CWE-141 · Improper Neutralization of Parameter/Argument Delimiters in catalog → MITRE ↗

Attack patterns

CAPEC-61 · Session Fixation MITRE ↗

Affected — Hex / plug Hex.pm ↗ Repository ↗

0.1.0 < 1.16.6 affected
1.17 series 1.17.0 < 1.17.4 affected
1.18 series 1.18.0 < 1.18.5 affected
1.19 series 1.19.0 < 1.19.5 affected
1.20 series 1.20.0 < 1.20.3 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:elixir-plug:plug:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Plug.Conn.Cookies' · 'Elixir.Plug.Conn'
source files lib/plug/conn/cookies.ex
routines 'Elixir.Plug.Conn.Cookies':encode/2 · 'Elixir.Plug.Conn':put_resp_cookie/4

Affected — GitHub / elixir-plug/plug Repository ↗

f26876a and up affected
3f00dfa not affected
a6d1248 not affected
4167981 not affected
149d9ed not affected
eceb831 not affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:elixir-plug:plug:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Plug.Conn.Cookies' · 'Elixir.Plug.Conn'
source files lib/plug/conn/cookies.ex
routines 'Elixir.Plug.Conn.Cookies':encode/2 · 'Elixir.Plug.Conn':put_resp_cookie/4

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

Credits

Peter Ullrich Finder
José Valim Remediation developer
Jonatan Männchen Analyst

CVSS breakdown

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