Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-25120 — gogs

🟢 CVSS 2.7 — Low ⚠️ Exploit Public CWE-639 NVD
2.7
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Gogs Allows Cross-Repository Comment Deletion via DeleteComment

# IDOR: Cross-Repository Comment Deletion via DeleteComment

Summary

The POST /:owner/:repo/issues/comments/:id/delete endpoint does not verify that the comment belongs to the repository specified in the URL. This allows a repository administrator to delete comments from any other repository by supplying arbitrary comment IDs, bypassing authorization controls.

Vulnerability Details

| Field | Value |

|-------|-------|

| Affected File | internal/route/repo/issue.go |

| Affected Function | DeleteComment (lines 955-968) |

| Secondary File | internal/database/comment.go |

| Secondary Function | DeleteCommentByID (lines 505-520) |

Root Cause

The vulnerability exists due to insufficient authorization validation in the comment deletion flow:

1. Missing Repository Ownership Check in DeleteComment

In internal/route/repo/issue.go, the function retrieves a comment by ID without verifying repository ownership:

```go

func DeleteComment(c *context.Context) {

comment, err := database.GetCommentByID(c.ParamsInt64(":id"))

if err != nil {

c.NotFoundOrError(err, "get comment by ID")

return

}

// Only checks if user is comment poster OR admin of the CURRENT repo (from URL)

if c.UserID() != comment.PosterID && !c.Repo.IsAdmin() {

c.NotFound()

return

} else if comment.Type != database.CommentTypeComment {

c.Status(http.StatusNoContent)

return

}

// No verification that comment.IssueID belongs to c.Repo.Repository.ID!

if err = database.DeleteCommentByID(c.User, comment.ID); err != nil {

c.Error(err, "delete comment by ID")

return

}

c.Status(http.StatusOK)

}

```

2. Database Layer Performs No Authorization

In internal/database/comment.go, the deletion function performs no repository validation:

```go

func DeleteCommentByID(doer *User, id int64) error {

comment, err := GetCommentByID(id)

if err != nil {

if IsErrCommentNotExist(err) {

return nil

}

return err

}

// Directly deletes without checking repository ownership

sess := x.NewSession()

defer sess.Close()

if err = sess.Begin(); err != nil {

return err

}

if _, err = sess.ID(comment.ID).Delete(new(Comment)); err != nil {

// ...

}

// ...

}

```

Proof of Concept

Prerequisites

1. Two users: Alice (attacker) and Bob (victim)

2. Alice is admin of alice/attacker-repo

3. Bob has created an issue with a comment on bob/victim-repo

4. Attacker needs to obtain the comment ID from victim's repository (e.g., ID: 42)

HTTP Request

```http

POST /alice/attacker-repo/issues/comments/42/delete HTTP/1.1

Host: gogs.example.com

Cookie: i_like_gogs=<alice_session_token>

```

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. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality none, integrity low, availability none.

CVSS metrics in full

The score comes from this vector: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:L/A:N

  • Attack vector: Network — reachable from anywhere that can route to the service.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Privileges required: High — administrative rights are needed first.
  • User interaction: None — nobody has to be tricked into anything.
  • Scope: Unchanged — the damage stays inside the vulnerable component.
  • Confidentiality impact: None.
  • Integrity impact: Low — limited, and the attacker does not choose what is affected.
  • Availability impact: None.

Weakness class

CVE-2026-25120 is classified as CWE-639: Authorization Bypass Through User-Controlled Key. An object is selected by an identifier from the request without checking the caller owns it.

Affected software

CVE-2026-25120 is recorded against 2 packages.

  • gogs (fixed in 0.14.0)
  • gogs.io/gogs

Timeline and source

Published on 19 February 2026 and last revised on 17 June 2026. A public exploit is known to exist, which raises the urgency of patching considerably. A vendor advisory or fix has been published. Record sourced from NVD.

References

github.com
github.com

Other advisories for this package

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-639: Authorization Bypass Through User-Controlled Key) in other software:

Details

Severity LOW
CVSS Score 2.7
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:L/A:N
CWE CWE-639
Public Exploit ⚠️ Yes
Source NVD
Published 2026-02-19
Updated 2026-08-20
Modified 2026-06-17

Affected Packages

Software From version Fixed in
gogs 0.14.0
gogs.io/gogs

Similar Threats

Exploit Protection

Are you running gogs?

CVE-2026-25120 carries CVSS 2.7 Low rating and a public exploit already exists. BotEraser checks your installation against this and other known CVE records, and blocks IPs associated with exploit activity.

Check My Site For CVE-2026-25120 →

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