{"id":"CVE-2026-25229","aliases":["CVE-2026-25229","GHSA-cv22-72px-f4gh","GO-2026-4499"],"related":[],"kind":"vulnerability","state":"published","title":"Gogs Authorization Bypass Allows Cross-Repository Label Modification","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### **Summary**\nA 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.\n\n### **Details**\nThe 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:\n\n**Vulnerable Code** (`internal/route/repo/issue.go:1040-1054`):\n\n```plain\nfunc UpdateLabel(c *context.Context, f form.CreateLabel) {\n    l, err := database.GetLabelByID(f.ID)  // ❌ No repository validation\n    if err != nil {\n        c.NotFoundOrError(err, \"get label by ID\")\n        return\n    }\n\n    // ❌ Missing validation: l.RepoID != c.Repo.Repository.ID\n    l.Name = f.Title\n    l.Color = f.Color\n    if err := database.UpdateLabel(l); err != nil {\n        c.Error(err, \"update label\")\n        return\n    }\n    c.RawRedirect(c.Repo.MakeURL(\"labels\"))\n}\n```\n\n**Root Cause**:\n\n1. The function calls `database.GetLabelByID(f.ID)` which internally passes `repoID=0` to the ORM layer\n2. According to code comments in `internal/database/issue_label.go:147-166`, passing `repoID=0` causes the ORM to ignore repository restrictions\n3. No validation checks whether `l.RepoID == c.Repo.Repository.ID` before updating\n4. The middleware `reqRepoWriter()` only validates write access to the repository in the URL path, not the label's actual repository\n\n**Inconsistency with Other Functions**:\n\n+ `NewLabel`: Correctly sets `RepoID = c.Repo.Repository.ID`\n+ `DeleteLabel`: Correctly uses `database.DeleteLabel(c.Repo.Repository.ID, id)`\n+ API `EditLabel`: Correctly uses `database.GetLabelOfRepoByID(c.Repo.Repository.ID, id)`\n\n- ****Only `UpdateLabel` in ****Web UI**** uses the vulnerable pattern****\n\n### **PoC**\n**Prerequisites**:\n\n+ Two user accounts: Alice (attacker) and Bob (victim)\n+ alice has written access to repo-a\n+ Bob owns repo-b with labels\n\n**Step 1: Identify Target Label ID**\n\n1. Login as bob, navigate to bob/repo-b/labels\n2. Open browser DevTools (F12) → Network tab\n3. Click edit on any label\n4. Observe the form data: id=<LABEL_ID>\n5. Example: id=1\n\n**Step 2: Execute Attack**\n\n```plain\n# Login as alice, get session cookie\n# Open DevTools → Application → Cookies → i_like_gogs\n# Copy the cookie value\n\n# Send malicious request\ncurl -X POST \"http://localhost:3000/alice/repo-a/labels/edit\" \\\n  -H \"Cookie: i_like_gogs=<ALICE_SESSION_COOKIE>\" \\\n  -H \"Content-Type: application/x-www-form-urlencoded\" \\\n  -d \"id=1&title=HACKED-BY-ALICE&color=%23000000\"\n\n# Expected response: 302 Found (redirect)\n```\n\n**Step 3: Verify Impact**\n\n1. Login as bob\n2. Navigate to bob/repo-b/labels\n3. Observe: Label \"P0-Critical\" is now \"HACKED-BY-ALICE\" with black color\n\n### **Impact**\n1. **Issue Classification Disruption**: Modify critical labels (e.g., \"P0-Critical\" → \"P3-Low\") causing urgent issues to be deprioritized\n\n2. **Security Issue Concealment**: Change \"security\" labels to \"documentation\" to hide vulnerability reports from security teams\n\n3. **Workflow**** Sabotage**: Alter labels used in CI/CD automation, breaking deployment pipelines\n\n4. **Mass Disruption**: Batch modifies all labels across multiple repositories using ID enumeration\n\n**Recommended Fix**:\n\n```plain\nfunc UpdateLabel(c *context.Context, f form.CreateLabel) {\n    l, err := database.GetLabelOfRepoByID(c.Repo.Repository.ID, f.ID)\n    if err != nil {\n        c.NotFoundOrError(err, \"get label of repository by ID\")\n        return\n    }\n    // Now label ownership is validated at database layer\n    l.Name = f.Title\n    l.Color = f.Color\n    if err := database.UpdateLabel(l); err != nil {\n        c.Error(err, \"update label\")\n        return\n    }\n    c.RawRedirect(c.Repo.MakeURL(\"labels\"))\n}\n```","format":"markdown","source":"ghsa"},{"lang":"en","text":"Gogs has an Authorization Bypass Allows Cross-Repository Label Modification in Gogs in gogs.io/gogs.\n\nNOTE: The source advisory for this report contains additional versions that could not be automatically mapped to standard Go module versions.\n\n(If this is causing false-positive reports from vulnerability scanners, please suggest an edit to the report.)\n\nThe additional affected modules and versions are: gogs.io/gogs before v0.14.0.","format":"markdown","source":"go"},{"lang":"es","text":"Gogs es un servicio Git de código abierto autoalojado. Las versiones 0.13.4 e inferiores tienen una vulnerabilidad de control de acceso roto que permite a usuarios autenticados con acceso de escritura a cualquier repositorio modificar etiquetas pertenecientes a otros repositorios. La función UpdateLabel en la interfaz de usuario web (Web UI) (internal/route/repo/issue.go) no verifica que la etiqueta que se está modificando pertenezca al repositorio especificado en la ruta URL, lo que permite ataques de manipulación de etiquetas entre repositorios. La vulnerabilidad existe en el endpoint de actualización de etiquetas de la interfaz de usuario web (Web UI) POST /:username/:reponame/labels/edit. La función gestora UpdateLabel utiliza una función de consulta de base de datos incorrecta que omite la validación de propiedad del repositorio. Este problema ha sido corregido en la versión 0.14.1.","source":"nvd"}],"published":"2026-02-17T18:42:08.000Z","modified":"2026-06-17T10:24:20.480Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-284"],"affected":[{"ranges":[{"version":"< 0.14.1","status":"affected"}],"vendor":"gogs","product":"gogs","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.14.0"}],"ecosystem":"Go","package":"gogs.io/gogs","purl":"pkg:golang/gogs.io/gogs","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"gogs.io/gogs","purl":"pkg:golang/gogs.io/gogs","source":"go"},{"ranges":[{"status":"affected","fixed":"0.14.1"}],"vendor":"gogs","product":"gogs","cpe":"cpe:2.3:a:gogs:gogs:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/gogs/gogs/security/advisories/GHSA-cv22-72px-f4gh","tags":["advisory","exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/gogs/gogs/commit/643a6d6353cb6a182a4e1f0720228727f30a3ad2","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25229","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/gogs/gogs","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-02-19T17:04:50.842Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-25229","url":"https://www.cve.org/CVERecord?id=CVE-2026-25229","licence":"CVE Terms of Use","modified":"2026-02-19T17:44:28.915Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cv22-72px-f4gh","url":"https://github.com/advisories/GHSA-cv22-72px-f4gh","licence":"CC-BY-4.0","modified":"2026-02-23T19:26:04.055Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-4499","url":"https://pkg.go.dev/vuln/GO-2026-4499","licence":"CC-BY-4.0","modified":"2026-02-23T19:26:04.055Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-25229","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25229","licence":"Public domain","modified":"2026-06-17T10:24:20.480Z"}],"updatedAt":"2026-11-25T22:59:14.070Z","epss":{"score":0.00302,"percentile":0.24748,"date":"2026-12-01T12:00:22.000Z"}}