Open Redirect Vulnerability in ruby-sinatra: Exploiting X-Forwarded-Host Header

ruby-sinatra Updated 02 Oct 2025

Summary

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

DEBIAN-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 < 4.1.1-2. Fixed in 4.1.1-2. 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 Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

ruby-sinatra is a lightweight web application framework for Ruby, designed for simplicity and flexibility in building web applications. It allows developers to create web applications quickly with minimal effort. However, certain versions of ruby-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 lead to open redirect attacks, which can be exploited for cache poisoning or routing-based Server-Side Request Forgery (SSRF) if the application is behind a reverse proxy like Nginx.

How To Fix

Minimum fixed version

4.1.1-2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade ruby-sinatra

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, you can implement validation on the X-Forwarded-Host header to ensure it only contains trusted domains. This can be done by adding a middleware in your Sinatra application that checks the header before processing requests.

Conclusion

The ruby-sinatra package has a critical vulnerability related to the handling of the X-Forwarded-Host header, which can lead to open redirect attacks. It is essential to update to the patched version 4.1.1-2 or later to mitigate this risk. Additionally, implementing validation on the header can serve as a temporary workaround.

See every vulnerability recorded for ruby-sinatra →

Share this vulnerability

FAQ

The X-Forwarded-Host header is used to identify the original host requested by the client in the case of a proxy or load balancer.

If exploited, this vulnerability can lead to open redirect attacks, allowing attackers to redirect users to malicious sites or perform cache poisoning.

If you are using ruby-sinatra versions prior to 4.1.1-2, your application is vulnerable. You can check for vulnerabilities using Vulert without any signup.

Vulert is a tool that monitors and alerts for open-source vulnerabilities in your software using just a manifest file like package-lock.json.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Related vulnerabilities

Recent vulnerabilities recorded for ruby-sinatra.

How To Fix

Minimum fixed version

4.1.1-2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade ruby-sinatra

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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