All problems

Password Reset Redirects to an External Site

Level 2 · node · Security · Open Redirect

Scenario

An account password-reset completion API accepts an optional returnUrl and sends the user back to an approved web host. Relative paths and normal service URLs work, but a security review found that an external host containing the service domain as text is also accepted, allowing users to be sent to a phishing site immediately after resetting a password. The controller passes the value through a redirect-policy module before calling the service.

Requirements

- A relative returnUrl is allowed relative to the service origin - URLs on the https://app.example.test host are allowed - External hosts such as app.example.test.evil.test are rejected - A URL such as https://[email protected] with the allowed domain in userinfo is rejected - A rejected returnUrl falls back to the safe /account path

Acceptance criteria

  • A relative returnUrl is returned as an absolute URL on the service origin
  • An HTTPS URL on the allowed service host is returned unchanged
  • An external host with the allowed-domain text as a prefix is rejected
  • An external URL with the allowed domain in userinfo is rejected
  • Password change still completes for an invalid returnUrl and a safe fallback is returned