Loading advisory.
Loading advisory.
Cross site scripting vulnerability in ActionView
There is a possible cross site scripting (XSS) vulnerability in ActionView's JavaScript literal escape helpers. Views that use the j or escape_javascript methods may be susceptible to XSS attacks.
Published 2020-03-19 17:30 UTC · Modified 2026-07-08 06:29 UTC
Severity and EPSS are shown separately. Helm does not combine them into one score. How tiers work
| Package | Ecosystem | Affected | Fixed in | Upgrade command |
|---|---|---|---|---|
| actionview | RubyGems | < 5.2.4.2 >= 6.0.0, < 6.0.2.2 versions 4.1.0, 4.1.0.beta1, 4.1.0.beta2, 4.1.0.rc1, 4.1.0.rc2, 4.1.1, 4.1.10, 4.1.10.rc1, 4.1.10.rc2, 4.1.10.rc3, 4.1.10.rc4, 4.1.11, 4.1.12, 4.1.12.rc1, 4.1.13, 4.1.13.rc1, 4.1.14, 4.1.14.1, 4.1.14.2, 4.1.14.rc1 and 128 more | 5.2.4.2, 6.0.2.2 | gem install actionview -v 5.2.4.2gem install actionview -v 6.0.2.2 |
There is a possible cross site scripting (XSS) vulnerability in ActionView's JavaScript literal escape helpers. Views that use the j or escape_javascript methods may be susceptible to XSS attacks.
There is a possible XSS vulnerability in the j and escape_javascript methods in ActionView. These methods are used for escaping JavaScript string literals. Impacted code will look something like this:
<script>let a = `<%= j unknown_input %>`</script>or
<script>let a = `<%= escape_javascript unknown_input %>`</script>The 6.0.2.2 and 5.2.4.2 releases are available at the normal locations.
For those that can't upgrade, the following monkey patch may be used:
ActionView::Helpers::JavaScriptHelper::JS_ESCAPE_MAP.merge!(
{
"`" => "\\`",
"$" => "\\$"
}
)
module ActionView::Helpers::JavaScriptHelper
alias :old_ej :escape_javascript
alias :old_j :j
def escape_javascript(javascript)
javascript = javascript.to_s
if javascript.empty?
result = ""
else
result = javascript.gsub(/(\\|<\/|\r\n|\342\200\250|\342\200\251|[\n\r"']|[`]|[$])/u, JS_ESCAPE_MAP)
end
javascript.html_safe? ? result.html_safe : result
end
alias :j :escape_javascript
endTo aid users who aren't able to upgrade immediately we have provided patches for the two supported release series. They are in git-am format and consist of a single changeset.
5-2-js-helper-xss.patch - Patch for 5.2 series
6-0-js-helper-xss.patch - Patch for 6.0 series
Please note that only the 5.2 and 6.0 series are supported at present. Users of earlier unsupported releases are advised to upgrade as soon as possible as we cannot guarantee the continued availability of security fixes for unsupported releases.
Thanks to Jesse Campos from Chef Secure
Exploit code or a detection template for this CVE is published by the sources below. This is not a report of use against real systems (that is what CISA KEV records) and it does not change the tier.
One EPSS score on record: 0.015 on 2026-11-24.
| Date | Score | Previous | Model |
|---|---|---|---|
| 2026-11-24 | 0.015 | first score | v2026.06.15 |