CVE-2026-138408: High severity Forgejo Forgejo vulnerability
In Forgejo before 15.0.12 and 16.x and 17.x before 17.0.2, emailverified can be spoofed, sometimes leading to account takeover in external services that rely on Forgejo for authentication. It allows an authenticated user to set an unverified secondary email address as their primary email address when [service] REGISTEREMAILCONFIRM is enabled. Although the web UI hides the "Make primary" button for unverified addresses, the backend POST /user/settings/account/email handler (EmailPost in routers/web/user/setting/account.go) and MakeEmailAddressPrimary in services/user/email.go did not check whether the email address was activated. Because Forgejo's OpenID Connect (OIDC) provider derives the emailverified claim from user.IsActive rather than the primary email address's activation state, an attacker can obtain signed ID tokens asserting emailverified: true for an arbitrary unverified email address, and potentially take over accounts on external relying parties that match users by verified email.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 15.0.12 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 17.0.2
Event History
Frequently Asked Questions
Which deployments are exposed?
Affected deployments are Forgejo versions before 15.0.12, and 16.x and 17.x versions before 17.0.2, where REGISTER_EMAIL_CONFIRM is enabled. The account-takeover risk applies when Forgejo is used as an OIDC provider by external services that identify users using a verified email address.
What access does an attacker need?
An attacker needs an authenticated Forgejo account. They can set an unverified secondary email address as their primary address through the backend email settings handler.
Why does hiding the “Make primary” control not prevent exploitation?
The web interface hides the control for unverified addresses, but the backend POST /user/settings/account/email handler and MakeEmailAddressPrimary did not verify that the address was activated. An authenticated user could therefore bypass the UI restriction by invoking the backend path.
Which external services are most at risk?
The relevant relying parties are those that accept Forgejo-issued OIDC ID tokens and match or provision accounts based on a verified email address. Forgejo could issue a signed token asserting email_verified: true for an unverified primary email address because the claim was based on user.IsActive rather than the address activation state.