CVE-2019-3881: Bundler Insecure Path Handling Vulnerability

HIGH
Advisory Identifier: GHSA-g98m-96g9-wfjq
CVSS 7.0
CWE-552 CWE-427
Published
Advisory Summary

CVE-2019-3881 is a HIGH (CVSS 7.0) insecure path handling vulnerability (CWE-552: Files or Directories Accessible to External Parties) affecting Bundler libraries in the RubyGems ecosystem. The issue involves insecure path handling in bundler. Remediation is available by upgrading affected packages to version 2.1.0.

CVE-2019-3881 at a Glance

CVE Identifier CVE-2019-3881
GHSA Identifier GHSA-g98m-96g9-wfjq
Severity HIGH
CVSS v3.1 Base Score 7.0
CWE Classification CWE-552: Files or Directories Accessible to External Parties
Affected Product Bundler
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 7.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2019-3881

To remediate this vulnerability, upgrade all affected Bundler dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

bundler fixed: 2.1.0
Upgrade bundler to 2.1.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for bundler

How to Check if You Are Affected

To determine whether your application is affected by CVE-2019-3881, inspect your project dependencies for Bundler:

inspect dependencies for bundler

Analyze the terminal output to locate any version of Bundler in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-552: Files or Directories Accessible to External Parties, where the product makes files or directories accessible to unauthorized actors, even though they should not be. In Bundler, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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.

CVE-2019-3881 Affected Bundler Versions

1 component(s)
Fixed Versions:
2.1.0
Product / Package Ecosystem Affected Versions Fixed Version
bundler
RubyGems
≥ 1.14.0
< 2.1.0
2.1.0

References

Frequently Asked Questions

What is CVE-2019-3881?
CVE-2019-3881 is a security vulnerability in Bundler involving Insecure path handling in Bundler under CWE-552: Files or Directories Accessible to External Parties.
Which Bundler versions are affected?
Affected versions include releases prior to 2.1.0 across affected packages: bundler.
What version fixes CVE-2019-3881?
Upgrading to 2.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is bundler affected?
Yes, bundler is affected in releases prior to 2.1.0. Upgrade your dependency to 2.1.0 or later.
What is the CVSS score of CVE-2019-3881?
CVE-2019-3881 has a CVSS v3.1 base score of 7.0 (HIGH) with vector string CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2019-3881?
CVE-2019-3881 is classified under CWE-552: Files or Directories Accessible to External Parties (The product makes files or directories accessible to unauthorized actors, even though they should not be.).
How can I check RubyGems dependencies for CVE-2019-3881?
Run the dependency tree command: 'inspect dependencies for bundler'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-g98m-96g9-wfjq",
  "modified" : "2023-07-05T20:18:22Z",
  "published" : "2021-05-10T14:53:59Z",
  "aliases" : [ "CVE-2019-3881" ],
  "summary" : "Insecure path handling in Bundler",
  "details" : "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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "bundler"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.14.0"
      }, {
        "fixed" : "2.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-3881"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubygems/bundler/issues/6501"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubygems/bundler/pull/7416/commits/65cfebb041c454c246aaf32a177b0243915a9998"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=1651826"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-g98m-96g9-wfjq"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rubygems/bundler"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/bundler/CVE-2019-3881.yml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-427", "CWE-552" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-04T22:52:44Z",
    "nvd_published_at" : "2020-09-04T12:15:00Z"
  }
}