# CVE-2024-25618: External OpenID Connect Account Takeover by E-Mail Change in mastodon

> Attackers can hijack Mastodon accounts by exploiting email-based identity linking when external authentication providers allow unverified email changes.

- **Severity:** Medium 4.2 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 14 Feb 2024
- **Updated:** 12 May 2025
- **Also known as:** BIT-mastodon-2024-25618, GHSA-vm39-j3vx-pch3

## What is CVE-2024-25618?

CVE-2024-25618 is a medium-severity authentication bypass vulnerability in mastodon, published on 14 Feb 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Mastodon is a free, open-source social network server based on ActivityPub. Mastodon allows new identities from configured authentication providers (CAS, SAML, OIDC) to attach to existing local users with the same e-mail address. This results in a possible account takeover if the authentication provider allows changing the e-mail address or multiple authentication providers are configured. When a user logs in through an external authentication provider for the first time, Mastodon checks the e-mail address passed by the provider to find an existing account. However, using the e-mail address alone means that if the authentication provider allows changing the e-mail address of an account, the Mastodon account can immediately be hijacked. All users logging in through external authentication providers are affected. The severity is medium, as it also requires the external authentication provider to misbehave. However, some well-known OIDC providers (like Microsoft Azure) make it very easy to accidentally allow unverified e-mail changes. Moreover, OpenID Connect also allows dynamic client registration. This issue has been addressed in versions 4.2.6, 4.1.14, 4.0.14, and 3.5.18. Users are advised to upgrade. There are no known workarounds for this vulnerability.

Weakness: CWE-306 (Missing Authentication for Critical Functionality), CWE-287 (Improper Authentication)

## Which versions are affected by CVE-2024-25618?

1 open source package ship an affected version, including mastodon. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `mastodon` | Bitnami | All versions | 3.5.18, 4.0.14, 4.1.14, 4.2.6 |

Products: Joinmastodon Mastodon.

## How do I fix CVE-2024-25618?

Upgrade mastodon to a fixed version for your release line: 3.5.18, 4.0.14, 4.1.14 or 4.2.6.

## Is CVE-2024-25618 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-25618 exists.

## Other vulnerabilities in mastodon

- [CVE-2023-36460](https://insights.sbomify.com/CVE-2023-36460/): Mastodon vulnerable to arbitrary file creation through media attachments (critical 10.0)
- [CVE-2022-2166](https://insights.sbomify.com/CVE-2022-2166/): Improper Restriction of Excessive Authentication Attempts in mastodon/mastodon (critical 9.8)
- [CVE-2022-24307](https://insights.sbomify.com/CVE-2022-24307/): Missing authorization in n/a (critical 9.8)
- [CVE-2018-21018](https://insights.sbomify.com/CVE-2018-21018/): Auth bypass in n/a (critical 9.8)
- [CVE-2024-23832](https://insights.sbomify.com/CVE-2024-23832/): Mastodon Remote user impersonation and takeover (critical 9.4)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-25618 and fix it if it is affected.

What it is: CVE-2024-25618 is a medium-severity authentication bypass vulnerability in mastodon, published on 14 Feb 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-25618 exists.

Affected packages and fixed versions:
- mastodon (Bitnami): affected all versions; fixed in 3.5.18, 4.0.14, 4.1.14, 4.2.6

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-25618/ (Markdown: https://insights.sbomify.com/CVE-2024-25618/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-25618
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-25618
- OSV: https://osv.dev/vulnerability/CVE-2024-25618

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-25618/
Summaries are generated and may contain mistakes; the official description above is the record.
