Feb 6, 2026·5 min read·68 visits
Gogs failed to verify ownership of 2FA recovery codes. An attacker with your password can log in to your account using *their* recovery codes. Patch to 0.13.4 immediately.
A critical logic error in the Gogs self-hosted Git service allows attackers to bypass Two-Factor Authentication (2FA) by using recovery codes belonging to a different account. If an attacker possesses a victim's primary credentials (username/password), they can successfully authenticate as the victim by supplying a recovery code generated from an account they control. This effectively neutralizes the 2FA protection layer, turning a credential leak into a full account takeover.
We often treat Two-Factor Authentication (2FA) like a magic shield. You lose your password in a breach? No problem, the hacker doesn't have your phone or your YubiKey. You're safe. But in software engineering, security features are only as good as the logic implementing them. In the case of Gogs, a popular self-hosted Go Git service, that logic was flawed in the most comedic way possible.
Imagine a bank vault that requires a key to open. You show up, claiming to be the owner of Vault 101. The guard asks for your key. You hand them the key to your own house. The guard looks at the key, checks a list, and says, "Yep, that's a valid key that exists in the world," and opens Vault 101 for you. That is exactly what is happening here.
CVE-2025-64175 isn't a complex memory corruption bug or a mathematical break in cryptography. It's a fundamental logic error where the application forgot to ask whose key was being used.
The root cause resides in the authentication flow for recovery codes. When a user loses access to their TOTP app (like Google Authenticator), they can use a one-time recovery code. The backend needs to verify two things: 1) Is this code valid and unused? 2) Does this code belong to the user trying to log in?
Gogs nailed the first part and completely ghosted the second. In the internal/db/two_factor.go file (or models in older structures), the function responsible for validating the code accepted a userID, but—and this is the kicker—it explicitly ignored it.
The database query was constructed to search the entire two_factor_recovery_code table for a matching string. If it found any row in the table that matched the code provided by the attacker, it returned success. It didn't matter if that code belonged to the admin, a random user, or the attacker themselves.
Let's look at the Go code that caused this mess. In Go, the underscore _ is used as a blank identifier to ignore values. Usually, this is fine for unused return values. Here, it was used on the input argument userID. That should have been the first red flag during code review.
Vulnerable Code:
// UseRecoveryCode validates recovery code of given user and marks it is used if valid.
func UseRecoveryCode(_ int64, code string) error {
recoveryCode := new(TwoFactorRecoveryCode)
// CRITICAL BUG: No filter for user_id!
// It only checks if the code string exists and hasn't been used yet.
has, err := x.Where("code = ?", code).And("is_used = ?", false).Get(recoveryCode)
if err != nil {
return fmt.Errorf("get unused code: %v", err)
} else if !has {
return ErrTwoFactorRecoveryCodeNotFound{Code: code}
}
// ... marks code as used and returns success
}See the _ int64? That's the function saying, "I'm taking a User ID, but I promise not to look at it." The ORM query x.Where("code = ?", code) scans the global table. Since recovery codes are often random strings, collisions are rare, but that's irrelevant here. The attacker doesn't need to guess your code; they just need to provide a valid code that the database knows about.
To exploit this, an attacker needs two things: the victim's password (easy enough via phishing, credential stuffing, or reuse) and an account on the same Gogs instance (also easy if registration is open, or if the attacker is a rogue insider/contractor).
Here is the kill chain:
deadbeef-1337.deadbeef-1337 (their own code).deadbeef-1337 a valid, unused code?" The DB replies "Yes". The system logs the attacker into the victim's session.The attacker has now bypassed the 2FA protection entirely. The system marks the attacker's recovery code as used, which is a small price to pay for full admin access.
This is a "High" severity issue for a reason. Gogs is used to host source code. If an attacker compromises a developer's account, they don't just steal data; they can modify it.
With this bypass, an attacker can:
Since this bypass requires the primary password, it effectively downgrades the security of 2FA-enabled accounts to that of 1FA accounts. If your password leaked, your 2FA saves you. With CVE-2025-64175, it doesn't.
The remediation is straightforward: actually use the userID that was passed to the function. The developers patched this in version 0.13.4 (and 0.14.0+dev) by adding a constraint to the query.
Patched Code:
func (db *twoFactors) UseRecoveryCode(ctx context.Context, userID int64, code string) error {
return db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
var recoveryCode TwoFactorRecoveryCode
// FIX: Added "user_id = ?"
err := tx.Where("user_id = ? AND code = ? AND is_used = ?", userID, code, false).First(&recoveryCode).Error
// ...
})
}If you are running a self-hosted Gogs instance, you must upgrade immediately. If you cannot upgrade, disable open registration to prevent attackers from easily creating accounts to generate recovery codes, though this won't stop insider threats.
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N| Product | Affected Versions | Fixed Version |
|---|---|---|
Gogs Gogs | < 0.13.4 | 0.13.4 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-287 (Improper Authentication) |
| CVSS v4.0 | 7.7 (High) |
| Attack Vector | Network |
| Attack Complexity | Low |
| Privileges Required | Low (Any valid account on instance) |
| Impact | Full Account Takeover |
CVE-2026-114155 is a local elevation of privilege vulnerability affecting Microsoft .NET on Linux and macOS platforms. The vulnerability exists within the dotnet-watch (Hot Reload) component and is caused by a Time-of-Check Time-of-Use (TOCTOU) race condition (CWE-367) during the generation and execution of temporary XML solution files (.slnx) in shared system temporary directories. A local attacker with low privileges can intercept and modify the temporary solution file before MSBuild evaluates it, achieving arbitrary code execution in the security context of the user running dotnet-watch.
CVE-2026-118748 is a remote Denial of Service (DoS) vulnerability in Microsoft ASP.NET Core (.NET 11.0 preview releases prior to 11.0.0) and Microsoft Visual Studio 2026 (prior to 18.12.0). The flaw originates from unbounded resource allocation (CWE-770) within the Blazor static server-side rendering (static-SSR) validation pipeline, where dynamic or attacker-supplied form field identifiers are cached in a singleton-scoped memory structure without size limits or eviction policies. Unauthenticated remote attackers can exploit this condition over the network by sending repeated HTTP requests with unique field names, exhausting heap memory and terminating the host process via an unhandled OutOfMemoryException.
CVE-2026-114150 is a network-accessible information disclosure vulnerability affecting Microsoft ASP.NET Core in .NET 11.0 preview releases and Microsoft Visual Studio 2026 prior to version 18.12.0. The flaw stems from the use of uninitialized resources (CWE-908) within response buffering components, specifically ResponseBufferingStream used by middleware such as HTTP Logging and Output Caching. Because rented memory segments from ArrayPool<byte> or MemoryPool<byte> are not cleared upon return or strictly bounded to the exact written byte count during subsequent reads, residual response payloads from earlier HTTP requests remain in the buffer tail. Downstream consumers or log sinks reading these buffers expose confidential cross-session data, including authentication tokens and personally identifiable information.
An incorrect authorization vulnerability (CWE-863) exists in the ASP.NET Core SignalR HTTP Connection Dispatcher (`Microsoft.AspNetCore.Http.Connections`). The connection negotiation process failed to bind the authenticated caller identity to the generated connection state, and subsequent transport or message dispatch handlers failed to verify caller consistency. Consequently, an authenticated low-privilege attacker who obtains a valid connection identifier or token can inject messages into or hijack another user's SignalR session, achieving an elevation of privilege across security boundaries.
CVE-2026-109478 is a network-accessible Denial of Service (DoS) vulnerability in ASP.NET Core caused by inefficient algorithmic complexity (CWE-407) when parsing comma-separated HTTP request headers. Prior to the patch, the internal helper method ParsingHelpers.GetHeaderSplit repeatedly called StringValues.Concat inside a loop iterating over each comma-separated token. Because StringValues allocates a new array of size k + 1 and copies all existing elements upon each concatenation, processing N tokens incurs O(N^2) time and space complexity. An unauthenticated remote attacker can send HTTP requests with headers containing thousands of short, comma-separated values to exhaust CPU cycles and induce severe Garbage Collection (GC) pauses, rendering the web application unresponsive.
CVE-2026-114147 is a high-severity Denial of Service (DoS) vulnerability affecting ASP.NET Core and specifically the Microsoft.AspNetCore.SignalR.StackExchangeRedis scale-out provider across .NET 8.0, 9.0, 10.0, and 11.0 preview releases. The vulnerability originates from a string comparison mismatch between internal per-connection group collections and the centralized Redis channel subscription registry, compounded by a race condition during connection teardown. Remote unauthenticated attackers can exploit this flaw to leave orphaned connection contexts and active Redis pub/sub listeners pinned in memory, leading to unbounded memory exhaustion and application process termination.