Rails 6.0 Vulnerabilities

In order to calculate Rails 6.0 vulnerabilities we created an application using the latest patch version of Rails 6.0 and we ran bundler-audit to find all known vulnerabilities.

Here we list the security risks related to a sample Rails 6.0 application.

VULNERABLE GEM: actionpack@6.0.6.1

Name:

actionpack

Version:

6.0.6.1

ID:

CVE-2023-28362

Possible XSS via User Supplied Values to redirect_to

Description

The redirect_to method in Rails allows provided values to contain characters which are not legal in an HTTP header value. This results in the potential for downstream services which enforce RFC compliance on HTTP response headers to remove the assigned Location header. This vulnerability has been assigned the CVE identifier CVE-2023-28362.

Versions Affected: All. Not affected: None. Fixed Versions: 7.0.5.1, 6.1.7.4.

Impact

This introduces the potential for a Cross-site-scripting (XSS) payload to be delivered on the now static redirection page. Note that this both requires user interaction and for a Rails app to be configured to allow redirects to external hosts (defaults to false in Rails >= 7.0.x).

Releases

The FIXED releases are available at the normal locations.

Workarounds

Avoid providing user supplied URLs with arbitrary schemes to the redirect_to method.

VULNERABLE GEM: actionpack@6.0.6.1

Name:

actionpack

Version:

6.0.6.1

ID:

CVE-2023-22792

ReDoS based DoS vulnerability in Action Dispatch

Description

There is a possible regular expression based DoS vulnerability in Action Dispatch. This vulnerability has been assigned the CVE identifier CVE-2023-22792.

Versions Affected: >= 3.0.0. Not affected: < 3.0.0. Fixed Versions: 5.2.8.15 (Rails LTS), 6.1.7.1, 7.0.4.1.

Impact

Specially crafted cookies, in combination with a specially crafted XFORWARDEDHOST header can cause the regular expression engine to enter a state of catastrophic backtracking. This can cause the process to use large amounts of CPU and memory, leading to a possible DoS vulnerability All users running an affected release should either upgrade or use one of the workarounds immediately.

Workarounds

We recommend that all users upgrade to one of the FIXED versions. In the meantime, users can mitigate this vulnerability by using a load balancer or other device to filter out malicious XFORWARDEDHOST headers before they reach the application.

VULNERABLE GEM: actionpack@6.0.6.1

Name:

actionpack

Version:

6.0.6.1

ID:

CVE-2023-22795

ReDoS based DoS vulnerability in Action Dispatch

Description

There is a possible regular expression based DoS vulnerability in Action Dispatch related to the If-None-Match header. This vulnerability has been assigned the CVE identifier CVE-2023-22795.

Versions Affected: All. Not affected: None. Fixed Versions: 5.2.8.15 (Rails LTS), 6.1.7.1, 7.0.4.1.

Impact

A specially crafted HTTP If-None-Match header can cause the regular expression engine to enter a state of catastrophic backtracking, when on a version of Ruby below 3.2.0. This can cause the process to use large amounts of CPU and memory, leading to a possible DoS vulnerability All users running an affected release should either upgrade or use one of the workarounds immediately.

Workarounds

We recommend that all users upgrade to one of the FIXED versions. In the meantime, users can mitigate this vulnerability by using a load balancer or other device to filter out malicious If-None-Match headers before they reach the application.

Users on Ruby 3.2.0 or greater are not affected by this vulnerability.

VULNERABLE GEM: actionview@6.0.6.1

Name:

actionview

Version:

6.0.6.1

ID:

CVE-2023-23913

DOM Based Cross-site Scripting in rails-ujs for contenteditable HTML Elements

Description

NOTE: rails-ujs is part of Rails/actionview since 5.1.0.

There is a potential DOM based cross-site scripting issue in rails-ujs which leverages the Clipboard API to target HTML elements that are assigned the contenteditable attribute. This has the potential to occur when pasting malicious HTML content from the clipboard that includes a data-method, data-remote or data-disable-with attribute.

This vulnerability has been assigned the CVE identifier CVE-2023-23913.

Not affected: < 5.1.0 Versions Affected: >= 5.1.0 Fixed Versions: 6.1.7.3, 7.0.4.3

