Login redirect check using startsWith("/") still allows open redirects
A common login-page pattern only follows a next parameter if it starts with a slash, assuming this keeps users on the same site. The author found this check fails because values like //evil.example and /\evil.example are treated as off-site URLs by browsers. Such links can send users to a malicious site after they sign in on a real login page, making phishing easier. The team replaced the check with a shared function that rejects protocol-relative URLs, backslash tricks, and control characters, and tested it against known attack strings. While fixing this, they also found a separate bug where query strings were dropped during redirects, which they corrected.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in