CVE-2019-5418: Rails Ruby on Rails Path Traversal Vulnerability

Published Mar 13, 2019
·
Updated

File Content Disclosure in Action View

Impact ------ There is a possible file content disclosure vulnerability in Action View. Specially crafted accept headers in combination with calls to render file: can cause arbitrary files on the target server to be rendered, disclosing the file contents.

The impact is limited to calls to render which render file contents without a specified accept format. Impacted code in a controller looks something like this:

ruby class UserController < ApplicationController def index render file: "#{Rails.root}/some/file" end end

Rendering templates as opposed to files is not impacted by this vulnerability.

All users running an affected release should either upgrade or use one of the workarounds immediately.

Releases -------- The 6.0.0.beta3, 5.2.2.1, 5.1.6.2, 5.0.7.2, and 4.2.11.1 releases are available at the normal locations.

Workarounds ----------- This vulnerability can be mitigated by specifying a format for file rendering, like this:

ruby class UserController < ApplicationController def index render file: "#{Rails.root}/some/file", formats: [:html] end end

In summary, impacted calls to render look like this:

render file: "#{Rails.root}/some/file"

The vulnerability can be mitigated by changing to this:

render file: "#{Rails.root}/some/file", formats: [:html]

Other calls to render are not impacted.

Alternatively, the following monkey patch can be applied in an initializer:

ruby $ cat config/initializers/formatsfilter.rb frozenstringliteral: true

ActionDispatch::Request.prepend(Module.new do def formats super().select do |format| format.symbol || format.ref == "/" end end end)

Credits ------- Thanks to John Hawthorn <john@hawthorn.email> of GitHub

Other sources

Rails Ruby on Rails contains a path traversal vulnerability in Action View. Specially crafted accept headers in combination with calls to render file: can cause arbitrary files on the target server to be rendered, disclosing the file contents.

CISA

There is a File Content Disclosure vulnerability in Action View <5.2.2.1, <5.1.6.2, <5.0.7.2, <4.2.11.1 and v3 where specially crafted accept headers can cause contents of arbitrary files on the target system's filesystem to be exposed.

There is a possible file content disclosure vulnerability in Action View. Specially crafted accept headers in combination with calls to render file: can cause arbitrary files on the target server to be rendered, disclosing the file contents.

External References:

https://groups.google.com/forum/#!msg/rubyonrails-security/pFRKI96Sm8Q/IhpRq9D2CgAJ https://github.com/mpgn/CVE-2019-5418

Red Hat

Affected Software

20 affected componentsFixes available
rubygems/actionview>=4.0.0<=4.2.11.0
4.2.11.1
rubygems/actionview>=5.2.0<=5.2.2.0
5.2.2.1
rubygems/actionview>=5.0.0<=5.0.7.1
5.0.7.2
rubygems/actionview>=5.1.0<=5.1.6.1
5.1.6.2
redhat/rubygem-actionview<6.0.0.
6.0.0.
redhat/rubygem-actionview<5.2.2.1
5.2.2.1
redhat/rubygem-actionview<5.1.6.2
5.1.6.2
redhat/rubygem-actionview<5.0.7.2
5.0.7.2
redhat/rubygem-actionview<4.2.11.1
4.2.11.1
rubyonrails Rails>=3.0.0<4.2.11.1
rubyonrails Rails>=5.0.0<5.0.7.2
rubyonrails Rails>=5.1.0<5.1.6.2
rubyonrails Rails>=5.2.0<5.2.2.1
Debian Debian Linux=8.0
redhat Cloudforms=4.7
openSUSE Leap=15.0
Fedoraproject Fedora=30
redhat Cloudforms=4.6
redhat Software Collections=1.0
Rails Ruby on Rails

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade redhat/rubygem-actionview to a version that resolves this vulnerability.

    Fixed in 6.0.0.
  2. Upgrade

    Upgrade redhat/rubygem-actionview to a version that resolves this vulnerability.

    Fixed in 5.2.2.1
  3. Upgrade

    Upgrade redhat/rubygem-actionview to a version that resolves this vulnerability.

    Fixed in 5.1.6.2
  4. Upgrade

    Upgrade redhat/rubygem-actionview to a version that resolves this vulnerability.

    Fixed in 5.0.7.2
  5. Upgrade

    Upgrade redhat/rubygem-actionview to a version that resolves this vulnerability.

    Fixed in 4.2.11.1
  6. Upgrade

    Upgrade rubygems/actionview to a version that resolves this vulnerability.

    Fixed in 4.2.11.1
  7. Upgrade

    Upgrade rubygems/actionview to a version that resolves this vulnerability.

    Fixed in 5.2.2.1
  8. Upgrade

    Upgrade rubygems/actionview to a version that resolves this vulnerability.

    Fixed in 5.0.7.2
  9. Upgrade

    Upgrade rubygems/actionview to a version that resolves this vulnerability.

    Fixed in 5.1.6.2
  10. Configuration

    Specify a format when rendering files. For example: render file: "#{Rails.root}/some/file", formats: [:html] to mitigate file content disclosure.

    Action View (render file) formats = [:html]
  11. Configuration

    Add an initializer (e.g., config/initializers/formats_filter.rb) that prepends a module to ActionDispatch::Request to filter formats as shown in the advisory to mitigate the vulnerability.

    Rails initializer ActionDispatch::Request#formats filter = apply provided monkey patch
  12. Operational

    Identify and remediate impacted calls to render that render file contents without a specified format (e.g., any render file: calls without formats:) by updating them to specify formats or applying the provided workaround.

  13. Operational

    Apply mitigations per vendor instructions, follow applicable BOD 22-01 guidance for cloud services, or discontinue use of the product if mitigations are unavailable.

Event History

Mar 13, 2019
Advisory Published
05:26 PM
Data Sourced
via GitHub·05:26 PM
DescriptionSeverityWeaknessAffected Software
Mar 27, 2019
CVE Published
via MITRE·01:38 PM
Data Sourced
via MITRE·01:38 PM
DescriptionWeakness
Data Sourced
via NVD·02:29 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jul 7, 2025
Known Exploited
via CISA·12:00 AM
Data Sourced
via CISA·12:00 AM
RemedyDescriptionAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is CVE-2019-5418?

CVE-2019-5418 is a File Content Disclosure vulnerability in Action View.

2

How does CVE-2019-5418 impact systems?

CVE-2019-5418 can cause arbitrary files on the target server to be rendered, disclosing their content.

3

What is the severity of CVE-2019-5418?

CVE-2019-5418 has a severity rating of 7.5 (High).

4

Which versions of Action View are affected by CVE-2019-5418?

Action View versions <5.2.2.1, <5.1.6.2, <5.0.7.2, <4.2.11.1 are affected by CVE-2019-5418.

5

How can I fix CVE-2019-5418?

To fix CVE-2019-5418, update Action View to versions 5.2.2.1, 5.1.6.2, 5.0.7.2, or 4.2.11.1.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203