MastodonApplication · Joinmastodon

CVE-2024-34535

MEDIUM · 5.9 CVSS v3.1 Published 2024-10-03
Fix available
A fix is available. Upgrade to after 4.2.8 or later.
See remediation →
65/100
Remediation priority · Elevated
Remotely reachable Zero-click

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
In Mastodon 4.1.6, API endpoint rate limiting can be bypassed by setting a crafted HTTP request header.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · moderate confidence

In Mastodon 4.1.6, the API endpoint rate limiting mechanism can be bypassed by an attacker who sets a crafted HTTP request header. This allows the attacker to circumvent rate limits designed to prevent API abuse, potentially enabling automated attacks, scraping, or service disruption.

MitigationThe fix should involve validating and properly handling the HTTP header used to identify clients for rate limiting, ensuring that manipulated headers cannot bypass the rate limiting logic. Consider implementing multiple rate limiting factors and server-side validation.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
MastodonApplication
Affected:<= 4.1.16>= 4.2.0, <= 4.2.8

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
High
Privileges
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
Low
Availability
None

CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:N

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Determine installed Mastodon version
    Check the version file in the Mastodon installation directory, typically running `cat /home/mastodon/live/VERSION` or `cat /opt/mastodon/VERSION` depending on your installation path. Alternatively, check the About page in the web interface or query the instance's API endpoint.
    Affected if The installed version is 4.1.x and <= 4.1.16, OR 4.2.x and <= 4.2.8
  2. Identify rate limiting configuration
    Locate the rate limiting configuration file in the Mastodon config directory. Look for `config/initializers/rack_attack.rb` or similar rate limiting middleware configuration files. Check for any rate limit settings in environment configuration files.
    Affected if Rate limiting is enabled and configured to use an HTTP header for client identification
  3. Inspect the rate limiting header in use
    Examine the rate limiting middleware configuration to identify which HTTP header is used to track client requests for rate limiting purposes. Look for headers such as X-Forwarded-For, X-Real-IP, or custom authentication headers being used as the rate limit key.
    Affected if The configuration uses a client-supplied HTTP header without proper server-side validation or sanitization
  4. Verify header validation exists
    Review the rate limiting code in the Mastodon source, specifically the part that extracts the client identifier from the HTTP header. Check if there is logic to validate, normalize, or reject manipulated header values before using them for rate limit tracking.
    Affected if No validation or sanitization is performed on the header value before using it as the rate limit key, allowing attackers to spoof different identifiers

You are affected if your Mastodon version is 4.1.16 or lower, or between 4.2.0 and 4.2.8, AND rate limiting is enabled using an HTTP header that can be arbitrarily set by clients without server-side validation.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to a release after 4.2.8
Interim mitigation

The fix should involve validating and properly handling the HTTP header used to identify clients for rate limiting, ensuring that manipulated headers cannot bypass the rate limiting logic. Consider implementing multiple rate limiting factors and server-side validation.

Recommended fix High confidence

Mastodon 4.2.9 or 4.1.17

  1. 1. Backup your Mastodon database and files before upgrading
  2. 2. Check your current Mastodon version (typically in the admin interface or package.json)
  3. 3. If running Mastodon 4.2.x, upgrade to version 4.2.9 or later
  4. 4. If running Mastodon 4.1.x, upgrade to version 4.1.17 or later
  5. 5. Review release notes for any required migration steps
  6. 6. Run database migrations if prompted (RAILS_ENV=production bundle exec rails db:migrate)
  7. 7. Restart all Mastodon services (Puma, Sidekiq, streaming)
  8. 8. Verify rate limiting is functioning correctly after upgrade
Caveat Review release notes for any deprecation warnings between minor versions

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in Mastodon Scoped from the published advisory
  • Consultation4.0 h
  • Implementation8.0 h
  • Testing4.0 h
  • Review / QA3.0 h
19.0 hours of engineering $3,380
Get the upgrade done

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $5,408.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2024-34535 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2024-34535 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data