Skip to main content
Vulnerability Database/CVE-2026-33195

CVE-2026-33195: Ruby on Rails Path Traversal Vulnerability

CVE-2026-33195 is a path traversal flaw in Ruby on Rails Active Storage that allows attackers to access arbitrary files on the server. This article covers the technical details, affected versions, impact, and mitigation.

Published:

CVE-2026-33195 Overview

CVE-2026-33195 is a path traversal vulnerability in Ruby on Rails Active Storage component that allows attackers to read, write, or delete arbitrary files on the server. Active Storage's DiskService#path_for method fails to validate that the resolved filesystem path remains within the storage root directory, enabling exploitation when blob keys containing path traversal sequences (e.g., ../) are processed.

Critical Impact

This vulnerability enables unauthorized file system access that could lead to complete server compromise through arbitrary file read, write, or deletion operations.

Affected Products

  • Ruby on Rails versions prior to 8.1.2.1
  • Ruby on Rails versions prior to 8.0.4.1
  • Ruby on Rails versions prior to 7.2.3.1

Discovery Timeline

  • 2026-03-24 - CVE CVE-2026-33195 published to NVD
  • 2026-03-24 - Last updated in NVD database

Technical Details for CVE-2026-33195

Vulnerability Analysis

The vulnerability resides in Active Storage's disk service implementation, specifically within the DiskService#path_for method. This method is responsible for resolving file system paths based on blob keys provided by the application. The core issue is a lack of input validation that should ensure the resolved path remains confined within the designated storage root directory.

When a blob key containing directory traversal sequences such as ../ is passed to this method, the path resolution logic follows these sequences literally, allowing the resolved path to escape the intended storage directory. This creates a classic directory traversal vulnerability (CWE-22) that can be exploited to access, modify, or remove files anywhere on the filesystem that the Rails application process has permissions to access.

While blob keys are typically expected to be trusted strings generated internally by the application, the vulnerability becomes exploitable when applications pass user-controllable input directly as blob keys without proper sanitization.

Root Cause

The root cause is insufficient input validation in the DiskService#path_for method. The method does not perform path canonicalization or boundary checking to ensure that the final resolved path stays within the configured storage root directory. This violates the principle of defense in depth, as the method implicitly trusts that all blob keys are safe, without enforcing this assumption programmatically.

Attack Vector

An attacker can exploit this vulnerability through a network-accessible vector by manipulating blob keys in requests to a Rails application using Active Storage with disk service storage. The attack requires no authentication or user interaction, making it highly accessible for exploitation.

The exploitation scenario involves an attacker crafting a malicious blob key containing path traversal sequences, then sending this key to an endpoint that processes blob operations. The vulnerable path_for method resolves the malicious key to a path outside the storage root, allowing the attacker to:

  • Read sensitive files: Access configuration files containing database credentials, API keys, or other secrets
  • Write arbitrary files: Plant backdoors, modify application code, or corrupt data
  • Delete critical files: Remove system files or application data causing denial of service or data loss

Since no verified proof-of-concept code is available, administrators should refer to the GitHub Security Advisory GHSA-9xrj-h377-fr87 for technical details on the vulnerability mechanics.

Detection Methods for CVE-2026-33195

Indicators of Compromise

  • Unexpected file access attempts outside the Active Storage root directory in application logs
  • Presence of path traversal sequences (../, ..%2f, ..%5c) in blob key parameters within HTTP requests
  • Unusual file system access patterns by the Rails application process

Detection Strategies

  • Monitor web application logs for requests containing path traversal patterns in blob-related parameters
  • Implement file integrity monitoring (FIM) on critical system files and directories to detect unauthorized access or modifications
  • Deploy web application firewall (WAF) rules to block requests containing common path traversal sequences

Monitoring Recommendations

  • Enable verbose logging for Active Storage operations to capture all blob key access attempts
  • Configure security information and event management (SIEM) alerts for file access anomalies from the Rails application process
  • Regularly audit application code for instances where user input may be passed directly to blob key parameters

How to Mitigate CVE-2026-33195

Immediate Actions Required

  • Upgrade Ruby on Rails to a patched version: 8.1.2.1, 8.0.4.1, or 7.2.3.1 depending on your current major version
  • Audit application code for any instances where user input is passed directly as blob keys to Active Storage
  • Implement input validation at the application layer to reject blob keys containing path traversal sequences

Patch Information

The Rails team has released patched versions addressing this vulnerability. Organizations should upgrade to one of the following versions based on their current Rails version:

Specific patch commits are available for review:

Workarounds

  • Implement application-level validation to sanitize blob keys and reject any containing path traversal sequences before passing to Active Storage
  • Consider switching to cloud-based storage services (S3, Azure, GCS) which are not affected by this local disk path traversal
  • Apply strict file system permissions to limit the Rails application process's access to only necessary directories
bash
# Example: Restrict Rails application directory permissions
chmod -R 750 /var/www/myapp/storage
chown -R rails:rails /var/www/myapp/storage

# Example: Update Gemfile to patched version
# In your Gemfile, update the rails gem:
# gem 'rails', '~> 8.1.2.1'
# Then run:
bundle update rails

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.