A critical authentication bypass vulnerability has been demonstrated in Gitea, allowing attackers to impersonate administrators and access private repositories simply by sending one HTTP header. The flaw, assigned CVE-2026-20896 and rated 9.8 on the CVSS scale, stems from a dangerous default in the official Docker image that trusts the X-WEBAUTH-USER header from any IP address.
Root Cause and Attack Flow
Gitea supports authentication via a reverse proxy for single sign-on scenarios. When enabled, the proxy authenticates the user and passes the username in the X-WEBAUTH-USER header. The application trusts this header only from addresses listed in the REVERSE_PROXY_TRUSTED_PROXIES configuration option. In the official Docker image the default value was set to a wildcard (“*”), meaning any source could supply the header.
An attacker could therefore send a request such as:
curl -H 'X-WEBAUTH-USER: admin' http://target:3000/admin/secret-infra/raw/branch/main/.env
and immediately retrieve the contents of a private repository file containing production secrets.
Additional Related Vulnerabilities
The same pattern of broken access control appeared in several other Gitea components throughout 2026:
- CVE-2026-27771 – private container images were served anonymously through the built-in OCI registry.
- CVE-2026-22874 – an overly permissive allow-list allowed SSRF via webhooks and migrations.
- CVE-2026-28740 – authorization bypass in LFS permitted reading objects from private repositories without proper rights.
These issues affected both Gitea and its fork Forgejo, impacting tens of thousands of internet-facing instances.
Recommended Mitigations
Administrators are advised to:
- Upgrade to Gitea 1.26.4 or newer (avoid 1.26.3 due to a regression in the SSRF fix).
- Explicitly configure REVERSE_PROXY_TRUSTED_PROXIES to the IP or CIDR of the actual reverse proxy.
- Disable reverse-proxy authentication if it is not required.
- Place Gitea behind a reverse proxy or WAF and monitor logs for 200 responses to administrative paths from unexpected source IPs.
The researcher emphasizes that the incident is not an isolated coding error but a systemic problem caused by overly permissive defaults in official container images.


