Lucene search

K
githubGitHub Advisory DatabaseGHSA-8QGM-G2VV-VWVC
HistoryJul 08, 2024 - 2:14 p.m.

RailsAdmin Cross-site Scripting vulnerability in the list view

2024-07-0814:14:43
CWE-79
GitHub Advisory Database
github.com
34
cross-site scripting
html title
railsadmin
upgrade
workarounds
sanitizehelper
xss
ruby on rails

CVSS3

5.4

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

LOW

User Interaction

REQUIRED

Scope

CHANGED

Confidentiality Impact

LOW

Integrity Impact

LOW

Availability Impact

NONE

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

AI Score

6.2

Confidence

High

EPSS

0.001

Percentile

30.7%

Impact

RailsAdmin list view has the XSS vulnerability, caused by improperly-escaped HTML title attribute.
The issue was originally reported in https://github.com/railsadminteam/rails_admin/issues/3686.

Patches

Upgrade to 3.1.4. The vulnerability itself was patched in 3.1.3 but it has a functionality issue.
Initially the vulnerability was thought to exist in versions before 3.0, but it didn’t. 2.x users can stay on 2.2.1.

Workarounds

  1. Copy the index view (located under the path app/views/rails_admin/main/index.html.erb) from the RailsAdmin version you use, and place it into your application by using the same path.
  2. Open the view file by an editor, and change the way to populate the td tag:
               <% properties.map{ |property| property.bind(:object, object) }.each do |property| %>
                 <% value = property.pretty_value %>
-                <td>
+                &lt;%= content_tag(:td, class: [property.sticky? && 'sticky', property.css_class, property.type_css_class].select(&:present?), title: strip_tags(value.to_s)) do %&gt;
                   &lt;%= value %&gt;
-                </td>
+                &lt;% end %&gt;
               &lt;% end %&gt;

Note: The view file created by this needs to be removed after upgrading RailsAdmin afterwards, unless this old view continue to be used. Only do this if you can’t upgrade RailsAdmin now for a reason.

References

https://owasp.org/www-community/attacks/xss/
https://api.rubyonrails.org/classes/ActionView/Helpers/SanitizeHelper.html#method-i-strip_tags

Affected configurations

Vulners
Node
rails_admin_projectrails_adminRange3.0.0.beta3.1.3ruby
VendorProductVersionCPE
rails_admin_projectrails_admin*cpe:2.3:a:rails_admin_project:rails_admin:*:*:*:*:*:ruby:*:*

CVSS3

5.4

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

LOW

User Interaction

REQUIRED

Scope

CHANGED

Confidentiality Impact

LOW

Integrity Impact

LOW

Availability Impact

NONE

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

AI Score

6.2

Confidence

High

EPSS

0.001

Percentile

30.7%