GHSA-8p3x-w464-4g6v: 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
Which deployments are exposed?
Exposure requires both `[oauth2_client].ACCOUNT_LINKING` set to `auto` and registration enabled. Automatic account linking is not the default setting.
What does an attacker need to exploit this?
The attacker needs an account with a configured OAuth2 provider and another user's Gitea user name or email address. They do not need the target account's password.
What level of access could an attacker obtain?
An attacker could sign in as the targeted Gitea account, including an administrator account. The malicious external-identity link persisted for subsequent sign-ins.
What behavior prevents automatic linking after the fix?
Automatic linking only occurs when the existing account matches the OAuth2 provider's email address or provider-derived user name. If it does not match, the existing account password is required.