diff --git a/CHANGELOG.md b/CHANGELOG.md index 767cde7b1f..7bdb02ef93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ - DigitalOcean provider support added ## Important Notes -N/A +- (Security) Fix for open redirect vulnerability.. a bad actor using `/\` in redirect URIs can redirect a session to another domain ## Breaking Changes diff --git a/oauthproxy.go b/oauthproxy.go index a0195ea063..37019b48c3 100644 --- a/oauthproxy.go +++ b/oauthproxy.go @@ -558,7 +558,7 @@ func validOptionalPort(port string) bool { // IsValidRedirect checks whether the redirect URL is whitelisted func (p *OAuthProxy) IsValidRedirect(redirect string) bool { switch { - case strings.HasPrefix(redirect, "/") && !strings.HasPrefix(redirect, "//"): + case strings.HasPrefix(redirect, "/") && !strings.HasPrefix(redirect, "//") && !strings.HasPrefix(redirect, "/\\"): return true case strings.HasPrefix(redirect, "http://") || strings.HasPrefix(redirect, "https://"): redirectURL, err := url.Parse(redirect)