Am I affected?

type your phoenix_live_view version to check

Description

URL Redirection to Untrusted Site ('Open Redirect') vulnerability in phoenixframework phoenix_live_view allows an attacker to send a victim's browser to an origin of the attacker's choosing via a :to value containing ASCII tab, LF or CR.

redirect/2 validates :to through the private validate_local_url!/2 in lib/phoenix_live_view.ex, which is intended to guarantee the target is a path within the application. It rejects a leading // and any backslash, but not ASCII tab, LF or CR. Browsers strip those three characters before parsing a URL, so a value such as /<TAB>/example.com passes validation as a path and is then resolved as the scheme-relative URL //example.com. The live navigation functions share the guard but are not affected, because the client expands their target against the current origin. push_patch/2 is also affected before 0.7.0, which is when that expansion was added.

This issue affects phoenix_live_view: from 0.5.0 before 1.0.19, from 1.1.0-rc.0 before 1.1.33, and from 1.2.0-rc.0 before 1.2.9.

Weaknesses & attack patterns

Weakness

CWE-601 · URL Redirection to Untrusted Site ('Open Redirect') in catalog → MITRE ↗

Attack patterns

CAPEC-3 · Using Leading 'Ghost' Character Sequences to Bypass Input Filters MITRE ↗

Affected — Hex / phoenix_live_view Hex.pm ↗ Repository ↗

0.5.0 < 1.0.19 affected
1.1 series 1.1.0-rc.0 < 1.1.33 affected
1.2 series 1.2.0-rc.0 < 1.2.9 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:phoenixframework:phoenix_live_view:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Phoenix.LiveView'
source files lib/phoenix_live_view.ex
routines 'Elixir.Phoenix.LiveView':redirect/2 · 'Elixir.Phoenix.LiveView':push_patch/2

Affected — GitHub / phoenixframework/phoenix_live_view Repository ↗

b20dba3 and up affected
0b8c733 not affected
1c164f8 not affected
2068b30 not affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:phoenixframework:phoenix_live_view:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Phoenix.LiveView'
source files lib/phoenix_live_view.ex
routines 'Elixir.Phoenix.LiveView':redirect/2 · 'Elixir.Phoenix.LiveView':push_patch/2

Workarounds

Reject any untrusted value containing ASCII tab, LF or CR before passing it as :to to redirect/2, or to push_patch/2 before 0.7.0. Alternatively, map client-supplied navigation targets to a fixed set of known-good paths rather than forwarding the value.

Configurations

The application must pass an externally influenced value as :to to redirect/2, or to push_patch/2 before 0.7.0, for example a return_to parameter carried through sign-in or a navigation target taken from a handle_event/3 payload.

References

Credits

Eurico Nicacio Finder
Steffen Deusch Remediation developer
José Valim Remediation reviewer
Jonatan Männchen / EEF Analyst

CVSS breakdown

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