/

CVE-2026-20896

Severity:

CRITICAL RISK

(9.8)

Auth Header Trust Misconfig (CWE-284) in Gitea Docker

CVE-2026-20896

Deferred

Vulnerability type

Category:

Authorization Misconfiguration

CWE:

CWE-284

Impact:

Authentication Bypass and Account Impersonation

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Gitea Docker images up to 1.26.2 ship with a default setting that trusts all reverse proxies for authentication headers.

When header-based auth (e.g., X-WEBAUTH-USER) is enabled, any source IP can impersonate a user, making unauthorized account access possible in misconfigured deployments.

Affected context

This vulnerability appears in Gitea instances deployed via the official Docker images up to and including 1.26.2.

It becomes relevant when:

  • The instance is run behind a reverse proxy
  • Reverse-proxy-based authentication is enabled (e.g., X-WEBAUTH-USER, X-Forwarded-User)
  • The default REVERSE_PROXY_TRUSTED_PROXIES=* behavior is left unchanged

In such setups, the application unconditionally trusts authentication headers from any client as if they came from a trusted proxy.

Exploit preconditions

  • Attack surface: HTTP(S) interface of the Gitea instance
  • Required access: Ability to send HTTP requests directly to Gitea or via an untrusted/intermediate proxy
  • Trigger point: Requests containing reverse-proxy auth headers (e.g., X-WEBAUTH-USER) are accepted without verifying the true proxy source
  • Why exploitation is possible: The default configuration treats all IPs as trusted reverse proxies, so user identity headers are honored even when supplied by arbitrary clients

Why this happens

The core issue is an authorization control misconfiguration corresponding to CWE-284: Improper Access Control.

Instead of restricting which upstream IPs are allowed to supply trusted authentication headers, the default configuration uses a wildcard list (*) for trusted proxies.

This design choice collapses the trust boundary between the reverse proxy and arbitrary clients, causing the application to treat any request as if it came from a vetted proxy and to accept user identity headers without a reliable trust anchor.

Potential impact

  • Attackers could impersonate arbitrary users by forging reverse-proxy auth headers.
  • Administrative or privileged accounts could be accessed without valid credentials.
  • Repository data, issues, and secrets stored in Gitea can be exposed or modified.
  • Audit trails and activity logs may be falsified or polluted with spoofed user actions.
  • Downstream systems relying on Gitea's identity or permissions may be indirectly compromised.

General mitigation guidance

Mitigation centers on restoring a clear and narrow trust boundary between Gitea and reverse proxies.

Common defensive measures include:

  • Configuring a strict list of trusted proxy IPs or networks, rather than using wildcard trust.
  • Restricting or disabling header-based authentication where it is not strictly required.
  • Ensuring that identity propagation headers are only honored when requests originate from known, controlled reverse proxies.
  • Applying the principle of least privilege to service accounts and administrative users to limit damage from impersonation.
  • Using defense-in-depth controls such as network segmentation, firewall rules, or service meshes to constrain which components can reach the Gitea service.

How teams detect issues like this

Detection efforts can focus on both configuration and behavior:

  • Configuration analysis: Review Gitea and reverse proxy configurations for wildcard trusted proxies or broad trust rules around authentication headers.
  • Static checks: Use configuration linters or policy-as-code tools to flag deployments that trust all proxies or unauthenticated upstreams.
  • Log review: Inspect access logs for anomalous patterns, such as different IPs frequently impersonating many users via auth headers.
  • Security monitoring: Deploy rules in web application firewalls or IDS/IPS to detect and alert on direct client usage of headers reserved for reverse proxies.

Sources

SourceLink
blog.gitea.comblog.gitea.com/release-of-1.26.3-and-1.26.4/
github.comgithub.com/go-gitea/gitea/pull/38151
github.comgithub.com/go-gitea/gitea/releases/tag/v1.26.3
github.comgithub.com/go-gitea/gitea/security/advisories/GHSA-f75j-4cw6-rmx4

Frequently asked

questions

Yes. If the Gitea instance is reachable over the network and trusts all reverse proxies by default, an attacker can remotely send crafted requests with spoofed authentication headers.

The attacker typically only needs network access to the Gitea HTTP(S) endpoint (directly or through an untrusted proxy). No valid credentials are required if header-based authentication is trusted from arbitrary sources.

Restrict the set of trusted proxies to specific, controlled IP ranges and ensure Gitea only accepts authentication headers from those sources. Where possible, harden the deployment by removing unnecessary header-based authentication and enforcing stronger, application-level login methods.

Adopt a security-by-default posture for deployment configurations, explicitly define and document trust boundaries, and integrate configuration reviews or policy checks into CI/CD pipelines so that overly permissive defaults and wildcard trust rules are caught before reaching production.

Find out what's already
exploitable in your codebase.