CVE-2020-11053: Github.com/oauth2 proxy/oauth2 proxy Open Redirect Vulnerability

HIGH
Advisory Identifier: GHSA-j7px-6hwj-hpjg
CVSS 7.1
CWE-601
Published
Advisory Summary

CVE-2020-11053 is a HIGH (CVSS 7.1) open redirect vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Github.com/oauth2 proxy/oauth2 proxy libraries in the Go ecosystem. The issue involves open redirect in oauth2 proxy. Remediation is available by upgrading affected packages to version 5.1.1.

CVE-2020-11053 at a Glance

CVE Identifier CVE-2020-11053
GHSA Identifier GHSA-j7px-6hwj-hpjg
Severity HIGH
CVSS v3.1 Base Score 7.1
CWE Classification CWE-601: URL Redirection to Untrusted Site ('Open Redirect')
Affected Product Github.com/oauth2 proxy/oauth2 proxy
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2020-11053

To remediate this vulnerability, upgrade all affected Github.com/oauth2 proxy/oauth2 proxy dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/oauth2-proxy/oauth2-proxy fixed: 5.1.1
Upgrade github.com/oauth2-proxy/oauth2-proxy to 5.1.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/oauth2-proxy/oauth2-proxy

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-11053, inspect your project dependencies for Github.com/oauth2 proxy/oauth2 proxy:

inspect dependencies for github.com/oauth2-proxy/oauth2-proxy

Analyze the terminal output to locate any version of Github.com/oauth2 proxy/oauth2 proxy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.1.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. In Github.com/oauth2 proxy/oauth2 proxy, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact As 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 (eg. `%0a`, `%0b`,`%09`,`%0d`) the validation could be bypassed and allow a redirect to any URL provided. ### Patches @rootxharsh and @iamnoooob provided this patch as potential solution: ``` From 4b941f56eda310b5c4dc8080b7635a6bfabccad4 Mon Sep 17 00:00:00 2001 From: Harsh Jaiswal <harsh@pop-os.localdomain> Date: Fri, 1 May 2020 20:38:31 +0530 Subject: [PATCH] Fixes redirect issue --- oauthproxy.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oauthproxy.go b/oauthproxy.go index 1e9bb7c..f8beb4d 100644 --- a/oauthproxy.go +++ b/oauthproxy.go @@ -577,8 +577,9 @@ func validOptionalPort(port string) bool { // IsValidRedirect checks whether the redirect URL is whitelisted func (p *OAuthProxy) IsValidRedirect(redirect string) bool { + matched, _ := regexp.MatchString(`^/\s+/|\\`, redirect) switch { - case strings.HasPrefix(redirect, "/") && !strings.HasPrefix(redirect, "//") && !strings.HasPrefix(redirect, "/\\"): + case strings.HasPrefix(redirect, "/") && !strings.HasPrefix(redirect, "//") && !matched: return true case strings.HasPrefix(redirect, "http://") || strings.HasPrefix(redirect, "https://"): redirectURL, err := url.Parse(redirect) -- 2.17.1 ``` This issue was also reported to us separately by @mik317 several hours later The fix was implemented in [#xxx]() and released as version 5.1.1

CVE-2020-11053 Affected Github.com/oauth2 proxy/oauth2 proxy Versions

1 component(s)
Fixed Versions:
5.1.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/oauth2-proxy/oauth2-proxy
Go
< 5.1.1
5.1.1

References

Frequently Asked Questions

What is CVE-2020-11053?
CVE-2020-11053 is a security vulnerability in Github.com/oauth2 proxy/oauth2 proxy involving Open Redirect in OAuth2 Proxy under CWE-601: URL Redirection to Untrusted Site ('Open Redirect').
Which Github.com/oauth2 proxy/oauth2 proxy versions are affected?
Affected versions include releases prior to 5.1.1 across affected packages: github.com/oauth2-proxy/oauth2-proxy.
What version fixes CVE-2020-11053?
Upgrading to 5.1.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/oauth2-proxy/oauth2-proxy affected?
Yes, github.com/oauth2-proxy/oauth2-proxy is affected in releases prior to 5.1.1. Upgrade your dependency to 5.1.1 or later.
What is the CVSS score of CVE-2020-11053?
CVE-2020-11053 has a CVSS v3.1 base score of 7.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L.
What CWE is associated with CVE-2020-11053?
CVE-2020-11053 is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect') (The web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect.).
How can I check Go dependencies for CVE-2020-11053?
Run the dependency tree command: 'inspect dependencies for github.com/oauth2-proxy/oauth2-proxy'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-j7px-6hwj-hpjg",
  "modified" : "2024-02-15T06:33:23Z",
  "published" : "2021-12-20T17:59:10Z",
  "aliases" : [ "CVE-2020-11053" ],
  "summary" : "Open Redirect in OAuth2 Proxy",
  "details" : "### Impact\nAs 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.\nThis redirect URL is checked within the proxy and validated before redirecting the user to prevent malicious actors providing redirects to potentially harmful sites.\n\nHowever, by crafting a redirect URL with HTML encoded whitespace characters (eg. `%0a`, `%0b`,`%09`,`%0d`) the validation could be bypassed and allow a redirect to any URL provided.\n\n### Patches\n@rootxharsh and @iamnoooob provided this patch as potential solution:\n```\nFrom 4b941f56eda310b5c4dc8080b7635a6bfabccad4 Mon Sep 17 00:00:00 2001\nFrom: Harsh Jaiswal <harsh@pop-os.localdomain>\nDate: Fri, 1 May 2020 20:38:31 +0530\nSubject: [PATCH] Fixes redirect issue\n\n---\n oauthproxy.go | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/oauthproxy.go b/oauthproxy.go\nindex 1e9bb7c..f8beb4d 100644\n--- a/oauthproxy.go\n+++ b/oauthproxy.go\n@@ -577,8 +577,9 @@ func validOptionalPort(port string) bool {\n\n // IsValidRedirect checks whether the redirect URL is whitelisted\n func (p *OAuthProxy) IsValidRedirect(redirect string) bool {\n+       matched, _ := regexp.MatchString(`^/\\s+/|\\\\`, redirect)\n        switch {\n-       case strings.HasPrefix(redirect, \"/\") && !strings.HasPrefix(redirect, \"//\") && !strings.HasPrefix(redirect, \"/\\\\\"):\n+       case strings.HasPrefix(redirect, \"/\") && !strings.HasPrefix(redirect, \"//\") && !matched:\n                return true\n        case strings.HasPrefix(redirect, \"http://\") || strings.HasPrefix(redirect, \"https://\"):\n                redirectURL, err := url.Parse(redirect)\n--\n2.17.1\n```\n\nThis issue was also reported to us separately by @mik317 several hours later\n\nThe fix was implemented in [#xxx]() and released as version 5.1.1",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/oauth2-proxy/oauth2-proxy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.1.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-j7px-6hwj-hpjg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-11053"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/oauth2-proxy/oauth2-proxy/commit/0d5fa211df8ef2449347a56b22c779eb8d894c43"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-601" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-24T21:05:58Z",
    "nvd_published_at" : "2020-05-07T21:15:11Z"
  }
}