CVE-2016-0752 — Ruby on Rails Directory Traversal Vulnerability

CVE-2016-0752

Ruby on Rails Action View — render :file Path Traversal Allows Unauthenticated Arbitrary File Read; Fixed Rails 3.2.22.2 / 4.x / 5.0 (January 2016)

What Is Ruby on Rails Action View?

Ruby on Rails is one of the world's most popular web application frameworks, widely used for building web applications across startups, enterprises, and government services. Action View is the Rails component responsible for rendering templates and generating HTML responses. The render method in Action View allows controllers to specify which view template to render — including render :file for rendering arbitrary files from the filesystem.

The render :file functionality, when combined with insufficient path sanitization, provides a path traversal attack vector: if user-supplied input can influence the file path passed to render :file, an attacker may be able to read arbitrary files from the server's filesystem.

Overview

Actively Exploited. This vulnerability has been added to CISA's Known Exploited Vulnerabilities (KEV) Catalog on March 25, 2022. Federal agencies are required to apply mitigations per BOD 22-01.

CVE-2016-0752 is a directory traversal vulnerability in Ruby on Rails Action View that allows remote attackers to read arbitrary files from the Rails application server's filesystem. The vulnerability exists in how Action View handles file paths when the render :file option is used — insufficient path sanitization allows path traversal sequences (../) to escape the intended views directory and reference files outside it. An attacker who can influence the rendered file path can read sensitive files including application secrets, database configuration, and system files. Rails released patches in January 2016 across all maintained versions.

Affected Versions

Ruby on Rails Status
3.x before 3.2.22.2 Vulnerable
4.0.x before 4.0.13.1 Vulnerable
4.1.x before 4.1.14.1 Vulnerable
4.2.x before 4.2.5.1 Vulnerable
5.0.0.beta1 (pre-release) Vulnerable
3.2.22.2 Fixed
4.0.13.1 Fixed
4.1.14.1 Fixed
4.2.5.1 Fixed

Technical Details

Root Cause: Insufficient Path Sanitization in Action View

CVE-2016-0752 involves insufficient path validation (CWE-22) in Rails Action View's file rendering code. When a Rails controller calls render :file => params[:some_param] (or equivalent) with unsanitized user input, and the Action View code does not properly strip path traversal sequences from the provided path, an attacker can specify:

render :file => "../../../../../../etc/passwd"

Action View constructs the full path by combining the views directory with the provided path — but if traversal sequences are not stripped, the resulting path escapes the views directory and resolves to an arbitrary filesystem location. The rendered "view" returns the file's contents in the HTTP response.

High-Value Targets for Rails File Read

Sensitive files accessible via CVE-2016-0752 on a typical Rails application server:

  • config/database.yml — database connection credentials (username, password, host, database name)
  • config/secrets.yml or config/credentials.yml.enc — Rails secret key base (enables session forgery), API keys
  • .env files — environment variable files containing API credentials, service keys
  • /etc/passwd — system user list
  • Application source code — business logic, internal API implementations
  • Private keys — SSH keys, TLS certificates stored on the server

Attack Characteristics

Attribute Detail
Attack Vector Network — HTTP request with traversal path
Authentication None required (depends on application code)
Impact Arbitrary file read — database credentials, secrets, source code
Root Cause render :file with unsanitized user input
Complexity Low — straightforward traversal

Discovery

Reported to the Rails security team by Joernchen of Phenoelit. Rails released security patches on January 25, 2016 as part of a coordinated disclosure.

Exploitation Context

  • Credential theft and lateral movement: Attackers exploit CVE-2016-0752 to retrieve database credentials from config/database.yml, enabling direct database access for data theft; the Rails secret key base from config/secrets.yml enables forging authenticated session cookies, potentially allowing admin account impersonation
  • Reconnaissance for further attacks: File read vulnerabilities are often the first step in a multi-stage attack — reading application configuration reveals the internal architecture, connected services, and credential stores for further exploitation
  • Rails widespread deployment: Ruby on Rails powers a large percentage of the web; CVE-2016-0752 affected all maintained Rails versions simultaneously, creating a very wide exposure surface across all Rails applications that included render :file with user-influenced input
  • CISA KEV (2022): Added March 2022, confirming continued exploitation against unpatched Rails applications years after the patch

Remediation

CISA BOD 22-01 Deadline: April 15, 2022. Apply mitigations per vendor instructions, follow applicable BOD 22-01 guidance for cloud services, or discontinue use of the product if mitigations are unavailable.
  1. Update Rails — upgrade to Rails 3.2.22.2, 4.0.13.1, 4.1.14.1, 4.2.5.1 or later. Any current Rails LTS version is patched against CVE-2016-0752.

  2. Avoid render :file with user input — audit Rails controllers for any use of render :file, render :template, or similar with user-supplied values; replace with explicit template name lookups or allowlists of permitted templates.

  3. Rotate exposed credentials — if the application may have been vulnerable, rotate: database credentials, Rails secret key base (this invalidates all existing sessions), API keys, and any other secrets stored in config/ files.

  4. Input validation — for any Rails application feature that renders or serves files, validate that the requested path is within an explicitly permitted directory and does not contain traversal sequences.

  5. Application security audit — review the application codebase for any patterns where user-controlled input influences file paths, template names, or file operations.

Key Details

PropertyValue
CVE ID CVE-2016-0752
Vendor / Product Rails — Ruby on Rails
NVD Published2016-02-16
NVD Last Modified2025-10-22
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 — Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') find similar ↗
CISA KEV Added2022-03-25
CISA KEV Deadline2022-04-15
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: 2022-04-15. Apply updates per vendor instructions.

Timeline

DateEvent
2016-01-25Rails security patch released: Rails 3.2.22.2, 4.0.13.1, 4.1.14.1, 4.2.5.1, and 5.0.0.beta1.1 addressing CVE-2016-0752
2016-02-16CVE-2016-0752 published by NVD
2022-03-25Added to CISA Known Exploited Vulnerabilities catalog
2022-04-15CISA BOD 22-01 remediation deadline