CVE-2021-21411: Github.com/oauth2 proxy/oauth2 proxy/v7 OAuth2-Proxy's `--gitlab-group` GitLab Group Authorization Vulnerability

MODERATE
Advisory Identifier: GHSA-652x-m2gr-hppm
CVSS 5.5
CWE-285 CWE-863
Published
Advisory Summary

CVE-2021-21411 is a MODERATE (CVSS 5.5) oauth2-proxy's `--gitlab-group` gitlab group authorization vulnerability (CWE-285: Improper Authorization) affecting Github.com/oauth2 proxy/oauth2 proxy/v7 libraries in the Go ecosystem. The issue involves oauth2-proxy's `--gitlab-group` gitlab group authorization config flag stopped working in v7.0.0. Remediation is available by upgrading affected packages to version 7.1.0.

CVE-2021-21411 at a Glance

CVE Identifier CVE-2021-21411
GHSA Identifier GHSA-652x-m2gr-hppm
Severity MODERATE
CVSS v3.1 Base Score 5.5
CWE Classification CWE-285: Improper Authorization
Affected Product Github.com/oauth2 proxy/oauth2 proxy/v7
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.5

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

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

How to Fix CVE-2021-21411

To remediate this vulnerability, upgrade all affected Github.com/oauth2 proxy/oauth2 proxy/v7 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/v7 fixed: 7.1.0
Upgrade github.com/oauth2-proxy/oauth2-proxy/v7 to 7.1.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/v7

How to Check if You Are Affected

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

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

Analyze the terminal output to locate any version of Github.com/oauth2 proxy/oauth2 proxy/v7 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 7.1.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-285: Improper Authorization, where the product does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action. In Github.com/oauth2 proxy/oauth2 proxy/v7, 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

The `--gitlab-group` flag for group-based authorization in the GitLab provider stopped working in the v7.0.0 release. Regardless of the flag settings, authorization wasn't restricted. Additionally, any authenticated users had whichever groups were set in `--gitlab-group` added to the new `X-Forwarded-Groups` header to the upstream application. While adding GitLab project based authorization support in #630, a bug was introduced where the user session's groups field was populated with the `--gitlab-group` config entries instead of pulling the individual user's group membership from the GitLab Userinfo endpoint. When the session groups where compared against the allowed groups for authorization, they matched improperly (since both lists were populated with the same data) so authorization was allowed. ### Impact This impacts GitLab Provider users who relies on group membership for authorization restrictions. Any authenticated users in your GitLab environment can access your applications regardless of `--gitlab-group` membership restrictions. ### Patches This is patched in v7.1.0 ### Workarounds There is no workaround for the Group membership bug. But `--gitlab-project` can be set to use Project membership as the authorization checks instead of groups; it is not broken.

CVE-2021-21411 Affected Github.com/oauth2 proxy/oauth2 proxy/v7 Versions

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

References

Frequently Asked Questions

What is CVE-2021-21411?
CVE-2021-21411 is a security vulnerability in Github.com/oauth2 proxy/oauth2 proxy/v7 involving OAuth2-Proxy's `--gitlab-group` GitLab Group Authorization config flag stopped working in v7.0.0 under CWE-285: Improper Authorization.
Which Github.com/oauth2 proxy/oauth2 proxy/v7 versions are affected?
Affected versions include releases prior to 7.1.0 across affected packages: github.com/oauth2-proxy/oauth2-proxy/v7.
What version fixes CVE-2021-21411?
Upgrading to 7.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/oauth2-proxy/oauth2-proxy/v7 affected?
Yes, github.com/oauth2-proxy/oauth2-proxy/v7 is affected in releases prior to 7.1.0. Upgrade your dependency to 7.1.0 or later.
What is the CVSS score of CVE-2021-21411?
CVE-2021-21411 has a CVSS v3.1 base score of 5.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2021-21411?
CVE-2021-21411 is classified under CWE-285: Improper Authorization (The product does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action.).
How can I check Go dependencies for CVE-2021-21411?
Run the dependency tree command: 'inspect dependencies for github.com/oauth2-proxy/oauth2-proxy/v7'. 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-652x-m2gr-hppm",
  "modified" : "2025-07-30T16:21:04Z",
  "published" : "2025-07-30T16:21:04Z",
  "aliases" : [ "CVE-2021-21411" ],
  "summary" : "OAuth2-Proxy's `--gitlab-group` GitLab Group Authorization config flag stopped working in v7.0.0",
  "details" : "The `--gitlab-group` flag for group-based authorization in the GitLab provider stopped working in the v7.0.0 release.\n\nRegardless of the flag settings, authorization wasn't restricted. Additionally, any authenticated users had whichever groups were set in `--gitlab-group` added to the new `X-Forwarded-Groups` header to the upstream application.\n\nWhile adding GitLab project based authorization support in #630, a bug was introduced where the user session's groups field was populated with the `--gitlab-group` config entries instead of pulling the individual user's group membership from the GitLab Userinfo endpoint. When the session groups where compared against the allowed groups for authorization, they matched improperly (since both lists were populated with the same data) so authorization was allowed.\n\n### Impact\nThis impacts GitLab Provider users who relies on group membership for authorization restrictions. Any authenticated users in your GitLab environment can access your applications regardless of `--gitlab-group` membership restrictions.\n\n### Patches\nThis is patched in v7.1.0\n\n### Workarounds\nThere is no workaround for the Group membership bug. But `--gitlab-project` can be set to use Project membership as the authorization checks instead of groups; it is not broken.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/oauth2-proxy/oauth2-proxy/v7"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/oauth2-proxy/oauth2-proxy/security/advisories/GHSA-652x-m2gr-hppm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21411"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/oauth2-proxy/oauth2-proxy/commit/0279fa7dff1752f1710707dbd1ffac839de8bbfc"
  }, {
    "type" : "WEB",
    "url" : "https://docs.gitlab.com/ee/user/group"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/oauth2-proxy/oauth2-proxy"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/oauth2-proxy/oauth2-proxy/releases/tag/v7.1.0"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/github.com/oauth2-proxy/oauth2-proxy/v7"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-285", "CWE-863" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-07-30T16:21:04Z",
    "nvd_published_at" : null
  }
}