Scheme validation bypass in Phoenix.LiveView.Utils leads to XSS via <.link>
phoenixframework phoenix_live_view
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| phoenixframework phoenix_live_view |
| No fix yet |
| phoenixframework phoenix_live_view |
| No fix yet |
Original 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.