Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Date: Thu, 19 Mar 2020 09:58:40 -0700
From: Aaron Patterson <>
Subject: [CVE-2020-5267] Possible XSS vulnerability in ActionView

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.

Versions Affected:  All.
Not affected:       None.
Fixed Versions:,

### Impact

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>


<script>let a = `<%= escape_javascript unknown_input %>`</script>

### Releases

The and releases are available at the normal locations.

### Workarounds

For those that can't upgrade, the following monkey patch may be used:

    "`" => "\\`",
    "$" => "\\$"

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 = ""
      result = javascript.gsub(/(\\|<\/|\r\n|\342\200\250|\342\200\251|[\n\r"']|[`]|[$])/u, JS_ESCAPE_MAP)
    javascript.html_safe? ? result.html_safe : result

  alias :j :escape_javascript

### Patches

To 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

### Credits

Thanks to Jesse Campos from Chef Secure

Aaron Patterson

View attachment "5-2-js-helper-xss.patch" of type "text/plain" (2461 bytes)

View attachment "6-0-js-helper-xss.patch" of type "text/plain" (2383 bytes)

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.