Skip to main content

Gogs EUVDEUVD-2026-39072

| CVE-2026-52804 MEDIUM
Off-by-one Error (CWE-193)
2026-06-23 https://github.com/gogs/gogs GHSA-4565-r4x7-hg8j
5.5
CVSS 4.0 · Vendor: https://github.com/gogs/gogs
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Obtain admin collaborator grant on target repository
  2. Delivery
    Authenticate to Gogs web interface
  3. Exploit
    POST mode=4 to collaboration access_mode route
  4. Execution
    Off-by-one check passes mode=4 as valid
  5. Persist
    Database persists owner-level access in access table
  6. Impact
    Execute owner-only operations (delete repository or transfer ownership)

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Off-by-one prevention
Exploitation Conditions

Exploitation requires the attacker to already hold admin collaborator access (AccessModeAdmin=3) explicitly granted by the repository owner - Gogs installations with no admin-level collaborators are not at risk from this vulnerability. The attacker must be authenticated to the Gogs instance and must use the web interface route (/settings/collaboration/access_mode); the API endpoint is unaffected in all versions due to its use of ParseAccessMode(). Exploitation is scoped to individual repositories where the attacker has been invited as an admin collaborator and does not provide instance-wide access or affect other repositories. What limits exploitation: the attacker cannot self-grant initial collaborator access through this vulnerability, making it entirely dependent on a prior trust decision by the repository owner.

Impact

No NVD CVSS score is available at time of analysis; my independently assessed score of CVSS 3.1 8.8 (High) reflects network exploitability with a low-privilege prerequisite. The critical limiting factor is that exploitation requires the attacker to already hold an explicitly granted admin collaborator role on the target repository - it is not a zero-privilege or unauthenticated attack. However, once that prerequisite is satisfied, exploitation is mechanically trivial: a single crafted HTTP POST with mode=4 is sufficient, with no additional attack complexity. The persistence of escalated privileges via the access table update is a significant risk amplifier, as it survives session termination. No EPSS score or CISA KEV listing is present in the available intelligence, indicating no confirmed widespread active exploitation at time of analysis. The advisory provides step-by-step reproduction instructions, which lower the skill threshold considerably for any attacker already holding admin access to a repository. The fix is more architecturally comprehensive than a one-line correction - it redesigns the function signature to enforce actor-bound privilege grants - suggesting the original code had a broader design assumption flaw beyond the single boundary check.

Exploit ScenarioDerived

An attacker who has been legitimately granted admin collaborator access (mode=3) to a private Gogs repository authenticates to the instance and sends a single crafted HTTP POST to /{owner}/{repo}/settings/collaboration/access_mode?uid={their_own_uid}&mode=4. The faulty boundary check passes mode=4 as valid, the database writes owner-level access to both the collaboration record and the persistent access table, and the attacker immediately gains access to the repository Danger Zone - enabling them to delete the repository or transfer ownership to an account they control. No special tooling beyond a browser or curl is required.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.5% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 23, 2026

Privilege escalation in Gogs versions prior to 0.14.3 allows repository admin collaborators to elevate their own access to owner-level by exploiting an off-by-one boundary check in the ChangeCollaborationAccessMode function. The web route accepts a raw integer mode query parameter, and the faulty guard mode > AccessModeOwner evaluates to false when mode equals 4, letting an admin (mode=3) POST mode=4 to silently receive full owner privileges - including the ability to delete the repository, transfer ownership, and erase wiki data. No public exploit identified at time of analysis, though the advisory includes complete reproduction steps that function as a de facto proof of concept.

RemediationAI

Upgrade Gogs to version 0.14.3 or later, which resolves the issue via commit 1fdc9cc28e159135cfa4d6b11ecd5daa0f8ce22b and PR #8227 (https://github.com/gogs/gogs/pull/8227). The patch corrects the validation bound from AccessModeOwner to AccessModeAdmin and introduces actor-bound enforcement so no collaborator can grant a privilege level exceeding their own. If immediate upgrade is not possible, administrators should audit the collaboration and access database tables for any rows where mode=4 is set for non-owner user accounts, which would indicate prior exploitation; any such rows should be corrected manually. As a compensating control, restrict or remove admin-level collaborator grants to only the most trusted users, since exploitation requires holding that role. Blocking the web route /{owner}/{repo}/settings/collaboration/access_mode at the network perimeter or reverse proxy is a high-friction but effective mitigation with the trade-off of disabling the collaboration management UI entirely. The API endpoint requires no mitigation.

Affected VersionsENISA

gogs < 0.14.3

Affected Packages

