Am I affected?

type your phoenix_live_view version to check

Description

Cross-site scripting vulnerability in phoenixframework phoenix_live_view allows an attacker to bypass URL scheme validation and execute JavaScript in a victim's browser session.

The Phoenix.LiveView.Utils.valid_destination!/2 and Phoenix.LiveView.Utils.valid_live_navigation_destination!/2 functions in lib/phoenix_live_view/utils.ex rely on an internal uri_scheme/1 helper that only detects a scheme when the input's first byte is an ASCII letter. Inputs beginning with an ASCII control character or space fall through to a nil-returning clause, causing the URL to be treated as a safe relative path.

Standard browsers implement the WHATWG URL parser, which strips leading C0 control and space characters before parsing. As a result, an input such as " javascript:alert(1)" is passed unchanged into <.link href={...}> and, when clicked, is parsed by the browser as a javascript: URL that executes attacker-controlled script in the victim's session.

Applications that render user-supplied URLs (for example profile links, redirect targets, or external references) via <.link href={...}> are affected.

This issue affects phoenix_live_view: from 1.2.2 before 1.2.7.

Weaknesses & attack patterns

Weakness

CWE-79 · Improper Neutralization of Input During Web Page Generation in catalog → MITRE ↗

Attack patterns

CAPEC-63 · Cross-Site Scripting (XSS) MITRE ↗

Affected — Hex / phoenix_live_view Hex.pm ↗ Repository ↗

≥ 1.2.2 < 1.2.7 affected
every other version: unaffected
cpe cpe:2.3:a:phoenixframework:phoenix_live_view:*:*:*:*:*:*:*:*
version type semver
modules · source files · routines
modules 'Elixir.Phoenix.LiveView.Utils'
source files lib/phoenix_live_view/utils.ex
routines 'Elixir.Phoenix.LiveView.Utils':valid_destination!/2 · 'Elixir.Phoenix.LiveView.Utils':valid_live_navigation_destination!/2

Affected — GitHub / phoenixframework/phoenix_live_view Repository ↗

≥ 4b63216 < 8616553 affected
every other version: unaffected
cpe cpe:2.3:a:phoenixframework:phoenix_live_view:*:*:*:*:*:*:*:*
version type git
modules · source files · routines
modules 'Elixir.Phoenix.LiveView.Utils'
source files lib/phoenix_live_view/utils.ex
routines 'Elixir.Phoenix.LiveView.Utils':valid_destination!/2 · 'Elixir.Phoenix.LiveView.Utils':valid_live_navigation_destination!/2

Workarounds

Strip leading ASCII control and space bytes (code points 0x00 through 0x20) from any untrusted URL before passing it to <.link href={...}>, or reject such inputs outright. This aligns application-level validation with the WHATWG URL parser used by browsers and prevents the scheme-detection bypass.

References

Credits

Barna Kovacs Finder
Jonatan Männchen / EEF Analyst
José Valim Analyst
Steffen Deusch Remediation developer

CVSS breakdown

CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:L/VI:L/VA:N/SC:H/SI:H/SA:N

Exploitability

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
Active

Vulnerable System

Confidentiality
Low
Integrity
Low
Availability
None

Subsequent Systems

Confidentiality
High
Integrity
High
Availability
None
« All CVEs