Skip to content

CSRF Vulnerability in rails-ujs

Moderate severity GitHub Reviewed Published Jul 7, 2020 to the GitHub Advisory Database • Updated Aug 17, 2023

Package

bundler actionview (RubyGems)

Affected versions

>= 5.0.0, <= 5.2.4.2
>= 6.0.0, <= 6.0.3

Patched versions

5.2.4.3
6.0.3.1

Description

There is a vulnerability in rails-ujs that allows attackers to send CSRF tokens to wrong domains.

Versions Affected: rails <= 6.0.3
Not affected: Applications which don't use rails-ujs.
Fixed Versions: rails >= 5.2.4.3, rails >= 6.0.3.1

Impact

This is a regression of CVE-2015-1840.

In the scenario where an attacker might be able to control the href attribute of an anchor tag or the action attribute of a form tag that will trigger a POST action, the attacker can set the href or action to a cross-origin URL, and the CSRF token will be sent.

Workarounds

To work around this problem, change code that allows users to control the href attribute of an anchor tag or the action attribute of a form tag to filter the user parameters.

For example, code like this:

link_to params

to code like this:

link_to filtered_params

def filtered_params
  # Filter just the parameters that you trust
end

References

Published by the National Vulnerability Database Jun 19, 2020
Reviewed Jul 7, 2020
Published to the GitHub Advisory Database Jul 7, 2020
Last updated Aug 17, 2023

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N

EPSS score

0.219%
(60th percentile)

Weaknesses

CVE ID

CVE-2020-8167

GHSA ID

GHSA-xq5j-gw7f-jgj8

Source code

No known source code
Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.