Find, fix and prevent vulnerabilities in your code.
critical severity
- Vulnerable module: actionview
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5Remediation: Upgrade to actionpack@4.2.11.3.
Overview
actionview is a simple, battle-tested conventions and helpers for building web pages.
Affected versions of this package are vulnerable to Remote Code Execution (RCE). An attacker might be able to control the locals
argument of a render
call.
Note: It doesn't affect applications that don't allow users to control the names of locals.
Remediation
Upgrade actionview
to version 4.2.11.3, 5.0.1 or higher.
References
critical severity
- Vulnerable module: rack
- Introduced through: actionpack@4.2.5 and sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack@1.6.4Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack@1.6.4Remediation: Upgrade to sinatra@2.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack-test@0.6.3 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
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
critical severity
- Vulnerable module: json
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › activesupport@4.2.5 › json@1.8.3Remediation: Upgrade to actionpack@4.2.8.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › activesupport@4.2.5 › json@1.8.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › activesupport@4.2.5 › json@1.8.3Remediation: Upgrade to actionpack@4.2.8.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › rails-deprecated_sanitizer@1.0.3 › activesupport@4.2.5 › json@1.8.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › activesupport@4.2.5 › json@1.8.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › rails-deprecated_sanitizer@1.0.3 › activesupport@4.2.5 › json@1.8.3Remediation: Upgrade to actionpack@4.2.5.
Overview
json is a JSON implementation as a Ruby extension in C.
Affected versions of this package are vulnerable to Denial of Service (DoS). When parsing certain JSON documents, the json gem (including the one bundled with Ruby) can be coerced into creating arbitrary objects in the target system.
This is the same issue as CVE-2013-0269. The previous fix was incomplete, which addressed JSON.parse(user_input)
, but didn’t address some other styles of JSON
parsing including JSON(user_input) and JSON.parse(user_input, nil)
.
See CVE-2013-0269 in detail.
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:
- CCC
- CC+C
- C+CC
- 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 json
to version 2.3.0 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Uncontrolled Memory Allocation. Nokogiri bundles the libxslt
C library, that has been recently discovered to have vulnerabilities.
CVE-2019-13117
In numbers.c
in libxslt
1.1.33, an xsl:number
with certain format strings
could lead to a uninitialized read in xsltNumberFormatInsertNumbers
. This
could allow an attacker to discern whether a byte on the stack contains the
characters A
, a
, I
, i
, or 0
, or any other character.
CVE-2019-13118
In numbers.c
in libxslt
1.1.33, a type holding grouping characters of an
xsl:number
instruction was too narrow and an invalid character/length
combination could be passed to xsltNumberFormatDecimal
, leading to a read
of uninitialized stack data
CVE-2019-18197
In xsltCopyTex
t in transform.c
in libxslt
1.1.33, a pointer variable isn't
reset under certain circumstances. If the relevant memory area happened to
be freed and reused in a certain way, a bounds check could fail and memory
outside a buffer could be written to, or uninitialized data could be
disclosed.
Remediation
Upgrade nokogiri
to version 1.10.5 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri
(鋸) is an HTML, XML, SAX, and Reader parser, with the ability to search documents via XPath or CSS3 selectors.
Affected versions of the package are vulnerable to Arbitrary Code Execution or a Denial of Service (memory corruption) via a crafted web site. Nokogiri bundles the libxslt
library, which is vulnerable in versions below 3.
Denial of Service (DoS) - CVE-2016-4738
libxslt allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted web site.
Arbitrary Code Execution - CVE-2017-5029
The xsltAddTextString
function in transform.c in libxslt, lacked a check for integer overflow during a size calculation. This allowed a remote attacker to perform an out of bounds memory write via a crafted HTML page.
Remediation
Upgrade nokogiri
to version 1.7.2 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is an HTML, XML, SAX, and Reader parser. Among Nokogiri's features is the ability to search documents via XPath or CSS3 selectors.
Affected versions of this package are vulnerable to Denial of Service (DoS) due to using vulnerable version of libxml2 which incorrectly handled certain fields. An attacker could use this issue with specially constructed XML data to cause libxml2 to consume resources, leading to a denial of service.
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 nokogiri
to version 1.8.2 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri
(鋸) is an HTML, XML, SAX, and Reader parser, with the ability to search documents via XPath or CSS3 selectors.
Affected versions of the package are vulnerable to Out of Bounds Memory Write. Nokogiri bundles the libxslt
library, which is vulnerable in versions below 3. The xsltAddTextString
function in transform.c
lacked a check for integer overflow during a size calculation, which allowed a remote attacker to perform an out of bounds memory write via a crafted HTML page.
Remediation
Upgrade nokogiri
to version 1.7.2 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri
(鋸) is an HTML, XML, SAX, and Reader parser, with the ability to search documents via XPath or CSS3 selectors.
Affected versions of the package are vulnerable to many vulnerabilities, including Arbitrary Code Execution and Denial of Service (DoS), and Sensitive Information Exposure. Nokogiri bundles the libxml2
library, which is vulnerable in versions below 2.9.5.
The CVEs assigned to the vulnerabilities are:
CVE-2017-0663
It was discovered that a type confusion error existed in libxml2. An attacker could use this to specially construct XML data that could cause a denial of service or possibly execute arbitrary code.
CVE-2017-7375
It was discovered that libxml2 did not properly validate parsed entity references. An attacker could use this to specially construct XML data that could expose sensitive information.
CVE-2017-7376
It was discovered that a buffer overflow existed in libxml2 when handling HTTP redirects. An attacker could use this to specially construct XML data that could cause a denial of service or possibly execute arbitrary code.
CVE-2017-9047
Marcel Böhme and Van-Thuan Pham discovered a buffer overflow in libxml2 when handling elements. An attacker could use this to specially construct XML data that could cause a denial of service or possibly execute arbitrary code.
CVE-2017-9048
Marcel Böhme and Van-Thuan Pham discovered a buffer overread in libxml2 when handling elements. An attacker could use this to specially construct XML data that could cause a denial of service.
CVE-2017-9049, CVE-2017-9050
Marcel Böhme and Van-Thuan Pham discovered multiple buffer overreads in libxml2 when handling parameter-entity references. An attacker could use these to specially construct XML data that could cause a denial of service.
Remediation
Upgrade nokogiri
to version 1.8.1 or higher.
References
high severity
- Vulnerable module: sinatra
- Introduced through: sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2Remediation: Upgrade to sinatra@2.2.3.
Overview
Affected versions of this package are vulnerable to Resources Downloaded over Insecure Protocol due to improper validation of the Content-Disposition
header when the filename was provided by the user. Exploiting this vulnerability results in a reflected file download (RFD) attack.
Remediation
Upgrade sinatra
to version 2.2.3, 3.0.4 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Improper Handling of Unexpected Data Type due to incorrectly checking the types of arguments to various constructors in HTML4::SAX
and XML::SAX
, which causes a segmentation fault.
Remediation
Upgrade nokogiri
to version 1.13.6 or higher.
References
high severity
- Vulnerable module: activesupport
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › activesupport@4.2.5Remediation: Upgrade to actionpack@5.2.4.3.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › activesupport@4.2.5Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › activesupport@4.2.5Remediation: Upgrade to actionpack@5.2.4.3.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › rails-deprecated_sanitizer@1.0.3 › activesupport@4.2.5Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › activesupport@4.2.5Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › rails-deprecated_sanitizer@1.0.3 › activesupport@4.2.5Remediation: Upgrade to actionpack@4.2.5.
Overview
activesupport is a toolkit of support libraries and Ruby core extensions extracted from the Rails framework.
Affected versions of this package are vulnerable to Deserialization of Untrusted Data via the MemCacheStore
and RedisCacheStore
. when
untrusted user input is written to the cache store using the raw: true
parameter, re-reading the result
from the cache can evaluate the user input as a Marshalled object instead of plain text.
Remediation
Upgrade activesupport
to version 5.2.4.3, 6.0.3.1 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Command Injection via the undocumented method Nokogiri::CSS::Tokenizer#load_file
. This allows commands to be executed in a subprocess.
Remediation
Upgrade nokogiri
to version 1.10.4 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
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 ID
and IDREF
attributes, when using the xmlReader
interface with validation or when a document is parsed with XML_PARSE_DTDVALID
and without XML_PARSE_NOENT
. This can lead to the value of ID
attributes to not be normalized after potentially expanding entities in xmlRemoveID
, which will cause later calls to xmlGetID
to return a pointer to previously freed memory.
Remediation
Upgrade nokogiri
to version 1.13.2 or higher.
References
high severity
- Vulnerable module: actionpack
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5Remediation: Upgrade to actionpack@5.2.4.6.
Overview
Affected versions of this package are vulnerable to Denial of Service (DoS). There is a possible denial of service vulnerability in the Token Authentication logic in Action Controller. Impacted code uses authenticate_or_request_with_http_token
or authenticate_with_http_token
for request authentication. The issue arises due to a poorly defined regular expression AUTHN_PAIR_DELIMITERS
in actionpack/lib/action_controller/metal/http_authentication.rb
.
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 actionpack
to version 5.2.4.6, 5.2.6, 6.0.3.7, 6.1.3.2 or higher.
References
high severity
- Vulnerable module: actionpack
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5Remediation: Upgrade to actionpack@4.2.5.1.
Overview
actionpack
is a web app builder and tester on Rails.
Affected versions of this Gem are vulnerable to Denial of Service (DoS) attacks.
Ruby on Rails applications that have a route containing the string ":controller"
are susceptible to denial of service caused by unbounded memory growth.
Details
Action Pack keeps a map of url controller name
to controller class name
. This map is cached globally, and is populated even if the controller class doesn't actually exist. An attacker could flood a vulnerable application route with requests for non-existent controllers, leading to unbounded memory growth in this cache.
To identify if your application is vulnerable, look for routes that contain ":controller"
.
References
high severity
- Vulnerable module: actionpack
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5Remediation: Upgrade to actionpack@4.2.5.1.
Overview
actionpack
is a web app builder and tester on Rails.
Affected versions of this Gem are vulnerable to Denial of Service (DoS) Attacks. A carefully crafted accept header can cause a global cache of mime types to grow indefinitely which can lead to a possible denial of service attack.
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 actionpack
to versions 5.0.0.beta1.1, 4.2.5.1, 4.1.14.1, 3.2.22.1 or higher.
References
high severity
- Vulnerable module: actionview
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5Remediation: Upgrade to actionpack@4.2.5.1.
Overview
actionview
is a conventions and helpers gem for building web pages.
Affected versions of this Gem are vulnerable to directory traversal and information leaks.
Details
Applications that pass unverified user input to the render
method in a controller may be vulnerable to an information leak vulnerability.
Impacted code will look something like this:
def index
render params[:id]
end
Carefully crafted requests can cause the above code to render files from unexpected places like outside the application's view directory, and can possibly escalate this to a remote code execution attack.
All users running an affected release should either upgrade or use one of the workarounds immediately.
A workaround to this issue is to not pass arbitrary user input to the render
method. Instead, verify that data before passing it to the render
method.
For example, change this:
def index
render params[:id]
end
To this:
def index
render verify_template(params[:id])
end
private
def verify_template(name)
# add verification logic particular to your application here
end
References
high severity
- Vulnerable module: i18n
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › activesupport@4.2.5 › i18n@0.7.0Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › activesupport@4.2.5 › i18n@0.7.0Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › activesupport@4.2.5 › i18n@0.7.0Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › rails-deprecated_sanitizer@1.0.3 › activesupport@4.2.5 › i18n@0.7.0Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › activesupport@4.2.5 › i18n@0.7.0Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › rails-deprecated_sanitizer@1.0.3 › activesupport@4.2.5 › i18n@0.7.0Remediation: Upgrade to actionpack@4.2.5.
Overview
i18n is a Ruby Internationalization and localization solution.
Affected versions of this package are vulnerable to Denial of Service (DoS) attacks via the Hash#slice()
Function. An attaker may cause the program to crash by calling a hash when :some_key
is in keep_keys
but not in the hash.
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 i18n
to version 0.8.0 or higher.
References
high severity
- Vulnerable module: loofah
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3Remediation: Upgrade to actionpack@4.2.5.
Overview
loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to containing an inefficient regular expression that is susceptible to excessive backtracking when attempting to sanitize certain SVG attributes.
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:
- CCC
- CC+C
- C+CC
- 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 loofah
to version 2.19.1 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Denial of Service (DoS). Vulnerable version of libxml2
was used.
The fix to this updates the vendored libxml2
from v2.9.10 to v2.9.12 which addresses:
- CVE-2019-20388
- CVE-2020-24977
- CVE-2021-3517
- CVE-2021-3518
- CVE-2021-3537
- CVE-2021-3541
Please note that this advisory only applies to the CRuby implementation of Nokogiri
< 1.11.4
, and only if the packaged version of libxml2
is 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.
NOTE: This vulnerability has also been identified as: CVE-2021-3537, CVE-2021-3541, CVE-2020-24977, CVE-2021-3517, CVE-2021-3518
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 nokogiri
to version 1.11.4 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is an HTML, XML, SAX, and Reader parser. Among Nokogiri's features is the ability to search documents via XPath or CSS3 selectors.
Affected versions of this package are vulnerable to Denial of Service (DoS), due to using vulnerable version of libxml2. When expanding a parameter entity in a DTD, an infinite recursion could occur and halt expected execution or lead to memory exhaustion.
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 nokogiri
to version 1.8.2 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Denial of Service (DoS) via the xerces:xercesImpl
dependency, as its XML parser consumes excessive amount of resources when handling specially crafted XML document payloads due to an infinite loop.
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 nokogiri
to version 1.13.4 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Denial of Service (DoS).
It bundles the libxml2
library, which is vulnerable in versions below 2.9.10
##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 nokogiri
to version 1.10.8 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Denial of Service (DoS). Vulnerable version of libxml2
was used.
The fix to this updates the vendored libxml2
from v2.9.10 to v2.9.12 which addresses:
- CVE-2019-20388
- CVE-2020-24977
- CVE-2021-3517
- CVE-2021-3518
- CVE-2021-3537
- CVE-2021-3541
Please note that this advisory only applies to the CRuby implementation of Nokogiri
< 1.11.4
, and only if the packaged version of libxml2
is 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.
NOTE: This vulnerability has also been identified as: CVE-2021-3537, CVE-2021-3541, CVE-2019-20388, CVE-2021-3517, CVE-2021-3518
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 nokogiri
to version 1.11.4 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Denial of Service (DoS). Vulnerable version of libxml2
was used.
The fix to this updates the vendored libxml2
from v2.9.10 to v2.9.12 which addresses:
- CVE-2019-20388
- CVE-2020-24977
- CVE-2021-3517
- CVE-2021-3518
- CVE-2021-3537
- CVE-2021-3541
Please note that this advisory only applies to the CRuby implementation of Nokogiri
< 1.11.4
, and only if the packaged version of libxml2
is 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.
NOTE: This vulnerability has also been identified as: CVE-2021-3537, CVE-2021-3541, CVE-2019-20388, CVE-2020-24977, CVE-2021-3518
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 nokogiri
to version 1.11.4 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Denial of Service (DoS). Vulnerable version of libxml2
was used.
The fix to this updates the vendored libxml2
from v2.9.10 to v2.9.12 which addresses:
- CVE-2019-20388
- CVE-2020-24977
- CVE-2021-3517
- CVE-2021-3518
- CVE-2021-3537
- CVE-2021-3541
Please note that this advisory only applies to the CRuby implementation of Nokogiri
< 1.11.4
, and only if the packaged version of libxml2
is 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.
NOTE: This vulnerability has also been identified as: CVE-2021-3537, CVE-2021-3541, CVE-2019-20388, CVE-2020-24977, CVE-2021-3517
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 nokogiri
to version 1.11.4 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Denial of Service (DoS). Vulnerable version of libxml2
was used.
The fix to this updates the vendored libxml2
from v2.9.10 to v2.9.12 which addresses:
- CVE-2019-20388
- CVE-2020-24977
- CVE-2021-3517
- CVE-2021-3518
- CVE-2021-3537
- CVE-2021-3541
Please note that this advisory only applies to the CRuby implementation of Nokogiri
< 1.11.4
, and only if the packaged version of libxml2
is 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.
NOTE: This vulnerability has also been identified as: CVE-2021-3541, CVE-2019-20388, CVE-2020-24977, CVE-2021-3517, CVE-2021-3518
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 nokogiri
to version 1.11.4 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Denial of Service (DoS). Vulnerable version of libxml2
was used.
The fix to this updates the vendored libxml2
from v2.9.10 to v2.9.12 which addresses:
- CVE-2019-20388
- CVE-2020-24977
- CVE-2021-3517
- CVE-2021-3518
- CVE-2021-3537
- CVE-2021-3541
Please note that this advisory only applies to the CRuby implementation of Nokogiri
< 1.11.4
, and only if the packaged version of libxml2
is 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.
NOTE: This vulnerability has also been identified as: CVE-2021-3537, CVE-2019-20388, CVE-2020-24977, CVE-2021-3517, CVE-2021-3518
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 nokogiri
to version 1.11.4 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is an HTML, XML, SAX, and Reader parser. Among Nokogiri's features is the ability to search documents via XPath or CSS3 selectors.
Affected versions of this package are vulnerable to several Denial of Service (DoS) vulnerabilities. Nokogiri bundles the libxml2
library, which is vulnerable in versions through 2.9.6.
CVE-2018-14404
A NULL pointer dereference vulnerability exists in the xpath.c:xmlXPathCompOpEval()
function of libxml2 through 2.9.8 when parsing an invalid XPath expression in the XPATH_OP_AND
or XPATH_OP_OR
case. Applications processing untrusted XSL format inputs with the use of the libxml2 library may be vulnerable to a denial of service attack due to a crash of the application
CVE-2018-14567
If --with-lzma
is used, allows remote attackers to cause a denial of service (infinite loop) via a crafted XML file that triggers LZMA_MEMLIMIT_ERROR
, as demonstrated by xmllint
infinite loop in LZMA decompression.
Remediation
Upgrade nokogiri
to version 1.8.5 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
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
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Out-of-bounds Write via the zlib
dependency which allows memory corruption when deflating if the input has many distant matches.
Remediation
Upgrade nokogiri
to version 1.13.4 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to an expression that is susceptible to excessive backtracking when attempting to detect encoding in HTML documents.
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:
- CCC
- CC+C
- C+CC
- 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 nokogiri
to version 1.13.4 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to XML External Entity (XXE) Injection. Users of Nokogiri on JRuby who parse untrusted documents using any of these classes are affected:
Nokogiri::XML::SAX::Parse
Nokogiri::HTML4::SAX::Parser
or its aliasNokogiri::HTML::SAX::Parser
Nokogiri::XML::SAX::PushParser
Nokogiri::HTML4::SAX::PushParser
or its aliasNokogiri::HTML::SAX::PushParser
.
CRuby users are not affected.
Details
XXE Injection is a type of attack against an application that parses XML input. XML is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. By default, many XML processors allow specification of an external entity, a URI that is dereferenced and evaluated during XML processing. When an XML document is being parsed, the parser can make a request and include the content at the specified URI inside of the XML document.
Attacks can include disclosing local files, which may contain sensitive data such as passwords or private user data, using file: schemes or relative paths in the system identifier.
For example, below is a sample XML document, containing an XML element- username.
<xml>
<?xml version="1.0" encoding="ISO-8859-1"?>
<username>John</username>
</xml>
An external XML entity - xxe
, is defined using a system identifier and present within a DOCTYPE header. These entities can access local or remote content. For example the below code contains an external XML entity that would fetch the content of /etc/passwd
and display it to the user rendered by username
.
<xml>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///etc/passwd" >]>
<username>&xxe;</username>
</xml>
Other XXE Injection attacks can access local resources that may not stop returning data, possibly impacting application availability and leading to Denial of Service.
Remediation
Upgrade nokogiri
to version 1.12.5 or higher.
References
high severity
- Vulnerable module: rack
- Introduced through: actionpack@4.2.5 and sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack@1.6.4Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack@1.6.4Remediation: Upgrade to sinatra@2.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack-test@0.6.3 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
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
- Vulnerable module: rack
- Introduced through: actionpack@4.2.5 and sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack@1.6.4Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack@1.6.4Remediation: Upgrade to sinatra@2.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack-test@0.6.3 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
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
- Vulnerable module: rack
- Introduced through: actionpack@4.2.5 and sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack@1.6.4Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack@1.6.4Remediation: Upgrade to sinatra@2.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack-test@0.6.3 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
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
high severity
- Vulnerable module: rack
- Introduced through: actionpack@4.2.5 and sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack@1.6.4Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack@1.6.4Remediation: Upgrade to sinatra@2.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack-test@0.6.3 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
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 Directory Traversal. If certain directories exist in a directory that is managed by Rack::Directory
, an attacker could, using this vulnerability, read the contents of files on the server that were outside of the root specified in the Rack::Directory
initializer.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st
is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public
route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e
is the URL encoded version of .
(dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip
.
One way to achieve this is by using a malicious zip
archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip
archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/
overwriting the authorized_keys
file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade rack
to version 2.1.3 or higher.
References
high severity
- Vulnerable module: rails-html-sanitizer
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3Remediation: Upgrade to actionpack@4.2.5.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) which leads to excessive backtracking when attempting to sanitize certain SVG
attributes. This can lead to CPU resource consumption.
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:
- CCC
- CC+C
- C+CC
- 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 rails-html-sanitizer
to version 1.4.4 or higher.
References
high severity
- Vulnerable module: sinatra
- Introduced through: sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2Remediation: Upgrade to sinatra@2.2.0.
Overview
Affected versions of this package are vulnerable to Improper Input Validation by not validating that the expanded path matches public_dir
when serving static files.
Remediation
Upgrade sinatra
to version 2.2.0 or higher.
References
high severity
- Vulnerable module: tzinfo
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › activesupport@4.2.5 › tzinfo@1.2.2Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › activesupport@4.2.5 › tzinfo@1.2.2Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › activesupport@4.2.5 › tzinfo@1.2.2Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › rails-deprecated_sanitizer@1.0.3 › activesupport@4.2.5 › tzinfo@1.2.2Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › activesupport@4.2.5 › tzinfo@1.2.2Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › rails-deprecated_sanitizer@1.0.3 › activesupport@4.2.5 › tzinfo@1.2.2Remediation: Upgrade to actionpack@4.2.5.
Overview
Affected versions of this package are vulnerable to Directory Traversal. TZInfo::Timezone.get
fails to validate time zone identifiers correctly, allowing a new line character within the identifier. With Ruby version 1.9.3 and later, TZInfo::Timezone.get
can be made to load unintended files with require
, executing them within the Ruby process.
This could be exploited in, for example, a Ruby on Rails application using a vulnerable version of tzinfo, that allows file uploads and has a time zone selector that accepts arbitrary time zone identifiers.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st
is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public
route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e
is the URL encoded version of .
(dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip
.
One way to achieve this is by using a malicious zip
archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip
archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/
overwriting the authorized_keys
file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade tzinfo
to version 0.3.61, 1.2.10 or higher.
References
high severity
- Vulnerable module: actionpack
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5Remediation: Upgrade to actionpack@5.2.6.2.
Overview
Affected versions of this package are vulnerable to Information Exposure via the ActionDispatch::Executor
function, which expects response bodies to be closed and will not know to reset a thread's local state for the next request in a case where a response body isn't closed, allowing for data in the current request to leak to a subsequent request.
Remediation
Upgrade actionpack
to version 5.2.6.2, 6.0.4.6, 6.1.4.6, 7.0.2.2 or higher.
References
high severity
- Vulnerable module: actionpack
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5Remediation: Upgrade to actionpack@4.2.5.2.
Overview
actionpack
is a web app builder and tester on Rails.
Affected versions of this Gem are vulnerable to Arbitrary Code Injection.
Details
Applications that pass unverified user input to the render
method in a
controller or a view may be vulnerable to a code injection.
Impacted code will look like this:
class TestController < ApplicationController
def show
render params[:id]
end
end
An attacker could use the request parameters to coerce the above example to execute arbitrary ruby code.
All users running an affected release should either upgrade or use one of the workarounds immediately.
References
high severity
- Vulnerable module: httparty
- Introduced through: httparty@0.8.1
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › httparty@0.8.1Remediation: Upgrade to httparty@0.10.0.
Overview
httparty
makes consuming restful web services easy.
Affected versions of this gem contains a flaw that is triggered when a type casting error occurs during the parsing of parameters. This may allow a context-dependent attacker to potentially execute arbitrary code.
References
high severity
- Vulnerable module: loofah
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3Remediation: Upgrade to actionpack@4.2.5.
Overview
loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS). Unsanitized JavaScript may occur in sanitized output when a crafted SVG element is republished.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
ֿInjecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade loofah
to version 2.3.1 or higher.
References
high severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to XML External Entity (XXE) Injection when opting into the DTDLOAD
option and opting out of the NONET
option.
Nokogiri
is affected by series of vulnerabilities in libxml2 and libxslt, which are libraries it depends on. When handling the expansion of XML external entities (XXE) in libxml2, you can specify documents to be read. Opting into the DTDLOAD
option and opting out of the NONET
option in Nokogiri
allows unknown documents to be loaded from the network. This can be used by attackers to load specially crafted XML documents on an internal XML parsing service and may lead to unauthorized disclosure of potentially sensitive information.
Note: This vulnerability exists also in versions <1.5.4
regardless of the options opted into or out of. See more information here
Disclosure Timeline
- January 11th, 2017 - Reported the issue to Mike Dalessio of Nokogiri Core.
- January 11th, 2017 - Issue triaged and acknowledged by Mike Dalessio of Nokogiri Core.
- June 16th, 2018 - A fix has been introduced in Nokogiri 1.8.3 through libxml2 2.9.8.
Details
XXE Injection is a type of attack against an application that parses XML input. XML is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. By default, many XML processors allow specification of an external entity, a URI that is dereferenced and evaluated during XML processing. When an XML document is being parsed, the parser can make a request and include the content at the specified URI inside of the XML document.
Attacks can include disclosing local files, which may contain sensitive data such as passwords or private user data, using file: schemes or relative paths in the system identifier.
For example, below is a sample XML document, containing an XML element- username.
<xml>
<?xml version="1.0" encoding="ISO-8859-1"?>
<username>John</username>
</xml>
An external XML entity - xxe
, is defined using a system identifier and present within a DOCTYPE header. These entities can access local or remote content. For example the below code contains an external XML entity that would fetch the content of /etc/passwd
and display it to the user rendered by username
.
<xml>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///etc/passwd" >]>
<username>&xxe;</username>
</xml>
Other XXE Injection attacks can access local resources that may not stop returning data, possibly impacting application availability and leading to Denial of Service.
Remediation
Upgrade nokogiri
to version 1.8.3 or higher.
References
medium severity
- Vulnerable module: actionpack
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5Remediation: Upgrade to actionpack@5.2.4.3.
Overview
Affected versions of this package are vulnerable to Cross-site Request Forgery (CSRF) given a global CSRF token such as the one present in the authenticity_token
meta tag.
Remediation
Upgrade actionpack
to version 5.2.4.3, 6.0.3.1 or higher.
References
medium severity
- Vulnerable module: actionpack
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5Remediation: Upgrade to actionpack@5.2.4.3.
Overview
Affected versions of this package are vulnerable to Information Exposure by Bypassing Strong Parameters. Specifically the return value of each
, or each_value
,
or each_pair
will return the underlying "untrusted" hash of data that was
read from the parameters.
Remediation
Upgrade actionpack
to version 5.2.4.3, 6.0.3.1 or higher.
References
medium severity
- Vulnerable module: actionview
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5Remediation: Upgrade to actionpack@5.2.4.2.
Overview
actionview is a simple, battle-tested conventions and helpers for building web pages.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) in the j
and escape_javascript
methods. These methods are used for escaping JavaScript string
literals.
Proof Of Concept/Example
<script>let a = `<%= j unknown_input %>`</script>
<script>let a = `<%= escape_javascript unknown_input %>`</script>
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade actionview
to version 5.2.4.2, 6.0.2.2 or higher.
References
medium severity
- Vulnerable module: httparty
- Introduced through: httparty@0.8.1
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › httparty@0.8.1Remediation: Upgrade to httparty@0.21.0.
Overview
Affected versions of this package are vulnerable to External Control of Assumed-Immutable Web Parameter due to improper escape of the "
character in the generate_multipart
function, which allows injecting malicious content to the filename
parameter via the Content-Disposition
header.
PoC
Content-Disposition: form-data; name="avatar"; filename="overwrite_name_field_and_extension.sh"; name="foo"; dummy=".txt"
Remediation
Upgrade httparty
to version 0.21.0 or higher.
References
medium severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Denial of Service (DoS). The xz_head
function in xzlib.c in libxml2
(embedded in nokogiri) before 2.9.6 allows remote attackers to cause a denial of service (memory consumption) via a crafted LZMA file, because the decoder functionality does not restrict memory usage to what is required for a legitimate file.
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 nokogiri
to version 1.8.2 or higher.
References
medium severity
- Vulnerable module: rack
- Introduced through: actionpack@4.2.5 and sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack@1.6.4Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack@1.6.4Remediation: Upgrade to sinatra@2.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack-test@0.6.3 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
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 Cross-site Request Forgery (CSRF). It is possible to forge a secure or host-only cookie prefix in Rack using an arbitrary cookie write by using URL encoding (percent-encoding) on the name of the cookie. This could result in an application that is dependent on this prefix to determine if a cookie is safe to process being manipulated into processing an insecure or cross-origin request.
Remediation
Upgrade rack
to version 2.1.4, 2.2.3 or higher.
References
medium severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to Access Control Bypass due to the usage of a vulnerable dependency package (libxslt
), which allows bypass of a protection mechanism because callers of xsltCheckRead
and xsltCheckWrite
permit access even upon receiving a -1
error code. xsltCheckRead
can return -1
for a crafted URL that is not actually invalid and is subsequently loaded.
Remediation
Upgrade nokogiri
to version 1.10.3 or higher.
References
medium severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
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
- Vulnerable module: actionview
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5Remediation: Upgrade to actionpack@4.2.7.1.
Overview
actionview
is a conventions and helpers gem for building web pages.
Affected versions of this Gem are vulnerable to Cross-site Scripting (XSS) attacks via unescaped quotes when used as attribute values in tag helpers.
Text declared as "HTML safe" when passed as an attribute value to a tag helper will not have quotes escaped which can lead to a Cross-site Scripting (XSS) attack. Impacted code looks something like this:
content_tag(:div, "hi", title: user_input.html_safe)
Some helpers like the sanitize
helper will automatically mark strings as "HTML safe", so impacted code could also look something like this:
content_tag(:div, "hi", title: sanitize(user_input))
All users running an affected release should either upgrade or use one of the workarounds immediately.
You can work around this issue by either not marking arbitrary user input as safe, or by manually escaping quotes like this:
def escape_quotes(value)
value.gsub(/"/, '"'.freeze)
end
content_tag(:div, "hi", title: escape_quotes(sanitize(user_input)))
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
ֿInjecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
References
medium severity
- Vulnerable module: activesupport
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › activesupport@4.2.5Remediation: Upgrade to actionpack@6.1.7.3.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › activesupport@4.2.5Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › activesupport@4.2.5Remediation: Upgrade to actionpack@6.1.7.3.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › rails-deprecated_sanitizer@1.0.3 › activesupport@4.2.5Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › activesupport@4.2.5Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › rails-deprecated_sanitizer@1.0.3 › activesupport@4.2.5Remediation: Upgrade to actionpack@4.2.5.
Overview
activesupport is a toolkit of support libraries and Ruby core extensions extracted from the Rails framework.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) when using the SafeBuffer#bytesplice()
function, the output of which is not treated as mutated and therefore improperly tagged as html_safe
although it may contain executable scripts.
Workaround
Avoid calling bytesplice
on a SafeBuffer (html_safe)
string with untrusted user input.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade activesupport
to version 6.1.7.3, 7.0.4.3 or higher.
References
medium severity
- Vulnerable module: loofah
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3Remediation: Upgrade to actionpack@4.2.5.
Overview
Loofah is a general library for manipulating and transforming HTML/XML documents and fragments.
Affected versions fo this package are vulnerable to Cross-site Scripting (XSS) attacks. It allows non-whitelisted attributes to be present in sanitized output when input with specially-crafted HTML fragments.
The vulnerability is possible only when the following conditions are met:
- when running on MRI or RBX,
- in combination with libxml2 >= 2.9.2.
Note : JRuby users are not affected.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
ֿInjecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade Loofah
to version 2.2.1 or higher.
References
medium severity
- Vulnerable module: rack
- Introduced through: actionpack@4.2.5 and sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack-test@0.6.3 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
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 Cross-site Scripting (XSS) via the scheme
method on Rack::Request
.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade rack
to version 1.6.11, 2.0.6 or higher.
References
medium severity
- Vulnerable module: rails-html-sanitizer
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3Remediation: Upgrade to actionpack@4.2.5.
Overview
Affected versions of this package are vulnerable to Cross-site Scripting (XSS). The gem allows non-whitelisted attributes to be present in sanitized output when input with specially-crafted HTML fragments, and these attributes can lead to an XSS attack on target applications.
This issue is similar to CVE-2018-8048 in Loofah.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
ֿInjecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade rails-html-sanitizer
to version 1.0.4 or higher.
References
medium severity
- Vulnerable module: rails-html-sanitizer
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3Remediation: Upgrade to actionpack@4.2.5.
Overview
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via maliciously crafted data URIs, due to improper user input sanitization in the scrub_attribute
function.
PoC
def test_sanitize_data_protocol
text = '- XSS><iframe src="data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4=">- XSS><iframe src="data:application/vnd.wap.xhtml+xml;base64,PHg6c2NyaXB0IHhtbG5zOng9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPmFsZXJ0KGRvY3VtZW50LmRvbWFpbik8L3g6c2NyaXB0Pg=="></iframe></iframe>'
scope_allowed_tags %w(iframe) do
scope_allowed_attributes %w(src) do
assert_equal %(- XSS\"><iframe>- XSS\"><iframe></iframe></iframe>), safe_list_sanitize(text)
end
end
end
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade rails-html-sanitizer
to version 1.4.4 or higher.
References
medium severity
- Vulnerable module: sinatra
- Introduced through: sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2Remediation: Upgrade to sinatra@2.0.2.
Overview
sinatra is a DSL for quickly creating web applications in Ruby with minimal effort.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) attacks via the 400 Bad Request page that occurs upon a params parser exception.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
ֿInjecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade sinatra
to version 2.0.2 or higher.
References
medium severity
- Vulnerable module: rack
- Introduced through: actionpack@4.2.5 and sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack@1.6.4Remediation: Upgrade to actionpack@7.1.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack@1.6.4Remediation: Upgrade to sinatra@4.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack-test@0.6.3 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
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
- Vulnerable module: rack-protection
- Introduced through: sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3Remediation: Upgrade to sinatra@1.3.2.
Overview
rack-protection
helps protect against typical web attacks.
Affected versions of the package are vulnerable to Timing Attack due to time-variable comparison of signatures. A malicious user can guess a valid signature one char at a time by considering the time it takes a signature validation to fail.
You can read more about timing attacks on our blog
Remediation
Upgrade rack-protection
to versions 1.5.5, 2.0.0 or higher.
References
medium severity
- Vulnerable module: sinatra
- Introduced through: sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2Remediation: Upgrade to sinatra@2.0.0.
Overview
sinatra is a DSL for quickly creating web applications in Ruby.
Affected versions of this package are vulnerable to Timing Attack when checking the CSRF token. It did not use a constant time comparison for the CSRF tokens. As a result, the comparison will fail faster when the first characters in the token are incorrect.
Remediation
Upgrade sinatra
to versions 1.5.5, 2.0.0 or higher.
References
medium severity
- Vulnerable module: actionview
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5Remediation: Upgrade to actionpack@5.2.7.1.
Overview
actionview is a simple, battle-tested conventions and helpers for building web pages.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the ActionView::Helpers
and ERB::Util
methods, due to improper escape of dangerous characters in names of tags and names of attributes.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade actionview
to version 5.2.7.1, 6.0.4.8, 6.1.5.1, 7.0.2.4 or higher.
References
medium severity
- Vulnerable module: haml
- Introduced through: haml@3.1.4
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › haml@3.1.4Remediation: Upgrade to haml@4.0.0.
Overview
haml
is a layer on top of HTML or XML that's designed to express the structure of documents in an elegant way.
Affected versions of the package are vulnerable to Cross-site Scripting (XSS). There is no character escaping in the :erb
filter.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
ֿInjecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade haml
to version 3.2.0.beta.3 or higher.
References
medium severity
- Vulnerable module: haml
- Introduced through: haml@3.1.4
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › haml@3.1.4Remediation: Upgrade to haml@4.0.5.
Overview
haml
is a layer on top of HTML or XML that's designed to express the structure of documents in an elegant way.
Affected versions of the package are vulnerable to Cross-site Scripting (XSS). The haml_concat
does not have it's contents properly escaped, when used in the haml_tag
block.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
ֿInjecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade haml
to version 4.0.5 or higher.
References
medium severity
- Vulnerable module: haml
- Introduced through: haml@3.1.4
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › haml@3.1.4Remediation: Upgrade to haml@5.0.0.
Overview
haml
is a layer on top of HTML or XML that's designed to express the structure of documents in an elegant way.
Affected versions of the package are vulnerable to Cross-site Scripting (XSS). Parameter hashes are not properly encoded when a specific key isn't used.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
ֿInjecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade haml
to version v5.0.0.beta.2 or higher.
References
medium severity
- Vulnerable module: loofah
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3Remediation: Upgrade to actionpack@4.2.5.
Overview
loofah is a general library for manipulating and transforming HTML/XML documents and fragments.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) attacks when a crafted SVG
element is republished.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
ֿInjecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade loofah
to version 2.2.3 or higher.
References
medium severity
- Vulnerable module: rails-html-sanitizer
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3Remediation: Upgrade to actionpack@4.2.5.
Overview
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) due to improper user-input sanitization which may allow an attacker to inject content if the application developer has overridden the sanitizer's allowed tags to allow both select
and style
elements. This is due to an incomplete fix of CVE-2022-32209.
Note:
Code is only impacted if allowed tags are being overridden using either of the following two mechanisms:
- Using the Rails configuration
config.action_view.sanitized_allow_tags=
:
# In config/application.rb
config.action_view.sanitized_allowed_tags = ["select", "style"]
(see https://guides.rubyonrails.org/configuring.html#configuring-action-view)
- Using the class method
Rails::Html::SafeListSanitizer.allowed_tags=
:
# class-level option
Rails::Html::SafeListSanitizer.allowed_tags = ["select", "style"]
All users overriding the allowed tags by either of the above mechanisms to include both select
and style
should either upgrade or use one of the workarounds immediately.
Code is not impacted if allowed tags are overridden using either of the following mechanisms:
- the
:tags
option to the Action View helper methodsanitize
. - the
:tags
option to the instance methodSafeListSanitizer#sanitize
.
Workaround
Users unable to upgrade to the fixed version can remove either select
or style
from the overridden allowed tags.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade rails-html-sanitizer
to version 1.4.4 or higher.
References
medium severity
- Vulnerable module: actionpack
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5Remediation: Upgrade to actionpack@5.2.4.6.
Overview
Affected versions of this package are vulnerable to Information Exposure. There is a possible information exposure / unintended method execution when using the redirect_to
or polymorphic_url
helper with untrusted user input. This arises because url_for
supports building polymorphic URLs via an array of arguments (usually symbols and records). If a developer passes a user input array, strings can result in unwanted route helper calls.
Remediation
Upgrade actionpack
to version 5.2.4.6, 5.2.6, 6.0.3.7, 6.1.3.2 or higher.
References
medium severity
- Vulnerable module: actionpack
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5Remediation: Upgrade to actionpack@6.1.7.1.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the if_none_match
header in http/cache.rb
. An attacker can cause resource exhaustion with a malicious If-None-Match header if a version of Ruby below 3.2.0 is in use.
NOTE: Patches have been issued to address this vulnerability: 6-1-Avoid-regex-backtracking-on-If-None-Match-header.patch, 7-0-Avoid-regex-backtracking-on-If-None-Match-header.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:
- CCC
- CC+C
- C+CC
- 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 actionpack
to version 6.1.7.1, 7.0.4.1 or higher.
References
medium severity
- Vulnerable module: actionpack
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5Remediation: Upgrade to actionpack@6.1.7.1.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in middleware/cookies.rb
, which an attacker can trigger by sending a malicious cookie in combination with a malicious X_FORWARDED_HOST
header.
NOTE: Patches have been released to address this issue: 6-1-Use-string-split-instead-of-regex-for-domain-parts.patch, 7-0-Use-string-split-instead-of-regex-for-domain-parts.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:
- CCC
- CC+C
- C+CC
- 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 actionpack
to version 6.1.7.1, 7.0.4.1 or higher.
References
medium severity
- Vulnerable module: actionview
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5Remediation: Upgrade to actionpack@5.2.4.3.
Overview
actionview is a simple, battle-tested conventions and helpers for building web pages.
Affected versions of this package are vulnerable to Cross-site Request Forgery (CSRF). An attacker might be able to set the href attribute of an anchor tag or the action attribute of a form tag that will trigger a POST action to a cross-origin URL.
This is a regression of CVE-2015-1840.
Remediation
Upgrade actionview
to version 5.2.4.3, 6.0.3.1 or higher.
References
medium severity
- Vulnerable module: activesupport
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › activesupport@4.2.5Remediation: Upgrade to actionpack@6.1.7.1.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › activesupport@4.2.5Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › activesupport@4.2.5Remediation: Upgrade to actionpack@6.1.7.1.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › rails-deprecated_sanitizer@1.0.3 › activesupport@4.2.5Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › activesupport@4.2.5Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › rails-deprecated_sanitizer@1.0.3 › activesupport@4.2.5Remediation: Upgrade to actionpack@4.2.5.
Overview
activesupport is a toolkit of support libraries and Ruby core extensions extracted from the Rails framework.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the underscore()
function in inflector/methods.rb
. This affects String#underscore
, ActiveSupport::Inflector.underscore
, String#titleize
, and any other methods using these.
NOTE: The impact of this vulnerability may be mitigated by configuring Regexp.timeout
. Additionally, patches have been released to address this issue: 6-1-Avoid-regex-backtracking-in-Inflector.underscore.patch, 7-0-Avoid-regex-backtracking-in-Inflector.underscore.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:
- CCC
- CC+C
- C+CC
- 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 activesupport
to version 6.1.7.1, 7.0.4.1 or higher.
References
medium severity
- Vulnerable module: rack
- Introduced through: actionpack@4.2.5 and sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack-test@0.6.3 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
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 Information Exposure. Attackers may be able to find and hijack sessions by using timing attacks targeting the session id. Session ids are usually stored and indexed in a database that uses some kind of scheme for speeding up lookups of that session id. By carefully measuring the amount of time it takes to look up a session, an attacker may be able to find a valid session id and hijack the session.
Remediation
Upgrade rack
to version 1.6.12, 2.0.8 or higher.
References
medium severity
- Vulnerable module: rack
- Introduced through: actionpack@4.2.5 and sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack@1.6.4Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack@1.6.4Remediation: Upgrade to sinatra@2.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack-test@0.6.3 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: rack
- Introduced through: actionpack@4.2.5 and sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack@1.6.4Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack@1.6.4Remediation: Upgrade to sinatra@2.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack-test@0.6.3 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: rack
- Introduced through: actionpack@4.2.5 and sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack@1.6.4Remediation: Upgrade to actionpack@5.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack@1.6.4Remediation: Upgrade to sinatra@2.0.0.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rack-test@0.6.3 › rack@1.6.4Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3 › rack@1.6.4Remediation: Upgrade to sinatra@1.3.2.
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:
- CCC
- CC+C
- C+CC
- 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
medium severity
- Vulnerable module: rack-protection
- Introduced through: sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3Remediation: Upgrade to sinatra@1.3.2.
Overview
rack-protection helps protect against typical web attacks.
Affected versions of this package are vulnerable to Directory Traversal via backslash characters.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st
is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public
route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e
is the URL encoded version of .
(dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip
.
One way to achieve this is by using a malicious zip
archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip
archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/
overwriting the authorized_keys
file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade rack-protection
to version 2.0.1 or higher.
References
medium severity
- Vulnerable module: actionpack
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5Remediation: Upgrade to actionpack@6.1.7.4.
Overview
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) due to improper sanitization of user-supplied values passed into the redirect_to
method which allows provided values to contain characters that are not legal in an HTTP header value.
Note: To be exploited, this requires user interaction and for a Rails app to be configured to allow redirects to external hosts (defaults to false in Rails for versions 7.0.x and above).
Workaround
Users that are not able to upgrade to the fixed version should avoid providing user-supplied URLs with arbitrary schemes to the redirect_to method.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade actionpack
to version 6.1.7.4, 7.0.5.1 or higher.
References
medium severity
- Vulnerable module: actionview
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5Remediation: Upgrade to actionpack@5.2.4.4.
Overview
actionview is a simple, battle-tested conventions and helpers for building web pages.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS). Views that allow the user to control the default (not found) value of the t
and translate
helpers could be susceptible to XSS attacks. When an HTML-unsafe string is passed as the default for a missing translation key named html
or ending in _html
, the default string is incorrectly marked as HTML-safe and not escaped. Vulnerable code may look like the following examples:
<%
# The welcome_html translation is not defined for the current locale:
%>
<%= t("welcome_html", default: untrusted_user_controlled_string) %>
<%# Neither the title.html translation nor the missing.html translation is defined for the current locale: %>
<%= t("title.html", default: [:"missing.html", untrusted_user_controlled_string]) %>
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade actionview
to version 5.2.4.4, 6.0.3.3 or higher.
References
medium severity
- Vulnerable module: erubis
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › erubis@2.7.0
Overview
erubis
is an implementation of eRuby and has the following features:
Affected versions of the package are vulnerable to Cross-site Scripting (XSS). Single quotes were not properly escaped in the helper.rb
and helpers/rails_helper.rb
files. The Erubis Documentation shows missing escaping.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
ֿInjecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
There is no fix version for erubis
.
References
medium severity
- Vulnerable module: haml
- Introduced through: haml@3.1.4
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › haml@3.1.4Remediation: Upgrade to haml@5.0.0.
Overview
haml is a layer on top of HTML or XML that's designed to express the structure of documents in an easy way by using indentation rather than closing tags and allowing Ruby to be embedded with ease.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS). When using user input to perform tasks on the server, characters like < > " ' must be escaped properly. In this case, the ' character was missed. An attacker can manipulate the input to introduce additional attributes, potentially executing code.
engine = Haml::Engine.new("%p&= foo")
engine.render(Object.new,:foo => 'h"i"')
# => "<p>h&quot;i&quot;</p>"
engine.render(Object.new,:foo => "h'i'")
# => "<p>h'i'</p>\n"
Disclosure Timeline
- February 6th, 2017 - Reported the issue to package owner.
- February 8th, 2017 - Issue fixed.
- February 26th, 2017 - Version
v5.0.0.beta.2
released.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade haml
to version 5.0.0.beta.2 or higher.
References
medium severity
- Vulnerable module: rails-html-sanitizer
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3Remediation: Upgrade to actionpack@4.2.5.
Overview
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) in sanitizer.rb
, when allowed tags are overridden to allow both select
and style
elements.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade rails-html-sanitizer
to version 1.4.3 or higher.
References
medium severity
- Vulnerable module: rails-html-sanitizer
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3Remediation: Upgrade to actionpack@4.2.5.
Overview
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) due to certain configurations of rails::Html::Sanitizer
which allow attackers to inject content if the application developer have overridden the sanitizer's allowed tags in either of the following ways:
allow both
math
andstyle
elementsor allow both
SVG
andstyle
elements
Note: The code is only impacted if allowed tags are being overridden.
Workarounds
Remove style
from the overridden allowed tags, or remove math
and SVG
from the overridden allowed tags.
Details
A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, <
can be coded as <
; and >
can be coded as >
; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses <
and >
as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
Type | Origin | Description |
---|---|---|
Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?
,&
,/
,<
,>
and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade rails-html-sanitizer
to version 1.4.4 or higher.
References
low severity
- Vulnerable module: actionpack
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5Remediation: Upgrade to actionpack@4.2.5.1.
Overview
actionpack
is a web app builder and tester on Rails.
Affected versions of this Gem are vulnerable to a Timing Attack, via the basic authentication support in Action Controller. This can allow an attacker to determine basic authentication usernames and passwords.
Details
Due to the way that Action Controller compares user names and passwords in basic authentication authorization code, it is possible for an attacker to analyze the time taken by a response and guess the password.
For example, the string comparison "foo" == "far"
is possibly faster than the comparison "foo" == "for"
, as "far"
has fewer characters in common with "foo"
.
Attackers can use this information to attempt to guess the username and password used in the basic authentication system, one character at a time.
You can tell your application is vulnerable to this attack by looking for http_basic_authenticate_with
method calls in your application.
You can read more about timing attacks (using Node.js as an example) on the Snyk blog: https://snyk.io/blog/node-js-timing-attack-ccc-ctf/
References
low severity
- Vulnerable module: rack-protection
- Introduced through: sinatra@1.3.2
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › sinatra@1.3.2 › rack-protection@1.5.3Remediation: Upgrade to sinatra@2.0.0.
Overview
rack-protection
protects against typical web attacks.
Affected versions of the package are vulnerable to Side-channel attacks.
Remediation
Upgrade rack-protection
to version 2.0.0.beta1 or higher.
References
low severity
- Vulnerable module: nokogiri
- Introduced through: actionpack@4.2.5
Detailed paths
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-dom-testing@1.0.7 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
-
Introduced through: snyk/test-pug@snyk/test-pug#be0afefa2941ea25175d9511dabd476d60e40ee2 › actionpack@4.2.5 › actionview@4.2.5 › rails-html-sanitizer@1.0.3 › loofah@2.0.3 › nokogiri@1.6.8.1Remediation: Upgrade to actionpack@4.2.5.
Overview
nokogiri is a gem for parsing HTML, XML, SAX, and Reader.
Affected versions of this package are vulnerable to XML External Entity (XXE) Injection. XML Schemas parsed by Nokogiri::XML::Schema
are trusted by default, allowing external resources to be accessed over the network, potentially enabling XXE or SSRF attacks. This behavior is counter to the security policy followed by Nokogiri maintainers, which is to treat all input as untrusted by default whenever possible.
Details
XXE Injection is a type of attack against an application that parses XML input. XML is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. By default, many XML processors allow specification of an external entity, a URI that is dereferenced and evaluated during XML processing. When an XML document is being parsed, the parser can make a request and include the content at the specified URI inside of the XML document.
Attacks can include disclosing local files, which may contain sensitive data such as passwords or private user data, using file: schemes or relative paths in the system identifier.
For example, below is a sample XML document, containing an XML element- username.
<xml>
<?xml version="1.0" encoding="ISO-8859-1"?>
<username>John</username>
</xml>
An external XML entity - xxe
, is defined using a system identifier and present within a DOCTYPE header. These entities can access local or remote content. For example the below code contains an external XML entity that would fetch the content of /etc/passwd
and display it to the user rendered by username
.
<xml>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///etc/passwd" >]>
<username>&xxe;</username>
</xml>
Other XXE Injection attacks can access local resources that may not stop returning data, possibly impacting application availability and leading to Denial of Service.
Remediation
Upgrade nokogiri
to version 1.11.0.rc4 or higher.