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.
| Package | Affected versions | Patched versions |
|---|---|---|
bundlerRubyGems | >= 1.14.0, < 2.1.0 | 2.1.0 |
Affected products
16- ghsa-coords15 versionspkg:gem/bundlerpkg:rpm/almalinux/rubygem-abrtpkg:rpm/almalinux/rubygem-abrt-docpkg:rpm/almalinux/rubygem-bsonpkg:rpm/almalinux/rubygem-bson-docpkg:rpm/almalinux/rubygem-mongopkg:rpm/almalinux/rubygem-mongo-docpkg:rpm/almalinux/rubygem-mysql2pkg:rpm/almalinux/rubygem-mysql2-docpkg:rpm/almalinux/rubygem-pgpkg:rpm/almalinux/rubygem-pg-docpkg:rpm/opensuse/rubygem-bundler&distro=openSUSE%20Leap%2015.1pkg:rpm/opensuse/rubygem-bundler&distro=openSUSE%20Leap%2015.2pkg:rpm/suse/rubygem-bundler&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP1pkg:rpm/suse/rubygem-bundler&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP2
>= 1.14.0, < 2.1.0+ 14 more
- (no CPE)range: >= 1.14.0, < 2.1.0
- (no CPE)range: < 0.3.0-4.module_el8.5.0+259+8cec6917
- (no CPE)range: < 0.3.0-4.module_el8.5.0+259+8cec6917
- (no CPE)range: < 4.5.0-1.module_el8.5.0+2623+08a8ba32
- (no CPE)range: < 4.5.0-1.module_el8.5.0+250+ba22dbf7
- (no CPE)range: < 2.8.0-1.module_el8.5.0+250+ba22dbf7
- (no CPE)range: < 2.8.0-1.module_el8.5.0+250+ba22dbf7
- (no CPE)range: < 0.5.2-1.module_el8.5.0+250+ba22dbf7
- (no CPE)range: < 0.5.2-1.module_el8.5.0+250+ba22dbf7
- (no CPE)range: < 1.1.4-1.module_el8.5.0+250+ba22dbf7
- (no CPE)range: < 1.1.4-1.module_el8.5.0+2623+08a8ba32
- (no CPE)range: < 1.16.1-lp151.3.3.1
- (no CPE)range: < 1.16.1-lp152.4.3.1
- (no CPE)range: < 1.16.1-3.3.1
- (no CPE)range: < 1.16.1-3.3.1
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
6- github.com/advisories/GHSA-g98m-96g9-wfjqghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2019-3881ghsaADVISORY
- bugzilla.redhat.com/show_bug.cgighsaWEB
- github.com/rubygems/bundler/issues/6501ghsaWEB
- github.com/rubygems/bundler/pull/7416/commits/65cfebb041c454c246aaf32a177b0243915a9998ghsaWEB
- github.com/rubysec/ruby-advisory-db/blob/master/gems/bundler/CVE-2019-3881.ymlghsaWEB
News mentions
0No linked articles in our index yet.