Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-103504 Overview
CVE-2026-103504 affects Gitea, a self-hosted Git service. The vulnerability resides in the organization team permission API. When an organization owner changed a team's permission by sending only the permission field through the API, Gitea failed to rebuild the team's per-unit access. The requested level was also not applied as a cap on existing unit permissions. As a result, after a demotion from admin to read, team members retained their prior unit permissions, including write access to repositories owned by that team. The equivalent web form was not affected. The weakness is classified as least privilege violation [CWE-272].
Critical Impact
Demoted team members silently retain elevated repository permissions, enabling continued write access to source code despite an administrative downgrade.
Affected Products
- Gitea self-hosted Git service versions prior to v28.0.0
- Gitea organization team management API (permission field update path)
- Deployments relying on API-driven team permission changes for access revocation
Discovery Timeline
- 2026-10-06 - CVE-2026-103504 published to NVD
- 2026-10-07 - Last updated in NVD database
Technical Details for CVE-2026-103504
Vulnerability Analysis
Gitea organizations assign permissions to teams at two layers: a team-wide permission level (such as read, write, admin) and per-unit access entries that govern individual repository units like code, issues, pull requests, and wiki. The API endpoint used to edit a team accepted a payload containing only the permission field. In that path, Gitea updated the top-level team permission record but did not recompute the per-unit access rows tied to the team. The requested level was also not enforced as an upper bound on those rows.
The practical outcome is a least privilege violation [CWE-272]. An owner who demotes an admin team to read through the API expects members to lose write and admin capabilities. Instead, the stale per-unit entries continue to grant the previous access, so members keep write access to repositories. The web form, which triggers a full rebuild of per-unit access, does not exhibit the issue.
Root Cause
The root cause is incomplete state synchronization in the API update handler. The handler mutated the team's declared permission but omitted the logic that rebuilds unit-level access rows and caps them to the new permission ceiling. Access decisions downstream rely on those per-unit rows, so the stored unit permissions overrode the demoted team permission. The pull request discussion for Gitea change #38938 describes the corrected rebuild behavior.
Attack Vector
Exploitation requires an organization owner to initiate a team demotion through the API with a payload containing only permission. The vulnerability is not actively exploited by an external attacker, but it creates a latent authorization gap. Any team member whose team was demoted via that API call retains elevated access until the team is rebuilt. A malicious insider aware of the behavior can continue to push code, modify branches, or alter repository content after an apparent revocation. See the GitHub Security Advisory GHSA-x8c3-3rp8-2j46 for the full advisory.
// Example exploitation code (sanitized)
No verified exploit code is published. The vulnerable path is
any API PATCH to the organization team endpoint that supplies
only the `permission` field without triggering a unit rebuild.
Detection Methods for CVE-2026-103504
Indicators of Compromise
- API audit log entries updating an organization team's permission field without accompanying units or units_map fields.
- Repository write events (git push, branch updates, release creation) performed by members of a team whose permission was recently reduced.
- Divergence between a team's declared permission level and the per-unit access rows stored for that team in the Gitea database.
Detection Strategies
- Review Gitea API access logs for PATCH requests against /orgs/{org}/teams/{team} that include only a permission key in the body.
- Query the Gitea database to compare team.authorize against the maximum team_unit.access_mode for each team and flag mismatches.
- Correlate team permission changes with subsequent repository write activity by the same team's members within the following hours or days.
Monitoring Recommendations
- Enable and centralize Gitea application and API logs in a SIEM or data lake to retain team management events for audit.
- Alert on any post-demotion write activity to repositories where the team's intended permission is now read or none.
- Track upgrades to Gitea v28.0.0 across all self-hosted instances to confirm complete remediation coverage.
How to Mitigate CVE-2026-103504
Immediate Actions Required
- Upgrade all Gitea instances to Gitea Release v28.0.0 or later, which contains the fix.
- Audit every organization team whose permission was changed via the API since deployment and identify any that were demoted.
- Re-apply team permission changes through the web form, or re-save each affected team, so that per-unit access rows are rebuilt and capped correctly.
Patch Information
The fix is included in Gitea v28.0.0. Details are documented in the Gitea Release Announcement, the Gitea Pull Request Discussion, and the GitHub Security Advisory GHSA-x8c3-3rp8-2j46. The patch rebuilds per-unit access on API-driven permission changes and applies the requested permission as a cap.
Workarounds
- Perform team permission changes through the Gitea web form rather than the API until the upgrade is applied.
- When using the API, follow a permission change with an explicit update that rewrites the team's units or units_map so per-unit access is refreshed.
- Temporarily restrict API tokens with admin:org scope to a small set of trusted operators who understand the limitation.
# Configuration example
# Verify installed Gitea version before and after upgrade
gitea --version
# Example API call that triggers a full unit rebuild by sending
# both the new permission level and an explicit units_map payload
curl -X PATCH \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"permission": "read",
"units_map": {
"repo.code": "read",
"repo.issues": "read",
"repo.pulls": "read",
"repo.wiki": "read"
}
}' \
https://gitea.example.com/api/v1/orgs/ORG/teams/TEAM
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

