VYPR
High severityOSV Advisory· Published Sep 4, 2020· Updated Aug 4, 2024

CVE-2019-3881

CVE-2019-3881

Description

Bundler prior to 2.1.0 uses a predictable path in /tmp/, created with insecure permissions as a storage location for gems, if locations under the user's home directory are not available. If Bundler is used in a scenario where the user does not have a writable home directory, an attacker could place malicious code in this directory that would be later loaded and executed.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Bundler prior to 2.1.0 creates a predictable temporary directory with insecure permissions, allowing local attackers to execute arbitrary code when the user's home directory is unwritable.

Vulnerability

Overview

CVE-2019-3881 is a local privilege escalation vulnerability in Bundler, the Ruby gem dependency manager, affecting versions prior to 2.1.0. The root cause lies in the fallback mechanism for determining the user's home directory. When the user's home directory is not writable or does not exist, Bundler creates a temporary home directory under /tmp/ using a predictable path (e.g., /tmp/bundler/home/USER) with insecure permissions [1][2][3]. This predictable location and lack of proper access controls allow any local user to pre-create or modify files in that directory.

Exploitation

An attacker with local access to the system can exploit this by placing a malicious gem or other code in the predictable temporary directory before the victim runs Bundler. The attacker does not need any special privileges beyond the ability to write to /tmp/. When Bundler later loads gems from that directory, the malicious code is executed in the context of the victim user [1][4]. The attack requires no authentication beyond local shell access.

Impact

Successful exploitation leads to arbitrary code execution as the victim user. This can result in data theft, installation of backdoors, or privilege escalation if the victim has elevated permissions. The vulnerability is rated as medium severity (CVSS 3.x base score 7.8) due to the need for local access [1][4].

Mitigation

The issue was addressed in Bundler version 2.1.0, which replaced the predictable temporary directory with a randomly generated path (e.g., /tmp/trulyrandom) to prevent pre-placement attacks [2][3]. Users are strongly advised to update to Bundler 2.1.0 or later. For systems where an immediate update is not possible, ensuring that the user's home directory is always writable and available can serve as a workaround, as the vulnerable code path is only triggered when the home directory is unavailable.

AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
bundlerRubyGems
>= 1.14.0, < 2.1.02.1.0

Affected products

16

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

6

News mentions

0

No linked articles in our index yet.