Skip to main content
Vulnerability Database/CVE-2024-43791

CVE-2024-43791: Request Store Rack Library RCE Vulnerability

CVE-2024-43791 is a remote code execution vulnerability in RequestStore for Rack caused by world-writable file permissions. This article covers the technical details, affected versions, security impact, and mitigation steps.

Published:

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-43791 Overview

CVE-2024-43791 affects request_store version 1.3.2, a Ruby gem that provides per-request global storage for Rack applications. The gem's published files carry 0666 permissions, making them world-writable on the local filesystem. Local users with access to the installation path can overwrite gem files and execute arbitrary code when the host application loads them. The affected release dates back to 2017, and most production environments restrict local user access. The vulnerability is categorized as Incorrect Default Permissions [CWE-276].

Critical Impact

Local users with filesystem access can modify gem contents and achieve code execution within the context of any process that loads request_store 1.3.2.

Affected Products

  • steveklabnik/request_store version 1.3.2
  • Ruby on Rails and Rack-based applications bundling the vulnerable gem
  • Shared hosting and multi-tenant environments where local users can reach gem install paths

Discovery Timeline

  • 2024-08-23 - CVE-2024-43791 published to the National Vulnerability Database (NVD)
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-43791

Vulnerability Analysis

The request_store gem publishes files with octal mode 0666, granting read and write permissions to every local user. Any user on the system can rewrite the gem's Ruby source files. When a Rack or Rails process subsequently requires request_store, the Ruby interpreter loads the modified code and executes it with the privileges of the application process.

This issue falls under Incorrect Default Permissions [CWE-276]. The flaw lives in the packaging artifacts rather than the gem's runtime logic. Exploitation requires only local filesystem write access to the installed gem directory, which is typically vendor/bundle or the system gem path.

Most deployments restrict shell access to administrators, which limits practical exposure. Shared hosting providers, continuous integration runners, and development workstations with multiple local accounts face higher risk.

Root Cause

The root cause is the file mode assigned to gem contents at publish time. The 0666 permission bits allow world-write access, violating the principle of least privilege. Ruby's require mechanism does not verify file integrity before loading, so any modification by a local user becomes code the application executes.

Attack Vector

An attacker needs a local account on the host where request_store 1.3.2 is installed. The attacker locates the gem's Ruby files, overwrites one of them with malicious code, and waits for the target application to load the library. Because the modified file is world-writable, no privilege escalation is required before the write. Code execution then inherits the privileges of the Rack worker, which often runs as a service account with broad application access.

No verified public exploit code or proof-of-concept is published for this issue. The flaw is a straightforward abuse of filesystem permissions and does not require specialized tooling.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2024-43791

Indicators of Compromise

  • Gem files under the request_store-1.3.2 directory with mode 0666 reported by ls -l or stat
  • Unexpected modifications to .rb files within the installed gem path, visible in file integrity monitoring logs
  • Ruby processes loading request_store code that differs from the upstream RubyGems checksum

Detection Strategies

  • Scan Ruby application hosts for installed request_store versions and flag any instance of 1.3.2
  • Run file integrity monitoring on the gem installation directory to alert on writes by non-root, non-deploy accounts
  • Audit permission bits across GEM_HOME and vendor/bundle paths and alert when world-writable files appear

Monitoring Recommendations

  • Collect process execution telemetry from application servers and correlate Ruby worker activity with filesystem writes to gem paths
  • Forward auditd or osquery file-change events for Ruby gem directories to the security data lake for long-term retention
  • Track local login events on servers hosting Rails or Rack applications to identify accounts that could reach the gem path

How to Mitigate CVE-2024-43791

Immediate Actions Required

  • Upgrade request_store to a version newer than 1.3.2 using bundle update request_store and redeploy affected applications
  • Reset permissions on installed gem files to 0644 for data files and 0755 for directories using chmod -R on the gem path
  • Restrict interactive local access on application hosts to administrators and deployment service accounts only

Patch Information

The maintainer addressed the permission issue in later releases of request_store. Review the GitHub Security Advisory GHSA-frp2-5qfc-7r8m for the fixed version and upgrade guidance. Rebuild application container images after upgrading so running workloads pick up the corrected permissions.

Workarounds

  • Apply chmod -R o-w to the request_store-1.3.2 installation directory to remove world-write access until an upgrade is possible
  • Run Rack and Rails worker processes under a dedicated service account that owns the gem directory, blocking writes from other local users
  • Deploy applications inside containers with read-only root filesystems to prevent runtime modification of gem files
bash
# Configuration example
chmod -R o-w /var/lib/gems/*/gems/request_store-1.3.2
find /var/lib/gems -type f -perm -o+w -name '*.rb' -print
bundle update request_store

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

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.