HIGH 7.1

CVE-2026-20779: Gitea TOTP Reuse Vulnerability (2FA Bypass)

Gitea, a popular self-hosted Git service, contains a flaw in its two-factor authentication (2FA) system that allows attackers to reuse the same time-based one-time password (TOTP) code multiple times. Instead of invalidating a code after first use, the vulnerability permits a valid code to work across different authentication sessions and through multiple access methods. An attacker who obtains a valid TOTP code—through phishing, shoulder surfing, or other means—can leverage it repeatedly before it naturally expires, effectively bypassing the single-use guarantee that 2FA is designed to enforce. This affects Gitea versions 1.5.0 through 1.26.2.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.1 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N
Weaknesses (CWE)
CWE-294
Affected products
0 configuration(s)
Published / Modified
2026-07-03 / 2026-07-07

NVD description (verbatim)

Gitea versions from 1.5.0 before 1.26.3 have a TOTP single-use enforcement defect that allows a valid TOTP code to be accepted more than once across web two-factor authentication flows and the Basic Auth X-Gitea-OTP path.

5 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

CVE-2026-20779 is a TOTP enforcement defect in Gitea's authentication layer. The vulnerability stems from a logic flaw in how the application validates one-time passwords during web-based 2FA flows and the Basic Authentication header path (X-Gitea-OTP). Instead of generating a one-time password enforcement state that persists across authentication attempts, the system accepts the same TOTP code multiple times within its validity window. The issue spans both the primary web interface and the API authentication mechanism, meaning an attacker can use a single intercepted or observed TOTP code to authenticate as the target user through either pathway. The underlying weakness is classified under CWE-294 (Authentication Using a Known Password), reflecting that the 2FA control fails to enforce non-reusability.

Business impact

Self-hosted Gitea instances serve as critical version control and collaboration platforms for many organizations. If a threat actor gains knowledge of a valid TOTP code through interception or observation, they can authenticate as the compromised user without needing the original password or subsequent valid codes. This undermines the security posture of organizations relying on Gitea for code repository access, potentially enabling unauthorized code commits, repository tampering, secret exfiltration, or supply chain attacks. For development teams and enterprises using Gitea internally, this vulnerability directly increases account takeover risk and reduces the protective value of 2FA deployments.

Affected systems

Gitea versions 1.5.0 through 1.26.2 are vulnerable. Organizations running Gitea should determine their deployed version immediately. The issue does not affect Gitea 1.26.3 or later. Self-hosted instances are the primary exposure vector; SaaS offerings managed by third parties depend on the specific version the provider runs.

Exploitability

The vulnerability requires user interaction (UI/R in the CVSS vector) in the sense that an attacker must obtain a valid TOTP code, but exploitation itself is straightforward once a code is acquired. No authentication or special privileges are required—any attacker with access to a valid code can authenticate. The attack surface is broad because TOTP codes can be captured through phishing, network sniffing on unencrypted channels, device compromise, or social engineering. The network-accessible nature of Gitea instances (AV:N) and low attack complexity (AC:L) make this practical for remote attackers.

Remediation

Upgrade affected Gitea instances to version 1.26.3 or later as soon as feasible. The patch corrects the TOTP validation logic to enforce true single-use semantics. Prior to patching, organizations should monitor for suspicious authentication patterns, particularly multiple successful logins using the same TOTP window, and consider temporarily restricting Gitea access to trusted networks or IP ranges if operational constraints allow.

Patch guidance

Gitea administrators should consult the official Gitea release notes and security advisories to confirm patch availability and compatibility with their current deployment. Version 1.26.3 and subsequent releases incorporate the fix. Test the upgrade in a non-production environment first to validate compatibility with custom configurations or integrations. Deployment method (Docker, binary, package manager) will influence the specific upgrade procedure; follow the method appropriate to your installation.

Detection guidance

Monitor authentication logs for repeated successful TOTP authentications from the same user within short time intervals or from disparate IP addresses using the same TOTP timestamp. Implement alerting if a TOTP code successfully authenticates more than once. Audit API access logs (specifically requests bearing the X-Gitea-OTP header) alongside web login logs to correlate unusual patterns. Check for unexpected commits, repository modifications, or administrative actions by user accounts, which may indicate account compromise. Organizations with centralized logging should correlate Gitea logs with endpoint detection and response (EDR) telemetry to identify secondary indicators of compromise.

Why prioritize this

This vulnerability rates HIGH (CVSS 7.1) because it directly degrades a fundamental security control—two-factor authentication—affecting confidentiality and integrity. The network-accessible nature, absence of special privileges, and broad applicability across Gitea user bases make prioritization essential. However, it is not CRITICAL because authentication still requires a valid TOTP code (an attacker cannot authenticate without one), and the impact is limited to a single user's account per compromised code, not systemic code execution or data availability loss. Organizations should patch within days, not weeks.

Risk score, explained

The CVSS 3.1 score of 7.1 reflects: (1) Network-accessible vector (AV:N)—Gitea is typically internet-facing; (2) Low attack complexity (AC:L)—exploiting the flaw requires no special setup beyond obtaining a code; (3) No privileges required (PR:N)—any attacker with a valid code can authenticate; (4) User interaction (UI:R)—an attacker must acquire a TOTP code through observation or interception; (5) High confidentiality impact (C:H)—a compromised account grants access to potentially sensitive repositories; (6) Low integrity impact (I:L)—the attacker can modify repositories but impact is scoped to a single account; (7) No availability impact (A:N)—the vulnerability does not degrade system availability. The score appropriately reflects a serious authentication bypass that is neither the most severe nor trivial in the vulnerability landscape.

Frequently asked questions

Does this vulnerability allow unauthenticated access to Gitea?

No. An attacker must possess a valid TOTP code to exploit this flaw. The vulnerability allows a single code to be reused, not to bypass authentication entirely. An attacker cannot log in without knowing the account password and obtaining a valid TOTP code.

Can I mitigate this before upgrading?

Partial mitigations include: restricting Gitea network access to trusted IP ranges or a VPN, disabling 2FA temporarily if operationally feasible (though this weakens security further), and intensifying monitoring of authentication logs for anomalies. None of these substitute for the official patch; they are temporary risk reduction measures only.

Does this affect Gitea Cloud or only self-hosted instances?

This vulnerability applies to self-hosted Gitea deployments. If your Gitea Cloud provider runs version 1.26.3 or later, you are protected. Consult your provider's security advisories and deployment version to confirm status.

What is the difference between the web 2FA flow and the Basic Auth X-Gitea-OTP path?

The web flow is the standard browser-based login interface where users enter their TOTP code after username and password. The X-Gitea-OTP path allows API clients and tools (such as Git CLI) to authenticate using a custom HTTP header instead of a separate interactive prompt. Both paths were affected by the same reuse vulnerability in affected versions.

This analysis is provided for informational purposes and reflects the vulnerability details available as of the publication date. Vendors and products listed are based on available source data; absence from this summary does not guarantee non-affection. Organizations should verify patch availability and applicability to their specific deployment with official vendor advisories. No exploit code or proof-of-concept instructions are provided. Security teams should test patches in non-production environments before deployment. This vulnerability is not listed on the CISA Known Exploited Vulnerabilities catalog as of the analysis date, but that status may change. Source: NVD (public-domain), retrieved 2026-08-12. Analysis generated by SEC.co (claude-haiku-4-5).