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

CVE-2019-5418

Ruby on Rails — Action View Accept-Header Path Traversal Discloses Arbitrary Server Files

What Is Ruby on Rails?

Ruby on Rails is one of the most widely used web application frameworks, powering everything from startups to large-scale platforms. Action View is the templating/rendering layer of Rails responsible for turning controller data into HTML (or other formats) sent to the browser — a component that, if it can be tricked into rendering the wrong thing, becomes a path to leaking server-side files.

Overview

CVE-2019-5418 is a file content disclosure vulnerability (CWE-22, Path Traversal) in Rails' Action View component. Applications that use render file: with dynamic, unsanitized path segments can be manipulated via a specially crafted Accept HTTP header to have Rails render and return the contents of arbitrary files on the server — including sensitive files such as application source code, credentials files, or configuration containing secrets. CVSS score: 7.5, with impact limited to confidentiality (file read) rather than code execution.

Technical Details

The bug exploits how Rails determines the format/extension to render based on the request's Accept header when combined with certain uses of render file:. By manipulating the Accept header to include unexpected values, an attacker can influence which file extension Rails appends when resolving the file path passed to render file:, and in combination with path traversal sequences, cause Rails to read and return a file outside the intended views directory. Because render file: is a relatively niche, explicit method (not the default render call most Rails views use), the vulnerability primarily affects applications that pass user-influenced or dynamic values into it — a pattern more common in custom or legacy Rails code than in typical scaffolded applications.

Discovery

This vulnerability was disclosed and patched by the Ruby on Rails core team as part of its coordinated security release process on March 13, 2019, alongside other framework security fixes released the same day.

Exploitation Context

CISA added this vulnerability to the KEV catalog in July 2025, more than six years after original disclosure — indicating it is still being actively exploited today, most likely against long-lived, unpatched Rails applications built with vulnerable coding patterns from that era. This reflects a broader trend: web framework path-traversal bugs from years past continue to be scanned for and exploited against applications that were never upgraded past known-vulnerable Rails versions.

Remediation

  1. Upgrade Rails to the patched versions from the March 2019 security release (Rails 6.0.0.beta3, 5.2.2.1, 5.1.6.2, and 4.2.11, or any later release) — treat any Rails version older than these as vulnerable.
  2. Audit application code for uses of render file: with dynamic or user-influenced path segments, and refactor to use safer rendering methods (render template:, render partial:) wherever possible.
  3. Validate and allowlist any values that influence file paths or extensions before passing them into rendering calls.
  4. Restrict file system permissions for the application process so that even a successful traversal cannot reach highly sensitive files (credentials, private keys) outside the application directory.
  5. Review application logs for requests with anomalous Accept headers combined with path traversal sequences, which may indicate exploitation attempts.

Key Details

PropertyValue
CVE ID CVE-2019-5418
Vendor / Product Rails — Ruby on Rails
NVD Published2019-03-27
NVD Last Modified2025-10-30
CVSS 3.1 Score7.5
CVSS 3.1 VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
SeverityHIGH
CWE CWE-22 find similar ↗
CISA KEV Added2025-07-07
CISA KEV Deadline2025-07-28
Known Ransomware Use No

CVSS 3.1 Breakdown

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

Required Action

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

Timeline

DateEvent
2019-03-13Rails core team publishes patched releases and security advisory
2019-03-27CVE-2019-5418 published
2025-07-07Added to CISA Known Exploited Vulnerabilities catalog
2025-07-28CISA BOD 22-01 remediation deadline

References

ResourceType
NVD — CVE-2019-5418 Vulnerability Database
CISA KEV Catalog Entry US Government
Rails Security Release Announcement (archived) Vendor Advisory