CVE-2021-21291
Subdomain checking of whitelisted domains could allow unintended redirects
Also known as BIT-oauth2-proxy-2021-21291, GHSA-4mf2-f3wh-gvf2, GO-2022-0790
Mitigation
- Upgrade github.com/oauth2-proxy/oauth2-proxy/v7 to 7.0.0 or later.
Who should check
- Projects that depend on Go package github.com/oauth2-proxy/oauth2-proxy/v7 (< 7.0.0)
- Projects that depend on Go package github.com/oauth2-proxy/oauth2-proxy (<= 3.2.0)
- Anyone running oauth2-proxy < 7.0.0
Vulnerability facts
- Affected
- github.com/oauth2-proxy/oauth2-proxy/v7 < 7.0.0; github.com/oauth2-proxy/oauth2-proxy <= 3.2.0
- Fixed in
- 7.0.0
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, no login needed
- CVSS
- 4.7 (v3.1, CNA)CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:NOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: High
- Privileges required: None
- User interaction: Required
- Scope: Changed (impact reaches other components)
- Confidentiality impact: Low
- Integrity impact: Low
- Availability impact: None
- EPSS
- 1.59% chance of exploitation in 30 days (percentile 76, 2026-11-26)
- CWE
- CWE-601
- Modified
Description
OAuth2 Proxy is an open-source reverse proxy and static file server that provides authentication using Providers (Google, GitHub, and others) to validate accounts by email, domain or group. In OAuth2 Proxy before version 7.0.0, for users that use the whitelist domain feature, a domain that ended in a similar way to the intended domain could have been allowed as a redirect. For example, if a whitelist domain was configured for ".example.com", the intention is that subdomains of example.com are allowed. Instead, "example.com" and "badexample.com" could also match. This is fixed in version 7.0.0 onwards. As a workaround, one can disable the whitelist domain feature and run separate OAuth2 Proxy instances for each subdomain.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| Go github.com/oauth2-proxy/oauth2-proxy/v7 | < 7.0.0 | 7.0.0 | osv |
| Go github.com/oauth2-proxy/oauth2-proxy | <= 3.2.0 | — | osv |
| oauth2-proxy | < 7.0.0 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2021-21291. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2021-21291.md Affected: github.com/oauth2-proxy/oauth2-proxy/v7 < 7.0.0; github.com/oauth2-proxy/oauth2-proxy <= 3.2.0 Fixed in: 7.0.0 Steps: 1. Search this machine and project for github.com/oauth2-proxy/oauth2-proxy/v7 (Go), github.com/oauth2-proxy/oauth2-proxy (Go), oauth2-proxy: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
FAQ
Is CVE-2021-21291 being exploited?
There is no confirmed exploitation: CVE-2021-21291 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 1.59% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2021-21291?
Medium: CVSS 4.7 (v3.1, scored by CNA). Remote, no login needed. A user has to take an action, such as opening a link, for the attack to work. The attack needs conditions outside the attacker's control, which makes it harder.
Which versions are affected by CVE-2021-21291?
github.com/oauth2-proxy/oauth2-proxy/v7 < 7.0.0; github.com/oauth2-proxy/oauth2-proxy <= 3.2.0.
Is there a fix for CVE-2021-21291?
Yes. Fixed in 7.0.0. Upgrade github.com/oauth2-proxy/oauth2-proxy/v7 to 7.0.0 or later.
How do I check if I'm affected by CVE-2021-21291?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.