go gogs.io/gogs fix: 0.14.3
euvd gogs fix: 0.14.3

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in go, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Gogs is a self-hosted Git service written in Go (CPE: pkg:go/gogs.io/gogs). The root cause is CWE-193 (Off-by-One Error) in internal/database/repo_collaboration.go. The access mode enumeration is an integer sequence: AccessModeNone=0, AccessModeRead=1, AccessModeWrite=2, AccessModeAdmin=3, AccessModeOwner=4. The validation guard mode > AccessModeOwner was intended to reject the owner value (4) but uses strict greater-than instead of greater-than-or-equal, so the check 4 > 4 evaluates to false and the value passes. The web route handler in internal/route/repo/setting.go deserializes the mode directly from the URL query string as a raw integer with no further sanitization, making the attack a single crafted POST. The API route is unaffected because it routes through ParseAccessMode(), which maps string labels to only Read, Write, or Admin - never Owner. The fix in v0.14.3 (PR #8227, commit 1fdc9cc) corrects the bound to mode > AccessModeAdmin and adds an actor-bound parameter so no actor can grant a level exceeding their own.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/gogs/gogs) PRIMARY 5.5 MEDIUM
CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N/E:P
vuln.today AI 8.8 HIGH

Network-exploitable via HTTP POST with PR:L because an existing admin collaborator role is required; high C/I/A because owner access enables full repository deletion and data destruction.

3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
4.0 AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
SUSE MEDIUM

Primary rating from Vendor (https://github.com/gogs/gogs).

CVSS VectorVendor: https://github.com/gogs/gogs

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
High
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

1
CVSS changed
Jun 24, 2026 - 21:22 NVD
5.5 (MEDIUM)

DescriptionCVE.org

Summary

A repository admin collaborator can escalate their privileges to owner-level access by exploiting an off-by-one error in the ChangeCollaborationAccessMode function.

Vulnerable Code

In internal/database/repo_collaboration.go, line 129:

go
func (r *Repository) ChangeCollaborationAccessMode(userID int64, mode AccessMode) error {
    // Discard invalid input
    if mode <= AccessModeNone || mode > AccessModeOwner {
        return nil
    }

AccessModeOwner has value 4. The check mode > AccessModeOwner evaluates to 4 > 4 = false, allowing AccessModeOwner to pass through. The correct check should be mode >= AccessModeOwner.

The web route at internal/route/repo/setting.go:413-416 takes the mode as a raw integer from query parameters:

go
func ChangeCollaborationAccessMode(c *context.Context) {
    if err := c.Repo.Repository.ChangeCollaborationAccessMode(
        c.QueryInt64("uid"),
        database.AccessMode(c.QueryInt("mode"))); err != nil {

This allows an admin collaborator to POST mode=4 and escalate to owner.

Impact

A repository admin collaborator (AccessModeAdmin = 3) can escalate to owner-level access (AccessModeOwner = 4), gaining the ability to:

  • Delete the repository
  • Transfer repository ownership to another user
  • Erase wiki data
  • Perform all other owner-only operations

The access table is also updated (line 181), so the escalated permissions persist across sessions.

Contrast

The API route at internal/route/api/v1/repo_collaborators.go:46 uses ParseAccessMode() which only returns Read, Write, or Admin - never Owner. The API endpoint is not affected.

Steps to Reproduce

  1. User A creates a private repository
  2. User A adds User B as a collaborator with Admin access (mode=3)
  3. User B logs in and navigates to the repository settings collaboration page
  4. User B sends a POST request:
   POST /{owner}/{repo}/settings/collaboration/access_mode?uid={B_uid}&mode=4
  1. User B now has Owner access - the "Danger Zone" section appears with "Delete This Repository" and "Transfer Ownership" buttons

Suggested Fix

Change the validation in internal/database/repo_collaboration.go line 129 from:

go
if mode <= AccessModeNone || mode > AccessModeOwner {

to:

go
if mode <= AccessModeNone || mode >= AccessModeOwner {

Threat Intelligence Overview

EPSS Score
0.5%
Top 61% exploitable
Prevalence
Low
niche self-hosted Git service with smaller footprint than Gitea or GitLab
Threat Intel
1
1 source
Data Quality
5 sources
Confidence: Medium
EUVD NVD CVE.org EPSS GHSA Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.5%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

28
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +28
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Privilege escalation occurs when an attacker leverages flaws in access control mechanisms to gain permissions beyond what they were originally granted.

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
SUSE Linux Enterprise Server 16.1 Affected
SUSE Linux Enterprise Server for SAP applications 16.1 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP5 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP6 Affected
openSUSE Leap 15.5 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy