Skip to main content
Vulnerability Database/CVE-2024-45614

CVE-2024-45614: Puma Web Server Header Injection Vulnerability

CVE-2024-45614 is a header injection flaw in Puma web server that lets attackers override proxy-set headers like X-Forwarded-For using underscore variants. This post covers the technical details, affected versions, and patches.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-45614 Overview

CVE-2024-45614 affects Puma, a Ruby/Rack web server built for parallelism and widely deployed as the application server behind reverse proxies in Rails and Rack applications. The vulnerability lets remote clients clobber proxy-set HTTP headers such as X-Forwarded-For by submitting an underscore variant like X-Forwarded_For. Applications that implicitly trust proxy-defined headers for client identification, rate limiting, or access control may act on attacker-controlled values. The flaw is tracked under CWE-444 HTTP Request Smuggling and CWE-639 Authorization Bypass Through User-Controlled Key.

Critical Impact

Attackers can spoof trusted proxy headers to bypass IP-based access controls, forge audit log entries, and evade rate limiting on Puma-backed applications.

Affected Products

  • Puma versions prior to 6.4.3
  • Puma versions prior to 5.6.9
  • Ruby/Rack applications relying on proxy-defined headers for security decisions

Discovery Timeline

  • 2024-09-19 - CVE-2024-45614 published to the National Vulnerability Database
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-45614

Vulnerability Analysis

Puma parsed inbound HTTP headers without distinguishing between dash and underscore delimiters when the same logical header appeared in both forms. When a reverse proxy such as Nginx or HAProxy inserted a header like X-Forwarded-For: <real-client-ip>, a client could send an additional X-Forwarded_For: <spoofed-value> header in the same request. Puma would surface both to the Rack application, and middleware that normalized header names would frequently pick the attacker-supplied underscore variant.

This header confusion breaks the trust boundary between the proxy and the application. Downstream code that treats HTTP_X_FORWARDED_FOR as authoritative receives an attacker-controlled value even though the proxy correctly set its own copy. Applications depending on client IP for geofencing, admin panel allowlists, abuse throttling, or logging are directly affected.

Root Cause

The root cause is Puma's handling of CGI-style header name translation. HTTP header names containing hyphens are typically converted to underscores when exposed through the Rack environment. Because Puma did not deduplicate headers whose names collided after this transformation, a header sent with underscores could overwrite or shadow the proxy-set equivalent.

Attack Vector

Exploitation requires only the ability to send HTTP requests to a Puma-backed service that sits behind a trusting proxy. The attacker appends an underscore-named clone of a sensitive proxy header and populates it with a forged value, such as an internal IP that would normally bypass authentication or rate limits. No authentication or user interaction is required. The vulnerability is described in detail in the Puma GHSA-9hf4-67fc-4vf4 advisory.

Detection Methods for CVE-2024-45614

Indicators of Compromise

  • HTTP requests containing both X-Forwarded-For and X-Forwarded_For headers in the same transaction
  • Requests with underscore variants of any proxy-managed header such as X-Real_IP, X-Forwarded_Host, or X-Forwarded_Proto
  • Application logs showing client IP addresses that disagree with the upstream proxy access logs for the same request ID

Detection Strategies

  • Parse web server and application logs to flag requests whose Rack-level HTTP_X_FORWARDED_FOR value differs from the proxy's recorded client address
  • Add a Nginx or HAProxy log field capturing raw header names and alert when underscore variants of security-relevant headers appear
  • Review Puma version strings reported in server banners and deployment manifests to identify instances running versions below 6.4.3 or 5.6.9

Monitoring Recommendations

  • Monitor authentication and administrative endpoints for successful access originating from unexpected client IPs following requests that contained duplicate forwarded-for headers
  • Track rate-limiting bypass patterns where a single upstream source generates high request volume while appearing as many distinct spoofed addresses
  • Correlate web application firewall telemetry with Puma application logs to surface header normalization mismatches

How to Mitigate CVE-2024-45614

Immediate Actions Required

  • Upgrade Puma to version 6.4.3 or 5.6.9 or later, which discard underscore headers whenever a non-underscore counterpart exists
  • Audit application code and middleware that reads X-Forwarded-For, X-Real-IP, or similar headers and treat them as untrusted until the upgrade is deployed
  • Temporarily disable IP-based access controls or admin allowlists that rely on client IP extraction from proxy headers

Patch Information

The Puma maintainers released fixed versions 6.4.3 and 5.6.9. The patch ensures that when both dash and underscore variants of the same header are present, the underscore version is discarded so proxy-defined headers always win. See the GitHub Security Advisory GHSA-9hf4-67fc-4vf4 and the Debian LTS announcement for distribution-specific fixes.

Workarounds

  • Set underscores_in_headers off in Nginx, which is the default, to strip underscore headers at the proxy before they reach Puma. Refer to the Nginx underscores_in_headers directive documentation
  • Configure HAProxy or other upstream proxies with equivalent rules to drop inbound headers containing underscores
  • Reject requests at the WAF layer when both dash and underscore forms of the same proxy header are present
bash
# Nginx server block mitigation
server {
    listen 443 ssl;
    server_name app.example.com;

    # Default is 'off' - explicitly reject underscore headers
    underscores_in_headers off;

    # Strip any client-supplied forwarded headers before proxying
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;

    location / {
        proxy_pass http://puma_upstream;
    }
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.