Impact If the specified malicious HTML clipboard content is provided to a contenteditable element, this could result in the arbitrary execution of javascript on the origin in question.

Releases The FIXED releases are available at the normal locations.

Workarounds We recommend that all users upgrade to one of the FIXED versions. In the meantime, users can attempt to mitigate this vulnerability by removing the contenteditable attribute from elements in pages that rails-ujs will interact with.

Patches To aid users who aren’t able to upgrade immediately we have provided patches for the two supported release series. They are in git-am format and consist of a single changeset.

rails-ujs-data-method-contenteditable-6-1.patch - Patch for 6.1 series
rails-ujs-data-method-contenteditable-7-0.patch - Patch for 7.0 series

Please note that only the 7.0.Z and 6.1.Z series are supported at present, and 6.0.Z for severe vulnerabilities.

Users of earlier unsupported releases are advised to upgrade as soon as possible as we cannot guarantee the continued availability of security fixes for unsupported releases.

Credits We would like to thank ryotak 15 for reporting this!

rails-ujs-data-method-contenteditable-6-1.patch (8.5 KB)
rails-ujs-data-method-contenteditable-7-0.patch (8.5 KB)
rails-ujs-data-method-contenteditable-main.patch (8.9 KB)

VULNERABLE GEM: activerecord@6.0.6.1

Name:

activerecord

Version:

6.0.6.1

ID:

CVE-2022-44566

Denial of Service Vulnerability in ActiveRecord’s PostgreSQL adapter

Description

There is a potential denial of service vulnerability present in ActiveRecord’s PostgreSQL adapter.

This has been assigned the CVE identifier CVE-2022-44566.

Versions Affected: All. Not affected: None. Fixed Versions: 5.2.8.15 (Rails LTS), 6.1.7.1, 7.0.4.1.

Impact

In ActiveRecord <7.0.4.1 and <6.1.7.1, when a value outside the range for a 64bit signed integer is provided to the PostgreSQL connection adapter, it will treat the target column type as numeric. Comparing integer values against numeric values can result in a slow sequential scan resulting in potential Denial of Service.

Workarounds

Ensure that user supplied input which is provided to ActiveRecord clauses do not contain integers wider than a signed 64bit representation or floats.

VULNERABLE GEM: activesupport@6.0.6.1

Name:

activesupport

Version:

6.0.6.1

ID:

CVE-2023-22796

ReDoS based DoS vulnerability in Active Support’s underscore

Description

There is a possible regular expression based DoS vulnerability in Active Support. This vulnerability has been assigned the CVE identifier CVE-2023-22796.

Versions Affected: All. Not affected: None. Fixed Versions: 5.2.8.15 (Rails LTS), 6.1.7.1, 7.0.4.1.

Impact

A specially crafted string passed to the underscore method can cause the regular expression engine to enter a state of catastrophic backtracking. This can cause the process to use large amounts of CPU and memory, leading to a possible DoS vulnerability.

This affects String#underscore, ActiveSupport::Inflector.underscore, String#titleize, and any other methods using these.

All users running an affected release should either upgrade or use one of the workarounds immediately.

Workarounds

There are no feasible workarounds for this issue.

Users on Ruby 3.2.0 or greater may be able to reduce the impact by configuring Regexp.timeout.

VULNERABLE GEM: activesupport@6.0.6.1

Name:

activesupport

Version:

6.0.6.1

ID:

CVE-2023-38037

Possible File Disclosure of Locally Encrypted Files

Description

There is a possible file disclosure of locally encrypted files in Active Support. This vulnerability has been assigned the CVE identifier CVE-2023-38037.

Versions Affected: >= 5.2.0. Not affected: < 5.2.0. Fixed Versions: 7.0.7.1, 6.1.7.5.

Impact

ActiveSupport::EncryptedFile writes contents that will be encrypted to a temporary file. The temporary file’s permissions are defaulted to the user’s current umask settings, meaning that it’s possible for other users on the same system to read the contents of the temporary file.

Attackers that have access to the file system could possibly read the contents of this temporary file while a user is editing it.

All users running an affected release should either upgrade or use one of the workarounds immediately.

Releases

The fixed releases are available at the normal locations.

Workarounds

To work around this issue, you can set your umask to be more restrictive like this:

$ umask 0077

VULNERABLE GEM: activesupport@6.0.6.1

Name:

activesupport

Version:

6.0.6.1

ID:

CVE-2023-28120

Possible XSS Security Vulnerability in SafeBuffer#bytesplice

Description

There is a vulnerability in ActiveSupport if the new bytesplice method is called on a SafeBuffer with untrusted user input. This vulnerability has been assigned the CVE identifier CVE-2023-28120.

Versions Affected: All. Not affected: None. Fixed Versions: 7.0.4.3, 6.1.7.3.

Impact

ActiveSupport uses the SafeBuffer string subclass to tag strings as htmlsafe after they have been sanitized. When these strings are mutated, the tag is should be removed to mark them as no longer being htmlsafe.

Ruby 3.2 introduced a new bytesplice method which ActiveSupport did not yet understand to be a mutation. Users on older versions of Ruby are likely unaffected.

All users running an affected release and using bytesplice should either upgrade or use one of the workarounds immediately.

Workarounds

Avoid calling bytesplice on a SafeBuffer (html_safe) string with untrusted user input.

VULNERABLE GEM: nokogiri@1.13.01

Name:

nokogiri

Version:

1.13.01

ID:

GHSA-pxvg-2qj5-37jq

Update packaged libxml2 to v2.10.4 to resolve multiple CVEs

Description

SUMMARY

Nokogiri v1.14.3 upgrades the packaged version of its dependency libxml2 to v2.10.4 from v2.10.3.

libxml2 v2.10.4 addresses the following known vulnerabilities:

CVE-2023-29469: Hashing of empty dict strings isn't deterministic
CVE-2023-28484: Fix null deref in xmlSchemaFixupComplexType Schemas: Fix null-pointer-deref in xmlSchemaCheckCOSSTDerivedOK

Please note that this advisory only applies to the CRuby implementation of Nokogiri < 1.14.3, and only if the packaged libraries are being used. If you've overridden defaults at installation time to use system libraries instead of packaged libraries, you should instead pay attention to your distro's libxml2 release announcements.

MITIGATION

Upgrade to Nokogiri >= 1.14.3.

Users who are unable to upgrade Nokogiri may also choose a more complicated mitigation: compile and link Nokogiri against external libraries libxml2 >= 2.10.4 which will also address these same issues.

Impact

No public information has yet been published about the security-related issues other than the upstream commits. Examination of those changesets indicate that the more serious issues relate to libxml2 dereferencing NULL pointers and potentially segfaulting while parsing untrusted inputs.

[CVE-2023-29469] Hashing of empty dict strings isn't deterministic (09a2dd45)
[CVE-2023-28484] Fix null deref in xmlSchemaFixupComplexType (647e072e)
schemas: Fix null-pointer-deref in xmlSchemaCheckCOSSTDerivedOK (4c6922f7)

Workarounds

Avoid calling bytesplice on a SafeBuffer (html_safe) string with untrusted user input.

VULNERABLE GEM: puma@4.3.12

Name:

puma

Version:

4.3.12

ID:

CVE-2023-40175

Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling') in puma

Description

Impact

Prior to version 6.3.1, puma exhibited incorrect behavior when parsing chunked transfer encoding bodies and zero-length Content-Length headers in a way that allowed HTTP request smuggling.

The following vulnerabilities are addressed by this advisory: - Incorrect parsing of trailing fields in chunked transfer encoding bodies - Parsing of blank/zero-length Content-Length headers

PATCHES

The vulnerability has been fixed in 6.3.1 and 5.6.7.

Workarounds

No known workarounds.

REFERENCES

HTTP Request Smuggling

VULNERABLE GEM: puma@4.3.12

Name:

puma

Version:

4.3.12

ID:

CVE-2024-21647

Puma HTTP Request/Response Smuggling vulnerability

Description

Impact

Prior to versions 6.4.2 and 5.6.8, puma exhibited incorrect behavior when parsing chunked transfer encoding bodies in a way that allowed HTTP request smuggling.

Fixed versions limit the size of chunk extensions. Without this limit, an attacker could cause unbounded resource (CPU, network bandwidth) consumption.

PATCHES

The vulnerability has been fixed in 6.4.2 and 5.6.8.

Workarounds

No known workarounds.

REFERENCES

HTTP Request Smuggling Open an issue in See our security policy