Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-52804 — gogs

⚪ Unknown ✅ No Known Exploit CWE-193 NVD
N/A
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Gogs Vulnerable to Privilege Escalation via Collaboration Access Mode Validation

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

```

5. 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 {

```

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs administrative privileges on the target. No user interaction is required. Rated impact: confidentiality none, integrity high, availability high.

CVSS metrics in full

The score comes from this vector: 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

  • Attack vector: Network — reachable from anywhere that can route to the service.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Attack requirements: None — no deployment-specific condition has to hold.
  • Privileges required: High — administrative rights are needed first.
  • User interaction: None — nobody has to be tricked into anything.
  • Confidentiality impact: None.
  • Integrity impact: High — total loss, or loss the attacker controls.
  • Availability impact: High — total loss, or loss the attacker controls.

Weakness class

CVE-2026-52804 is classified as CWE-193: Off-by-one Error. A product calculates or uses an incorrect maximum or minimum value that is 1 more, or 1 less, than the correct value.

Affected software

CVE-2026-52804 is recorded against 2 packages.

  • gogs.io/gogs
  • unknown

Timeline and source

Published on 25 June 2026 and last revised on 21 July 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

github.com (Advisory)
github.com (Web)
github.com (Web)
github.com (Web)

Other advisories for this package

gogs.io/gogs has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-193: Off-by-one Error) in other software:

Details

Severity Unknown
CVSS Score N/A
CVSS Vector 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
CWE CWE-193
Public Exploit ✅ No
Source NVD
Published 2026-06-25
Updated 2026-08-20
Modified 2026-07-21
Fix URL N/A

Affected Packages

Software From version Fixed in
gogs.io/gogs
unknown

Similar Threats

Free Vulnerability Check

Is your site affected by CVE-2026-52804?

BotEraser helps you identify potentially vulnerable plugins and themes by checking your installation against CVE-2026-52804 and other known CVE records.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026