CVE-2026-120263: Gitea OAuth2 account auto-linking takeover through the sign-up form
When [oauth2client].ACCOUNTLINKING is set to auto (not the default) and registration is enabled, the link-account sign-up form looked up the existing account to link by the user name or email submitted in the form instead of the identity asserted by the OAuth2 provider. An attacker with an account on a configured OAuth2 provider could submit another user's name, link their external identity to that Gitea account and be signed in as it without its password, including as an administrator. The link persisted for later sign-ins. Automatic linking now only happens when the existing account matches the provider's email or provider-derived user name; otherwise the account password is required.
Event History
Frequently Asked Questions
Are default Gitea deployments affected?
No. Exploitation requires [oauth2_client].ACCOUNT_LINKING to be explicitly set to auto, which is not the default, and registration to be enabled.
What does an attacker need to exploit this?
The attacker needs an account with a configured OAuth2 provider. They can submit another user's Gitea user name or email in the link-account sign-up form to attach their external identity to that account.
What is the impact after a successful exploit?
The attacker can sign in to the targeted Gitea account without its password, including an administrator account. The OAuth2 identity link persists for future sign-ins.
What can be done before applying the fix?
Do not use automatic account linking: change [oauth2_client].ACCOUNT_LINKING from auto, or disable registration if automatic linking cannot be changed immediately. These measures remove one or both conditions required for exploitation.