{"id":"CVE-2020-5267","aliases":["CVE-2020-5267","GHSA-65cv-r6x7-79hv"],"related":[],"kind":"vulnerability","state":"published","title":"Possible XSS vulnerability in ActionView","summary":"In ActionView before versions 6.0.2.2 and 5.2.4.2, there is a possible XSS vulnerability in ActionView's JavaScript literal escape helpers. Views that use the `j` or `escape_javascript` methods may be susceptible to XSS attacks. The issue is fixed in versions 6.0.2.2 and 5.2.4.2.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In ActionView before versions 6.0.2.2 and 5.2.4.2, there is a possible XSS vulnerability in ActionView's JavaScript literal escape helpers. Views that use the `j` or `escape_javascript` methods may be susceptible to XSS attacks. The issue is fixed in versions 6.0.2.2 and 5.2.4.2.","source":"cvelist"},{"lang":"en","text":"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.\n\n### Impact\n\nThere 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:\n\n```erb\n<script>let a = `<%= j unknown_input %>`</script>\n```\n\nor\n\n```erb\n<script>let a = `<%= escape_javascript unknown_input %>`</script>\n```\n\n### Releases\n\nThe 6.0.2.2 and 5.2.4.2 releases are available at the normal locations.\n\n### Workarounds\n\nFor those that can't upgrade, the following monkey patch may be used:\n\n```ruby\nActionView::Helpers::JavaScriptHelper::JS_ESCAPE_MAP.merge!(\n  {\n    \"`\" => \"\\\\`\",\n    \"$\" => \"\\\\$\"\n  }\n)\n\nmodule ActionView::Helpers::JavaScriptHelper\n  alias :old_ej :escape_javascript\n  alias :old_j :j\n\n  def escape_javascript(javascript)\n    javascript = javascript.to_s\n    if javascript.empty?\n      result = \"\"\n    else\n      result = javascript.gsub(/(\\\\|<\\/|\\r\\n|\\342\\200\\250|\\342\\200\\251|[\\n\\r\"']|[`]|[$])/u, JS_ESCAPE_MAP)\n    end\n    javascript.html_safe? ? result.html_safe : result\n  end\n\n  alias :j :escape_javascript\nend\n```\n\n### Patches\n\nTo aid users who aren't able to upgrade immediately we have provided patches for\nthe two supported release series. They are in git-am format and consist of a\nsingle changeset.\n\n* [5-2-js-helper-xss.patch](https://gist.github.com/tenderlove/c042ff49f0347c37e99183a6502accc6#file-5-2-js-helper-xss-patch) - Patch for 5.2 series\n* [6-0-js-helper-xss.patch](https://gist.github.com/tenderlove/c042ff49f0347c37e99183a6502accc6#file-6-0-js-helper-xss-patch) - Patch for 6.0 series\n\nPlease note that only the 5.2 and 6.0 series are supported at present. Users\nof earlier unsupported releases are advised to upgrade as soon as possible as we\ncannot guarantee the continued availability of security fixes for unsupported\nreleases.\n\n### Credits\n\nThanks to Jesse Campos from Chef Secure","format":"markdown","source":"ghsa"},{"lang":"es","text":"En ActionView versiones anteriores a 6.0.2.2 y 5.2.4.2, se presenta una posible vulnerabilidad de tipo XSS en los asistentes de escape literal de JavaScript de ActionView. Las vistas que usan los métodos \"j\" o \"escape_javascript\" pueden ser susceptibles a ataques de tipo XSS. El problema es corregido en las versiones 6.0.2.2 y 5.2.4.2.","source":"nvd"}],"published":"2020-03-19T17:30:16.000Z","modified":"2026-07-08T06:29:58.117Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:L/I:L/A:N","score":4,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:L/I:L/A:N","score":4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N","score":4.8,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N","score":4.8,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:M/Au:S/C:N/I:P/A:N","score":3.5,"rating":"LOW"}],"cwes":["CWE-79","CWE-80"],"affected":[{"ranges":[{"version":"< 5.2.4.2","status":"affected"},{"version":">= 6.0.0, < 6.0.2.2","status":"affected"}],"vendor":"rails","product":"actionview","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"5.2.4.2"}],"ecosystem":"RubyGems","package":"actionview","purl":"pkg:gem/actionview","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"6.0.0","status":"affected","fixed":"6.0.2.2"}],"ecosystem":"RubyGems","package":"actionview","purl":"pkg:gem/actionview","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"5.2.4.2"},{"status":"affected","introduced":"6.0.0","fixed":"6.0.2.2"}],"vendor":"rubyonrails","product":"actionview","cpe":"cpe:2.3:a:rubyonrails:actionview:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"8.0"}],"vendor":"debian","product":"debian_linux","cpe":"cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"33"}],"vendor":"fedoraproject","product":"fedora","cpe":"cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"15.1"}],"vendor":"opensuse","product":"leap","cpe":"cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/rails/rails/security/advisories/GHSA-65cv-r6x7-79hv","tags":["exploit","patch","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rails/rails/commit/033a738817abd6e446e1b320cb7d1a5c15224e9a","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"http://www.openwall.com/lists/oss-security/2020/03/19/1","tags":["exploit","mailing-list","patch","third-party-advisory","web","x-refsource-mlist","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2020/03/msg00022.html","tags":["mailing-list","third-party-advisory","web","x-refsource-mlist","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"http://lists.opensuse.org/opensuse-security-announce/2020-05/msg00019.html","tags":["mailing-list","third-party-advisory","vendor-advisory","web","x-refsource-suse","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/XJ7NUWXAEVRQCROIIBV4C6WXO6IR3KSB/","tags":["vendor-advisory","x-refsource-fedora","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2020-5267","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/actionview/CVE-2020-5267.yml","tags":["web"],"sources":["ghsa"]},{"url":"https://groups.google.com/forum/#!topic/rubyonrails-security/55reWMM_Pg8","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XJ7NUWXAEVRQCROIIBV4C6WXO6IR3KSB","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2020-5267","url":"https://www.cve.org/CVERecord?id=CVE-2020-5267","licence":"CVE Terms of Use","modified":"2024-08-04T08:22:09.079Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-65cv-r6x7-79hv","url":"https://github.com/advisories/GHSA-65cv-r6x7-79hv","licence":"CC-BY-4.0","modified":"2026-07-08T06:29:58.117Z"},{"source":"nvd","name":"NVD","id":"CVE-2020-5267","url":"https://nvd.nist.gov/vuln/detail/CVE-2020-5267","licence":"Public domain","modified":"2026-06-17T03:21:10.023Z"}],"updatedAt":"2026-11-25T22:57:51.579Z","epss":{"score":0.01525,"percentile":0.75403,"date":"2026-12-01T12:00:22.000Z"}}