CVE-2026-25229: Gogs Authorization Bypass Allows Cross-Repository Label Modification

Published Feb 17, 2026
·
Updated

Summary A broken access control vulnerability in Gogs allows authenticated users with write access to any repository to modify labels belonging to other repositories. The UpdateLabel function in the Web UI (internal/route/repo/issue.go) fails to verify that the label being modified belongs to the repository specified in the URL path, enabling cross-repository label tampering attacks.

Details The vulnerability exists in the Web UI's label update endpoint POST /:username/:reponame/labels/edit. The handler function UpdateLabel uses an incorrect database query function that bypasses repository ownership validation:

Vulnerable Code (internal/route/repo/issue.go:1040-1054):

plain func UpdateLabel(c context.Context, f form.CreateLabel) { l, err := database.GetLabelByID(f.ID) // ❌ No repository validation if err != nil { c.NotFoundOrError(err, "get label by ID") return }

// ❌ Missing validation: l.RepoID != c.Repo.Repository.ID l.Name = f.Title l.Color = f.Color if err := database.UpdateLabel(l); err != nil { c.Error(err, "update label") return } c.RawRedirect(c.Repo.MakeURL("labels")) }

Root Cause:

1. The function calls database.GetLabelByID(f.ID) which internally passes repoID=0 to the ORM layer 2. According to code comments in internal/database/issuelabel.go:147-166, passing repoID=0 causes the ORM to ignore repository restrictions 3. No validation checks whether l.RepoID == c.Repo.Repository.ID before updating 4. The middleware reqRepoWriter() only validates write access to the repository in the URL path, not the label's actual repository

Inconsistency with Other Functions:

+ NewLabel: Correctly sets RepoID = c.Repo.Repository.ID + DeleteLabel: Correctly uses database.DeleteLabel(c.Repo.Repository.ID, id) + API EditLabel: Correctly uses database.GetLabelOfRepoByID(c.Repo.Repository.ID, id)

- Only UpdateLabel in Web UI uses the vulnerable pattern

PoC Prerequisites:

+ Two user accounts: Alice (attacker) and Bob (victim) + alice has written access to repo-a + Bob owns repo-b with labels

Step 1: Identify Target Label ID

1. Login as bob, navigate to bob/repo-b/labels 2. Open browser DevTools (F12) → Network tab 3. Click edit on any label 4. Observe the form data: id=<LABELID> 5. Example: id=1

Step 2: Execute Attack

plain Login as alice, get session cookie Open DevTools → Application → Cookies → ilikegogs Copy the cookie value

Send malicious request curl -X POST "http://localhost:3000/alice/repo-a/labels/edit" \ -H "Cookie: ilikegogs=<ALICESESSIONCOOKIE>" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "id=1&title=HACKED-BY-ALICE&color=%23000000"

Expected response: 302 Found (redirect)

Step 3: Verify Impact

1. Login as bob 2. Navigate to bob/repo-b/labels 3. Observe: Label "P0-Critical" is now "HACKED-BY-ALICE" with black color

Impact 1. Issue Classification Disruption: Modify critical labels (e.g., "P0-Critical" → "P3-Low") causing urgent issues to be deprioritized

2. Security Issue Concealment: Change "security" labels to "documentation" to hide vulnerability reports from security teams

3. Workflow Sabotage: Alter labels used in CI/CD automation, breaking deployment pipelines

4. Mass Disruption: Batch modifies all labels across multiple repositories using ID enumeration

Recommended Fix:

plain func UpdateLabel(c context.Context, f form.CreateLabel) { l, err := database.GetLabelOfRepoByID(c.Repo.Repository.ID, f.ID) if err != nil { c.NotFoundOrError(err, "get label of repository by ID") return } // Now label ownership is validated at database layer l.Name = f.Title l.Color = f.Color if err := database.UpdateLabel(l); err != nil { c.Error(err, "update label") return } c.RawRedirect(c.Repo.MakeURL("labels")) }

Other sources

Gogs is an open source self-hosted Git service. Versions 0.13.4 and below have a broken access control vulnerability which allows authenticated users with write access to any repository to modify labels belonging to other repositories. The UpdateLabel function in the Web UI (internal/route/repo/issue.go) fails to verify that the label being modified belongs to the repository specified in the URL path, enabling cross-repository label tampering attacks. The vulnerability exists in the Web UI's label update endpoint POST /:username/:reponame/labels/edit. The handler function UpdateLabel uses an incorrect database query function that bypasses repository ownership validation. This issue has been fixed in version 0.14.1.

MITRE

Affected Software

2 affected componentsFixes available
go/gogs.io/gogs<=0.13.4
0.14.0
Gogs Gogs<0.14.1

Event History

Feb 17, 2026
Advisory Published
via GitHub·06:42 PM
Data Sourced
via GitHub·06:42 PM
DescriptionWeaknessAffected Software
Feb 19, 2026
CVE Published
via MITRE·02:33 AM
Data Sourced
via MITRE·02:33 AM
DescriptionWeakness
Data Sourced
via NVD·07:17 AM
RemedyDescriptionSeverityWeaknessAffected Software
Aug 19, 58109
Event
via FIRST·05:19 PM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-25229?

CVE-2026-25229 is classified as a medium severity vulnerability due to its impact on access control.

2

How do I fix CVE-2026-25229?

To fix CVE-2026-25229, upgrade Gogs to version 0.14.0 or later.

3

What types of users are affected by CVE-2026-25229?

Authenticated users with write access to repositories are affected by CVE-2026-25229.

4

What is the impact of CVE-2026-25229?

CVE-2026-25229 allows users to modify labels in repositories they do not own, violating intended access controls.

5

In which version of Gogs is CVE-2026-25229 present?

CVE-2026-25229 is present in Gogs versions up to and including 0.13.4.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203