CVE-2026-25120: 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.
Published Feb 17, 2026 · Updated Feb 19, 2026
Affected packages
gogs.io/gogs
- Ecosystem
- Go
- Affected
- <= 0.13.4
- Fixed in
- 0.14.0
- Check
go list -m gogs.io/gogs
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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:
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:
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
- Two users: Alice (attacker) and Bob (victim)
- Alice is admin of
alice/attacker-repo - Bob has created an issue with a comment on
bob/victim-repo - Attacker needs to obtain the comment ID from victim's repository (e.g., ID: 42)
HTTP Request
POST /alice/attacker-repo/issues/comments/42/delete HTTP/1.1
Host: gogs.example.com
Cookie: i_like_gogs=<alice_session_token>
Credited to tenbbughunters.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Go vulnerabilities
All Go entriesCVE-2026-52800
Gogs Vulnerable to CSRF Leading to Organization Owner Takeover
high8.8Jun 23, 2026CVE-2026-52801
Gogs has the ability to import local repositories via Mirror Settings
high8.1Jun 23, 2026CVE-2026-52802
Gogs has an Open Redirect via redirect_to
medium5.4Jun 23, 2026CVE-2026-52804
Gogs Vulnerable to Privilege Escalation via Collaboration Access Mode Validation
medium5.5Jun 23, 2026CVE-2026-52805
Gogs has a Migration Redirect Bypass that Leads to Internal Repository Theft
high8.7Jun 23, 2026CVE-2026-52806
Gogs vulnerable to RCE via git rebase --exec argument injection in pull request merge
critical9.9Jun 23, 2026
