CVE-2025-64175

CVE-2025-64175 is a high-severity improper authentication vulnerability in gogs.io/gogs (go), affecting versions >= 0.11.19, <= 0.13.3. It is fixed in 0.13.4.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Gogs Vulnerable to 2FA Bypass via Recovery Code

Contact OpenAI Security Research at [email protected] to engage on this report.
See PDF report for easier reading.

Security Advisory: 2FA Bypass via Recovery Code
Vulnerability Type: 2FA Authentication Bypass
Affected Software: GOGS
Severity: High
Date: Aug 5, 2025
Discoverer: OpenAI Security Research
Summary
Gogs’ 2FA recovery code validation does not scope codes by user, enabling cross-account bypass. If an attacker knows a victim’s username and password, they can use
Security Advisory_ 2FA Bypass via Recovery Code - Google Docs.pdf
any unused recovery code (e.g., from their own account) to bypass the victim’s 2FA. This enables full account takeover and renders 2FA ineffective in all environments where it's enabled.
Affected Versions
Software: Gogs
Confirmed Version(s): All versions with 2FA support
Likely Affected: All versions since introduction of UseRecoveryCode logic
Introduced Commit: a617d52374e937db0edacfba2a26bdd14a05538e
Commit: a617d52374e937db0edacfba2a26bdd14a05538e
Author: Joe Chen
Date: Apr 5, 2017
Description: 2fa: initial support

Vulnerability Details
The function UseRecoveryCode in internal/database/two_factor.go fails to check that the recovery code belongs to the authenticating user. Instead, it looks for any unused recovery code:
Vulnerable Code Snippet

func UseRecoveryCode(_ int64, code string) error {
    recoveryCode := new(TwoFactorRecoveryCode)
    has, err := x.Where("code = ?", code).And("is_used = ?", false).Get(recoveryCode)
    ...
}

Although the caller passes userID, it is ignored. The result is a global lookup for any unused code, allowing an attacker to submit their own recovery code during another user's login flow.

Call Chain

web login handler
→ UseRecoveryCode(userID, code)
→ DB query without userID constraint
Proof-of-Concept (PoC)
Description
This bug is tested against the latest version of Gogs hosted on Dockerhub. Attacker uses their own recovery code to bypass another user’s 2FA.
Steps
Create attacker account A and enable 2FA. Save a code like "abcde-fghij".
Obtain credentials for victim B.
Attempt login as B via web.
When prompted for recovery code, submit A's code.
Login as B succeeds; A's code is marked as used.

Impact
2FA rendered ineffective for all users
Realistic Exploitation Scenarios
Public Gogs instances with 2FA enabled
Developer or maintainer accounts
Enterprise self-hosted Gogs servers
Potential Impact
This vulnerability critically undermines 2FA. Since recovery codes are not globally unique and lack user scoping, any attacker with victim credentials can use one of their own recovery codes to complete login as the victim, bypassing all 2FA protections. This opens the door to account hijacking, data exfiltration, and downstream supply chain compromise.
Timeline
August 2025: Discovered via GPT5
August 2025: Reproduced and confirmed via PoC and sanitizer
Aug 6, 2025 - Sent to Gogs via https://github.com/gogs/gogs/security/advisories/new

This information is being shared by OpenAI solely for the purpose of improving security and reducing potential harm. This information is presented as-is. OpenAI Security Research makes no representations or warranties, express or implied, as to the completeness, accuracy, or fitness for any particular purpose of the information. [This includes, without limitation any suggestions or ideas presented on how to remedy or mitigate an identified vulnerability, including whether such suggestions or ideas would be effective and/or could have other negative impacts.]
OpenAI disclaims any liability for direct or indirect damages arising from the reliance on, or use, misuse, or interpretation of this information. Any references to third-party systems, services, or entities are included solely for identification purposes and do not imply endorsement, responsibility, or attribution.

Impact

The application does not adequately verify the identity of a user, device, or process before granting access. Typical impact: unauthorized access to functions or data reserved for authenticated parties.

Affected versions

gogs.io/gogs (>= 0.11.19, <= 0.13.3)

Security releases

gogs.io/gogs → 0.13.4 (go)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade gogs.io/gogs to 0.13.4 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is CVE-2025-64175? CVE-2025-64175 is a high-severity improper authentication vulnerability in gogs.io/gogs (go), affecting versions >= 0.11.19, <= 0.13.3. It is fixed in 0.13.4. The application does not adequately verify the identity of a user, device, or process before granting access.
  2. Which versions of gogs.io/gogs are affected by CVE-2025-64175? gogs.io/gogs (go) versions >= 0.11.19, <= 0.13.3 is affected.
  3. Is there a fix for CVE-2025-64175? Yes. CVE-2025-64175 is fixed in 0.13.4. Upgrade to this version or later.
  4. Is CVE-2025-64175 exploitable, and should I be worried? Whether CVE-2025-64175 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  5. What actually determines whether CVE-2025-64175 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  6. How do I fix CVE-2025-64175? Upgrade gogs.io/gogs to 0.13.4 or later.

Other vulnerabilities in gogs.io/gogs

Stop the waste.
Protect your environment with Kodem.