CVE-2021-21291: oauth2-proxy Subdomain Redirect Vulnerability
Summary
CVE-2021-21291: Subdomain checking of whitelisted domains could allow unintended redirects in oauth2-proxy. Affects github.com/oauth2-proxy/oauth2-proxy/v7 versions < 7.0.0. Fixed in 7.0.0. How to fix ↓
Also tracked for
- github.com/oauth2-proxy/oauth2-proxy · Go
- oauth2-proxy · Bitnami
The same CVE-2021-21291 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
oauth2-proxy is an open-source reverse proxy and authentication middleware that provides authentication and authorization for web applications. It is written in Go and is commonly used to protect applications with OAuth2 providers. This vulnerability affects versions 0 to 3.2.0 of the oauth2-proxy package.
Vulnerability Detail
The subdomain checking of whitelisted domains in oauth2-proxy could allow unintended redirects. When using the whitelist domain feature, a domain that ends in a similar way to the intended domain could be allowed as a redirect. For example, if a whitelist domain is configured for .example.com, the intention is to allow subdomains of example.com. However, example.com and badexample.com could also match. This could lead to unauthorized redirects and potential security risks.
How To Fix
Latest published version: v7.15.5 as of 23 Oct 2026
go get github.com/oauth2-proxy/oauth2-proxy/v7@v7.15.5
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
7.0.0
This is the first release that contains the fix.
go get github.com/oauth2-proxy/oauth2-proxy/v7@v7.0.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading to the fixed version is not possible, users can disable the whitelist domain feature in oauth2-proxy. Additionally, running separate instances of OAuth2 Proxy for each subdomain can help mitigate the risk of unintended redirects.
Conclusion
The oauth2-proxy package is vulnerable to a subdomain redirect issue that could allow unintended redirects. Users are advised to upgrade to the fixed version or apply the provided workarounds to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for github.com/oauth2-proxy/oauth2-proxy/v7 →
FAQ
oauth2-proxy is a reverse proxy and authentication middleware that provides authentication and authorization for web applications using OAuth2 providers.
Versions 0 to 3.2.0 of the oauth2-proxy package are affected by this vulnerability.
The vulnerability allows unintended redirects in oauth2-proxy, potentially leading to unauthorized access or phishing attacks.
Upgrade to version 7.0.0 or later of the oauth2-proxy package. Alternatively, disable the whitelist domain feature and run separate instances of OAuth2 Proxy for each subdomain.
Yes, you can disable the whitelist domain feature in oauth2-proxy and run separate instances for each subdomain.
References
Related vulnerabilities
Recent vulnerabilities recorded for github.com/oauth2-proxy/oauth2-proxy/v7.