/

CVE-2026-27657

Severity:

HIGH RISK

(7.5)

IDOR Email Change (CWE-639) in Gitea User Accounts

CVE-2026-27657

Deferred

Vulnerability type

Category:

Insecure Direct Object Reference

CWE:

CWE-639

Impact:

Account Takeover and Identity Misbinding

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A broken access control flaw in Gitea lets one user change another user's primary email address without proper authorization checks.

When user identity is derived only from client-controlled parameters, attackers may hijack notification channels, disrupt account recovery, or facilitate further account compromise.

Affected context

This vulnerability occurs in Gitea's user management and account settings functionality, specifically in flows that update a user's primary email address.

It becomes relevant when the server trusts user identifiers supplied by the client (such as user IDs or usernames in requests) instead of verifying that the authenticated session belongs to the target account.

Deployments where users can manage their email addresses through web or API interfaces, and where email addresses are used for notifications or password reset, are particularly exposed.

Exploit preconditions

  • Attack surface: Web UI or HTTP API endpoints responsible for updating user email addresses
  • Required access: Authenticated or semi-authenticated user able to submit requests to the email change endpoint
  • Trigger point: Sending a crafted request that references another user's identifier while updating the primary email address
  • Why exploitation is possible: The application does not enforce a robust ownership check, allowing direct object references (user IDs / usernames) in the request to target accounts other than the one associated with the current session

Why this happens

The underlying bug class is broken access control due to insecure direct object references.

The server accepts client-supplied identifiers to select which user record to modify but fails to verify that the authenticated principal is authorized to change that specific record.

This maps to CWE-639: Authorization Bypass Through User-Controlled Key, where the application exposes internal objects (such as user accounts) through predictable identifiers without adequate ownership or permission enforcement.

Potential impact

  • Attackers may change another user's primary email address, misdirecting notifications and alerts
  • Account recovery and password reset workflows could be hijacked or disrupted
  • Users can be effectively locked out of their accounts if recovery relies on the primary email
  • Email-based verification and audit trails may be corrupted or sent to attacker-controlled addresses
  • Trust in repository collaboration, issue tracking, and code review workflows can be undermined

General mitigation guidance

Mitigation typically centers on enforcing strict, server-side authorization checks for all state-changing operations on user resources.

Recommended patterns include:

  • Binding email change operations to the authenticated user identity derived from the session or token, rather than trusting user IDs from request parameters
  • Implementing ownership checks for any endpoint that references user accounts, ensuring only the account owner (or an explicitly privileged administrator) can modify primary email fields
  • Normalizing access control logic through shared authorization middleware to avoid per-endpoint inconsistencies
  • Treating email addresses as high-value identity attributes and requiring re-authentication or step-up verification for changes
  • Designing APIs to operate on "current user" by default, minimizing the need for arbitrary user identifiers in sensitive operations

How teams detect issues like this

Detection often involves both automated and manual review of authorization flows:

  • Static analysis or custom linting rules that flag patterns where user identifiers from request parameters are used directly to query or update account records
  • Code review checklists emphasizing validation of ownership checks on endpoints that modify user profile, email, or authentication-related attributes
  • Integration tests or security tests that attempt to perform actions on other users' accounts while authenticated as a different user, validating proper enforcement of access control
  • Central policy enforcement for user management operations, ensuring all account modifications pass through a uniform authorization layer rather than ad hoc checks

Sources

SourceLink
blog.gitea.comblog.gitea.com/release-of-1.25.5/
github.comgithub.com/go-gitea/gitea/pull/36586
github.comgithub.com/go-gitea/gitea/pull/36607
github.comgithub.com/go-gitea/gitea/releases/tag/v1.25.5

Frequently asked

questions

It can facilitate account takeover scenarios, especially when email is the primary channel for password reset and verification. Changing the primary email to an attacker-controlled address may allow interception of recovery links.

The attacker typically needs the ability to authenticate or otherwise send requests to the email change functionality. They do not need direct access to the victim's credentials, only the capability to reference the victim's user identifier.

Ensure that all email change operations are bound to the authenticated user derived from the session or token, and enforce strict ownership checks so only the account owner or privileged administrators can modify primary email fields.

Adopt a centralized authorization framework, avoid trusting client-supplied identifiers for sensitive operations, implement comprehensive tests for cross-account actions, and include access control validations as a mandatory part of code review and CI security checks.

Find out what's already
exploitable in your codebase.