Skip to content

GHSA-33vf-4xgg-9r58 CVE-2020-5249

HTTP Response Splitting (Early Hints) in Puma

Medium RubyGems
Severity
6.5 / 10
Medium · CVSS 3.1
Exploit chance (EPSS)
1.57%
Chance of exploitation in the next 30 days. Higher than 75.38% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-113 Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Request/Response Splitting')
CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Fix
3.12.4
Upgrade puma to this version or later

Description

Impact

If an application using Puma allows untrusted input in an early-hints header, an attacker can use a carriage return character to end the header and inject malicious content, such as additional headers or an entirely new response body. This vulnerability is known as HTTP Response Splitting.

While not an attack in itself, response splitting is a vector for several other attacks, such as cross-site scripting (XSS).

This is related to CVE-2020-5247, which fixed this vulnerability but only for regular responses.

Patches

This has been fixed in 4.3.3 and 3.12.4.

Workarounds

Users can not allow untrusted/user input in the Early Hints response header.

For more information

If you have any questions or comments about this advisory:

Affected versions

RubyGems

PackageVulnerableFixed in
puma
< 3.12.4
3.12.4
puma
>= 4.0.0, < 4.3.3
4.3.3

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

puma RubyGems → 3.12.4

bundler
bundle update puma # Gemfile: gem "puma", ">= 3.12.4"

Severity breakdown

CVSS 3.1 6.5

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

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
Low

Weakness

CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Request/Response Splitting')

The product receives data from an HTTP agent/component (e.g., web server, proxy, browser, etc.), but it does not neutralize or incorrectly neutralizes CR and LF characters before the data is included in outgoing HTTP headers.

How to prevent it
  • Implementation: Construct HTTP headers very carefully, avoiding the use of non-validated input data.
  • Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. If an input does not strictly conform to specifications, reject it or transform it into something that conforms. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
  • Implementation: Use and specify an output encoding that can be handled by the downstream component that is reading the output. Common encodings include ISO-8859-1, UTF-7, and UTF-8. When an encoding is not specified, a downstream component may choose a different encoding, either by assuming a default encoding or automatically inferring which encoding is being used, which can be erroneous. When the encodings are inconsistent, the downstream component might treat some character or byte sequences as special, even if they are not special in the original encoding. Attackers might then be able to exploit this discrepancy and conduct injection attacks; they even might be able to bypass protection mechanisms that assume the original encoding is also being used by the downstream component.
  • Implementation: Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.

CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')

The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.

How to prevent it
  • Requirements: Programming languages and supporting technologies might be chosen which are not subject to these issues.
  • Implementation: Utilize an appropriate mix of allowlist and denylist parsing to filter control-plane syntax from all input.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-2vqw-3mp8-cgmx
Puma PROXY Protocol v1 Accepts Repeated Protocol Headers on Persistent Connections
High Also affects puma
GHSA-qpgp-93vx-g8v8
Puma PROXY Protocol v1 Parser Allows Remote Memory Exhaustion
High Also affects puma
GHSA-9hf4-67fc-4vf4
Puma's header normalization allows for client to clobber proxy set headers
Medium Also affects puma
GHSA-c2f4-cvqm-65w2
Puma HTTP Request/Response Smuggling vulnerability
High Also affects puma
GHSA-68xg-gqqm-vgj8
Puma HTTP Request/Response Smuggling vulnerability
Critical Also affects puma
GHSA-h99w-9q5r-gjq9
Puma vulnerable to HTTP Request Smuggling
Critical Also affects puma
GHSA-rmj8-8hhh-gv5h
Puma used with Rails may lead to Information Exposure
High Also affects puma
GHSA-48w2-rm65-62xx
Puma with proxy which forwards LF characters as line endings could allow HTTP request smuggling
Low Also affects puma
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor