CVE-2020-5233: Github.com/oauth2 proxy/oauth2 proxy The Pattern '/\domain.com' Is Not Vulnerability

MODERATE
Advisory Identifier: GHSA-qqxw-m5fj-f7gv
CVSS 5.9
CWE-601
Published
Advisory Summary

CVE-2020-5233 is a MODERATE (CVSS 5.9) the pattern '/\domain.com' is not 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 the pattern '/\domain.com' is not disallowed when redirecting, allowing for open redirect. Remediation is available by upgrading affected packages to version 5.0.0.

CVE-2020-5233 at a Glance

CVE Identifier CVE-2020-5233
GHSA Identifier GHSA-qqxw-m5fj-f7gv
Severity MODERATE
CVSS v3.1 Base Score 5.9
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: 5.9

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

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

How to Fix CVE-2020-5233

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.0.0
Upgrade github.com/oauth2-proxy/oauth2-proxy to 5.0.0
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-5233, 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.0.0), 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 An open redirect vulnerability has been found in `oauth2_proxy`. Anyone who uses `oauth2_proxy` may potentially be impacted. For a context [detectify] have an in depth blog post about the potential impact of an open redirect. Particularly see the OAuth section. **tl;dr**: People's authentication tokens could be silently harvested by an attacker. e.g: `facebook.com/oauth.php?clientid=123&state=abc&redirect_url=https://yourdomain.com/red.php?url%3dhttps://attacker.com/` ### Patches @sauyon found the issue, and has submitted a patch. ``` diff --git a/oauthproxy.go b/oauthproxy.go index 72ab580..f420df6 100644 --- a/oauthproxy.go +++ b/oauthproxy.go @@ -517,7 +517,7 @@ func (p *OAuthProxy) GetRedirect(req *http.Request) (redirect string, err error) // 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) ``` This patch will be applied to the next release, which is scheduled for when this is publicly disclosed. ### Workarounds At this stage there is no work around.

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

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

References

Frequently Asked Questions

What is CVE-2020-5233?
CVE-2020-5233 is a security vulnerability in Github.com/oauth2 proxy/oauth2 proxy involving The pattern '/\domain.com' is not disallowed when redirecting, allowing for open redirect 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.0.0 across affected packages: github.com/oauth2-proxy/oauth2-proxy.
What version fixes CVE-2020-5233?
Upgrading to 5.0.0 (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.0.0. Upgrade your dependency to 5.0.0 or later.
What is the CVSS score of CVE-2020-5233?
CVE-2020-5233 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:H/A:L.
What CWE is associated with CVE-2020-5233?
CVE-2020-5233 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-5233?
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-qqxw-m5fj-f7gv",
  "modified" : "2021-05-24T21:20:17Z",
  "published" : "2021-12-20T18:02:38Z",
  "aliases" : [ "CVE-2020-5233" ],
  "summary" : "The pattern '/\\domain.com' is not disallowed when redirecting, allowing for open redirect",
  "details" : "### Impact\nAn open redirect vulnerability has been found in `oauth2_proxy`. Anyone who uses `oauth2_proxy` may potentially be impacted. \n\nFor a context [detectify] have an in depth blog post about the potential impact of an open redirect. Particularly see the OAuth section.\n\n**tl;dr**: People's authentication tokens could be silently harvested by an attacker. e.g:\n`facebook.com/oauth.php?clientid=123&state=abc&redirect_url=https://yourdomain.com/red.php?url%3dhttps://attacker.com/`\n\n### Patches\n\n@sauyon found the issue, and has submitted a patch. \n\n```\ndiff --git a/oauthproxy.go b/oauthproxy.go\nindex 72ab580..f420df6 100644\n--- a/oauthproxy.go\n+++ b/oauthproxy.go\n@@ -517,7 +517,7 @@ func (p *OAuthProxy) GetRedirect(req *http.Request) (redirect string, err error)\n // IsValidRedirect checks whether the redirect URL is whitelisted\n func (p *OAuthProxy) IsValidRedirect(redirect string) bool {\n \tswitch {\n-\tcase strings.HasPrefix(redirect, \"/\") && !strings.HasPrefix(redirect, \"//\"):\n+\tcase strings.HasPrefix(redirect, \"/\") && !strings.HasPrefix(redirect, \"//\") && !strings.HasPrefix(redirect, \"/\\\\\"):\n \t\treturn true\n \tcase strings.HasPrefix(redirect, \"http://\") || strings.HasPrefix(redirect, \"https://\"):\n \t\tredirectURL, err := url.Parse(redirect)\n```\n\nThis patch will be applied to the next release, which is scheduled for when this is publicly disclosed.\n\n### Workarounds\n\nAt this stage there is no work around.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:H/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/oauth2-proxy/oauth2-proxy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-qqxw-m5fj-f7gv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-5233"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/oauth2-proxy/oauth2_proxy/commit/a316f8a06f3c0ca2b5fc5fa18a91781b313607b2"
  }, {
    "type" : "WEB",
    "url" : "https://blog.detectify.com/2019/05/16/the-real-impact-of-an-open-redirect"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/oauth2-proxy/oauth2_proxy/releases/tag/v5.0.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-601" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-24T21:20:17Z",
    "nvd_published_at" : null
  }
}