🇰🇷 한글 설명
OAuth2-Proxy 7.13.0 이전 버전에서 HTTP 헤더의 언더스코어 변형을 이용하여 X-Forwarded-* 헤더 필터링을 우회할 수 있는 취약점입니다. Django, Flask, FastAPI 등의 WSGI 기반 프레임워크를 사용하는 업스트림 애플리케이션에서 인증된 공격자가 권한 상승을 수행할 수 있습니다.
💡 쉬운 설명
OAuth2-Proxy가 HTTP 헤더를 검증할 때 X-Forwarded-For 대신 X_Forwarded_For 같은 변형을 제대로 감지하지 못합니다. 공격자가 이를 악용하여 업스트림 애플리케이션에서 권한을 높일 수 있습니다.
🇺🇸 원문 (English)
OAuth2-Proxy is an open-source tool that can act as either a standalone reverse proxy or a middleware component integrated into existing reverse proxy or load balancer setups. In versions prior to 7.13.0, all deployments of OAuth2 Proxy in front of applications that normalize underscores to dashes in HTTP headers (e.g., WSGI-based frameworks such as Django, Flask, FastAPI, and PHP applications). Authenticated users can inject underscore variants of X-Forwarded-* headers that bypass the proxy’s filtering logic, potentially escalating privileges in the upstream app. OAuth2 Proxy authentication/authorization itself is not compromised. The problem has been patched with v7.13.0. By default all specified headers will now be normalized, meaning that both capitalization and the use of underscores (_) versus dashes (-) will be ignored when matching headers to be stripped. For example, both `X-Forwarded-For` and `X_Forwarded-for` will now be treated as equivalent and stripped away. For those who have a rational that requires keeping a similar looking header and not stripping it, the maintainers introduced a new configuration field for Headers managed through the AlphaConfig called `InsecureSkipHeaderNormalization`. As a workaround, ensure filtering and processing logic in upstream services don't treat underscores and hyphens in Headers the same way.
📍 영향받는 시스템
OAuth2-Proxy < 7.13.0 (Django, Flask, FastAPI, PHP 애플리케이션 프록시)
⚔️ 공격 벡터
X-Forwarded-* 헤더를 언더스코어 형식으로 변조(예: X_Forwarded_User)하여 프록시의 헤더 필터링 로직 우회
🛡️ 대응 방법
OAuth2-Proxy를 7.13.0 이상으로 업그레이드하거나, InsecureSkipHeaderNormalization 설정이 필요한 경우 별도 구성
🔧 검증 코드
Version 항목이 7.13.0 이상이면 안전하고, 그 이하이거나 패키지가 없으면 취약함
pip show oauth2-proxy 2>/dev/null | grep Version