Executive brief
Gogs is an open-source self-hosted Git service used by organizations to manage source code. A security flaw allows a user who has been granted administrative access to a specific repository to upgrade their own permissions to 'Owner' status. This allows the attacker to perform restricted actions such as deleting the repository, transferring ownership, or erasing wiki data, potentially leading to permanent data loss or unauthorized transfer of intellectual property.
Technical details
An off-by-one error exists in the `ChangeCollaborationAccessMode` function within `internal/database/repo_collaboration.go`. The validation logic used a `mode > AccessModeOwner` check where `AccessModeOwner` is 4; because the check was not inclusive (>=), it allowed the value 4 to be processed. An attacker with existing 'Admin' collaborator privileges (AccessMode 3) can send a crafted POST request to the web UI settings endpoint with `mode=4` to gain full ownership of a repository. This allows for repository deletion and ownership transfer. The vulnerability is addressed in version 0.14.3 by tightening the validation to reject any mode greater than or equal to `AccessModeOwner`.
Affected products
- Gogs Gogs < 0.14.3
Timeline
- 2026-04-05: other: Pull request submitted
- 2026-06-07: patched: Version 0.14.3 released
- 2026-06-19: advisory: GitHub Security Advisory published
- 2026-06-24: disclosed: CVE published to NVD