Open Redirect Vulnerability in Sinatra Package

ruby-sinatra Updated 02 Oct 2025

Summary

01/11/2024
N/A
No i
Unrated
Not published

CVE-2024-21510: Versions of the package sinatra from 0.0.0 are vulnerable to Reliance on Untrusted Inputs in a Security Decision via the X-Forwarded-Host (XFH) header. Affects ruby-sinatra versions 2.0.8.1-2 – 4.1.1-6. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Sinatra is a lightweight web application framework for Ruby, designed for simplicity and flexibility in building web applications. It allows developers to create web services quickly and efficiently, utilizing a minimalistic approach. However, certain versions of Sinatra are vulnerable to an open redirect attack due to improper handling of the X-Forwarded-Host (XFH) header, which can lead to serious security issues.

Vulnerability Detail

The vulnerability arises from the reliance on untrusted inputs in security decisions, specifically through the X-Forwarded-Host header. When a request is made to a method with a redirect applied, an attacker can manipulate this header to redirect users to arbitrary addresses. This can be exploited for cache poisoning or routing-based Server-Side Request Forgery (SSRF) attacks, especially when used with caching servers like Nginx or as a reverse proxy. The affected versions of the Sinatra package do not adequately validate the XFH header, making it susceptible to these attacks.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, you can implement validation for the X-Forwarded-Host header in your application to ensure it only accepts trusted values. For example, you can add a middleware that checks the header against a whitelist of allowed hosts before processing the request.

Conclusion

The CVE-2024-21510 vulnerability in the Sinatra package poses significant security risks due to improper handling of the X-Forwarded-Host header. It is crucial for developers using affected versions to update their packages promptly and consider implementing additional validation measures to protect their applications.

See every vulnerability recorded for ruby-sinatra →

Share this vulnerability

FAQ

An open redirect attack occurs when a web application accepts a user-controlled input that specifies a URL to redirect to, allowing attackers to redirect users to malicious sites.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. By simply uploading your manifest file like package-lock.json, you can check for vulnerabilities without any installation.

Exploiting this vulnerability can lead to cache poisoning, where attackers serve malicious content to users, or SSRF attacks, which can compromise internal services.

Yes, implementing strict validation of the X-Forwarded-Host header can help mitigate the risk until a proper update can be applied.

Detailed information can be found in the CVE database or through security advisories related to the Sinatra package.

Related vulnerabilities

Recent vulnerabilities recorded for ruby-sinatra.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback