Vulnerabilities

13 via 50 paths

Dependencies

58

Source

GitHub

Commit

b44d1798

Find, fix and prevent vulnerabilities in your code.

Severity
  • 1
  • 4
  • 8
Status
  • 13
  • 0
  • 0

critical severity

Arbitrary Code Injection

  • Vulnerable module: rack
  • Introduced through: rack@2.2.3, capybara@3.35.3 and others

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack@2.2.3
    Remediation: Upgrade to rack@2.2.3.1.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack-jekyll@0.5.0 rack@2.2.3
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack-test@1.1.0 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.

Overview

rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Affected versions of this package are vulnerable to Arbitrary Code Injection. There is a possible shell-escape sequence injection vulnerability in Rack's Lint and CommonLogger components. Carefully crafted requests can cause shell escape sequences to be written to the terminal via Rack's Lint middleware and CommonLogger middleware. These escape sequences can be leveraged to possibly execute commands in the victim's terminal.

Notes:

Impacted applications will have either of these middleware installed, and vulnerable apps may have something like this:use Rack::Lint or use Rack::CommonLogger.

Remediation

Upgrade rack to version 2.0.9.1, 2.1.4.1, 2.2.3.1 or higher.

References

high severity

NULL Pointer Dereference

  • Vulnerable module: nokogiri
  • Introduced through: capybara@3.35.3 and html-proofer@3.19.1

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 nokogiri@1.13.6
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 xpath@3.2.0 nokogiri@1.13.6
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 html-proofer@3.19.1 nokogumbo@2.0.5 nokogiri@1.13.6
    Remediation: Upgrade to html-proofer@3.19.1.

Overview

nokogiri is a gem for parsing HTML, XML, SAX, and Reader.

Affected versions of this package are vulnerable to NULL Pointer Dereference due to the usage of a vulnerable version of the bundled libxml2 package.

Remediation

Upgrade nokogiri to version 1.13.9 or higher.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: rack
  • Introduced through: rack@2.2.3, capybara@3.35.3 and others

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack@2.2.3
    Remediation: Upgrade to rack@2.2.3.1.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack-jekyll@0.5.0 rack@2.2.3
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack-test@1.1.0 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.

Overview

rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Affected versions of this package are vulnerable to Denial of Service (DoS) via the multipart parsing component. Exploiting this vulnerability is possible when carefully crafted multipart POST requests cause Rack's multipart parser to take much longer than expected.

Notes:

Impacted code will use Rack's multipart parser to parse multipart posts. This includes directly using the multipart parser like this:

params = Rack::Multipart.parse_multipart(env)

It also includes reading POST data from a Rack request object like this:

p request.POST # read POST data 

p request.params # reads both query params and POST data

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade rack to version 2.0.9.1, 2.1.4.1, 2.2.3.1 or higher.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: rack
  • Introduced through: rack@2.2.3, capybara@3.35.3 and others

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack@2.2.3
    Remediation: Upgrade to rack@2.2.6.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack-jekyll@0.5.0 rack@2.2.3
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack-test@1.1.0 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.

Overview

rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Affected versions of this package are vulnerable to Denial of Service (DoS) via the Multipart MIME parsing functionality in parser.rb, which doesn't limit the number of total parts that can be uploaded. Exploiting this vulnerability is possible via a carefully crafted request, which might result in multipart parsing taking longer than expected.

Workaround

A proxy can be configured to limit the POST body size, which will mitigate this issue.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade rack to version 2.0.9.3, 2.1.4.3, 2.2.6.3, 3.0.4.2 or higher.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: rack
  • Introduced through: rack@2.2.3, capybara@3.35.3 and others

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack@2.2.3
    Remediation: Upgrade to rack@2.2.8.1.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack-jekyll@0.5.0 rack@2.2.3
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack-test@1.1.0 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.

Overview

rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Affected versions of this package are vulnerable to Denial of Service (DoS) in handling of the Range request header. Carefully crafted Range headers can cause a server to respond with an unexpectedly large response. This issue is present when the Rack::File middleware or the Rack::Utils.byte_ranges methods are used (which includes applications built with Rails).

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade rack to version 2.2.8.1, 3.0.9.1 or higher.

References

medium severity

Use After Free

  • Vulnerable module: nokogiri
  • Introduced through: capybara@3.35.3 and html-proofer@3.19.1

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 nokogiri@1.13.6
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 xpath@3.2.0 nokogiri@1.13.6
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 html-proofer@3.19.1 nokogumbo@2.0.5 nokogiri@1.13.6
    Remediation: Upgrade to html-proofer@3.19.1.

Overview

nokogiri is a gem for parsing HTML, XML, SAX, and Reader.

Affected versions of this package are vulnerable to Use After Free via the xmlTextReader module. An attacker can cause denial of service by processing crafted XML documents with DTD validation and XInclude expansion enabled.

Remediation

Upgrade nokogiri to version 1.15.6, 1.16.2 or higher.

References

medium severity

Web Cache Poisoning

  • Vulnerable module: rack
  • Introduced through: rack@2.2.3, capybara@3.35.3 and others

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack@2.2.3
    Remediation: Upgrade to rack@3.0.0.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack-jekyll@0.5.0 rack@2.2.3
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack-test@1.1.0 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.

Overview

rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Affected versions of this package are vulnerable to Web Cache Poisoning by using a vector called parameter cloaking. When the attacker can separate query parameters using a semicolon (;), they can cause a difference in the interpretation of the request between the proxy (running with default configuration) and the server. This can result in malicious requests being cached as completely safe ones, as the proxy would usually not see the semicolon as a separator, and therefore would not include it in a cache key of an unkeyed parameter.

PoC

GET /?q=legitimate&utm_content=1;q=malicious HTTP/1.1

Host: somesite.com

Upgrade-Insecure-Requests: 1		

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,imag e/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate			

Accept-Language: en-US,en;q=0.9 Connection: close			

The server sees 3 parameters here: q, utm_content and then q again. On the other hand, the proxy considers this full string: 1;q=malicious as the value of utm_content, which is why the cache key would only contain somesite.com/?q=legitimate.

Remediation

Upgrade rack to version 3.0.0.beta1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: rack
  • Introduced through: rack@2.2.3, capybara@3.35.3 and others

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack@2.2.3
    Remediation: Upgrade to rack@2.2.6.1.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack-jekyll@0.5.0 rack@2.2.3
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack-test@1.1.0 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.

Overview

rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in Content-Disposition header parsing in multipart/parser.rb.

NOTE: Patches have been released to address this issue: 2-0-Fix-ReDoS-vulnerability-in-multipart-parser, 2-1-Fix-ReDoS-vulnerability-in-multipart-parser, 2-2-Fix-ReDoS-vulnerability-in-multipart-parser, 3-0-Fix-ReDoS-vulnerability-in-multipart-parser

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade rack to version 2.0.9.2, 2.1.4.2, 2.2.6.1, 3.0.4.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: rack
  • Introduced through: rack@2.2.3, capybara@3.35.3 and others

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack@2.2.3
    Remediation: Upgrade to rack@2.2.6.1.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack-jekyll@0.5.0 rack@2.2.3
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack-test@1.1.0 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.

Overview

rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in RFC2183 multipart boundary parsing in multipart/parser.rb. An attacker can trigger resource exhaustion by passing in a string involving control characters.

NOTE: 2-0-Forbid-control-characters-in-attributes.patch, 2-1-Forbid-control-characters-in-attributes.patch, 2-2-Forbid-control-characters-in-attributes.patch, 3-0-Forbid-control-characters-in-attributes.patch

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade rack to version 2.0.9.2, 2.1.4.2, 2.2.6.1, 3.0.4.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: rack
  • Introduced through: rack@2.2.3, capybara@3.35.3 and others

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack@2.2.3
    Remediation: Upgrade to rack@2.2.6.2.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack-jekyll@0.5.0 rack@2.2.3
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack-test@1.1.0 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.

Overview

rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the get_byte_ranges() range header parsing function in utils.rb.

NOTE: Patches have been released to address this issue: 2-0-Fix-ReDoS-in-Rack-Utils.get_byte_ranges.patch, 2-1-Fix-ReDoS-in-Rack-Utils.get_byte_ranges.patch, 2-2-Fix-ReDoS-in-Rack-Utils.get_byte_ranges.patch, 3-0-Fix-ReDoS-in-Rack-Utils.get_byte_ranges.patch

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade rack to version 2.0.9.2, 2.1.4.2, 2.2.6.2, 3.0.4.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: rack
  • Introduced through: rack@2.2.3, capybara@3.35.3 and others

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack@2.2.3
    Remediation: Upgrade to rack@2.2.6.4.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack-jekyll@0.5.0 rack@2.2.3
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack-test@1.1.0 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.

Overview

rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the parse_http_accept_header function in request.rb's header parsing due to the use of an insecure regex. Exploiting this vulnerability is possible by sending malicious strings as headers.

Workaround

This vulnerability can be avoided by setting Regexp.timeout in Ruby 3.2.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade rack to version 2.2.6.4, 3.0.6.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: rack
  • Introduced through: rack@2.2.3, capybara@3.35.3 and others

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack@2.2.3
    Remediation: Upgrade to rack@2.2.8.1.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack-jekyll@0.5.0 rack@2.2.3
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack-test@1.1.0 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.

Overview

rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the build_nested_query() function, used when parsing Accept and Forwarded headers.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade rack to version 2.0.9.4, 2.1.4.4, 2.2.8.1, 3.0.9.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: rack
  • Introduced through: rack@2.2.3, capybara@3.35.3 and others

Detailed paths

  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack@2.2.3
    Remediation: Upgrade to rack@2.2.8.1.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 rack-jekyll@0.5.0 rack@2.2.3
  • Introduced through: 18F/federalist.18f.gov@18F/federalist.18f.gov#b44d1798af04048dec0fe0b9a23c430cf842f965 capybara@3.35.3 rack-test@1.1.0 rack@2.2.3
    Remediation: Upgrade to capybara@3.35.3.

Overview

rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) when parsing Content-Type data in media_type.rb. Code using any of the following may be vulnerable: request.media_type, request.media_type_params, Rack::MediaType.type(content_type)

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade rack to version 2.2.8.1, 3.0.9.1 or higher.

References