VYPR
High severityNVD Advisory· Published May 7, 2020· Updated Aug 4, 2024

Open Redirect in OAuth2 Proxy

CVE-2020-11053

Description

In OAuth2 Proxy before 5.1.1, there is an open redirect vulnerability. Users can provide a redirect address for the proxy to send the authenticated user to at the end of the authentication flow. This is expected to be the original URL that the user was trying to access. This redirect URL is checked within the proxy and validated before redirecting the user to prevent malicious actors providing redirects to potentially harmful sites. However, by crafting a redirect URL with HTML encoded whitespace characters the validation could be bypassed and allow a redirect to any URL provided. This has been patched in 5.1.1.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
github.com/oauth2-proxy/oauth2-proxyGo
< 5.1.15.1.1

Affected products

1

Patches

1
0d5fa211df8e

Merge pull request from GHSA-j7px-6hwj-hpjg

2 files changed · +60 1
  • oauthproxy.go+5 1 modified
    @@ -57,6 +57,10 @@ var SignatureHeaders = []string{
     var (
     	// ErrNeedsLogin means the user should be redirected to the login page
     	ErrNeedsLogin = errors.New("redirect to login page")
    +
    +	// Used to check final redirects are not susceptible to open redirects.
    +	// Matches //, /\ and both of these with whitespace in between (eg / / or / \).
    +	invalidRedirectRegex = regexp.MustCompile(`^/(\s|\v)?(/|\\)`)
     )
     
     // OAuthProxy is the main authentication proxy
    @@ -578,7 +582,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, "//") && !strings.HasPrefix(redirect, "/\\"):
    +	case strings.HasPrefix(redirect, "/") && !strings.HasPrefix(redirect, "//") && !invalidRedirectRegex.MatchString(redirect):
     		return true
     	case strings.HasPrefix(redirect, "http://") || strings.HasPrefix(redirect, "https://"):
     		redirectURL, err := url.Parse(redirect)
    
  • oauthproxy_test.go+55 0 modified
    @@ -322,6 +322,61 @@ func TestIsValidRedirect(t *testing.T) {
     			Redirect:       "http://a.sub.anyport.bar:8081/redirect",
     			ExpectedResult: true,
     		},
    +		{
    +			Desc:           "openRedirect1",
    +			Redirect:       "/\\evil.com",
    +			ExpectedResult: false,
    +		},
    +		{
    +			Desc:           "openRedirectSpace1",
    +			Redirect:       "/ /evil.com",
    +			ExpectedResult: false,
    +		},
    +		{
    +			Desc:           "openRedirectSpace2",
    +			Redirect:       "/ \\evil.com",
    +			ExpectedResult: false,
    +		},
    +		{
    +			Desc:           "openRedirectTab1",
    +			Redirect:       "/\t/evil.com",
    +			ExpectedResult: false,
    +		},
    +		{
    +			Desc:           "openRedirectTab2",
    +			Redirect:       "/\t\\evil.com",
    +			ExpectedResult: false,
    +		},
    +		{
    +			Desc:           "openRedirectVerticalTab1",
    +			Redirect:       "/\v/evil.com",
    +			ExpectedResult: false,
    +		},
    +		{
    +			Desc:           "openRedirectVerticalTab2",
    +			Redirect:       "/\v\\evil.com",
    +			ExpectedResult: false,
    +		},
    +		{
    +			Desc:           "openRedirectNewLine1",
    +			Redirect:       "/\n/evil.com",
    +			ExpectedResult: false,
    +		},
    +		{
    +			Desc:           "openRedirectNewLine2",
    +			Redirect:       "/\n\\evil.com",
    +			ExpectedResult: false,
    +		},
    +		{
    +			Desc:           "openRedirectCarriageReturn1",
    +			Redirect:       "/\r/evil.com",
    +			ExpectedResult: false,
    +		},
    +		{
    +			Desc:           "openRedirectCarriageReturn2",
    +			Redirect:       "/\r\\evil.com",
    +			ExpectedResult: false,
    +		},
     	}
     
     	for _, tc := range testCases {
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

4

News mentions

0

No linked articles in our index yet.