CVE-2012-2139: Mail Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-cj92-c4fj-w9c5
CWE-22
Published
Advisory Summary

CVE-2012-2139 is a MODERATE path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Mail libraries in the RubyGems ecosystem. The issue involves mail gem path traversal vulnerability. Remediation is available by upgrading affected packages to version 2.4.4.

CVE-2012-2139 at a Glance

CVE Identifier CVE-2012-2139
GHSA Identifier GHSA-cj92-c4fj-w9c5
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Mail
Package Ecosystem RubyGems
Published Date
Last Updated

How to Fix CVE-2012-2139

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

mail fixed: 2.4.4
Upgrade mail to 2.4.4
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 mail

How to Check if You Are Affected

To determine whether your application is affected by CVE-2012-2139, inspect your project dependencies for Mail:

inspect dependencies for mail

Analyze the terminal output to locate any version of Mail in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.4.4), 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Mail, 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

Directory traversal vulnerability in `lib/mail/network/delivery_methods/file_delivery.rb` in the Mail gem before 2.4.4 for Ruby allows remote attackers to read arbitrary files via a `..` (dot dot) in the to parameter.

CVE-2012-2139 Affected Mail Versions

1 component(s)
Fixed Versions:
2.4.4
Product / Package Ecosystem Affected Versions Fixed Version
mail
RubyGems
< 2.4.4
2.4.4

References

Frequently Asked Questions

What is CVE-2012-2139?
CVE-2012-2139 is a security vulnerability in Mail involving Mail Gem Path Traversal vulnerability under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Mail versions are affected?
Affected versions include releases prior to 2.4.4 across affected packages: mail.
What version fixes CVE-2012-2139?
Upgrading to 2.4.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mail affected?
Yes, mail is affected in releases prior to 2.4.4. Upgrade your dependency to 2.4.4 or later.
What CWE is associated with CVE-2012-2139?
CVE-2012-2139 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check RubyGems dependencies for CVE-2012-2139?
Run the dependency tree command: 'inspect dependencies for mail'. 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-cj92-c4fj-w9c5",
  "modified" : "2023-09-05T21:10:15Z",
  "published" : "2017-10-24T18:33:38Z",
  "aliases" : [ "CVE-2012-2139" ],
  "summary" : "Mail Gem Path Traversal vulnerability",
  "details" : "Directory traversal vulnerability in `lib/mail/network/delivery_methods/file_delivery.rb` in the Mail gem before 2.4.4 for Ruby allows remote attackers to read arbitrary files via a `..` (dot dot) in the to parameter.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "mail"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.4.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2012-2139"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mikel/mail/commit/29aca25218e4c82991400eb9b0c933626aefc98f"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.novell.com/show_bug.cgi?id=759092"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=816352"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mikel/mail"
  }, {
    "type" : "WEB",
    "url" : "http://lists.fedoraproject.org/pipermail/package-announce/2012-May/080645.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.fedoraproject.org/pipermail/package-announce/2012-May/080648.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.fedoraproject.org/pipermail/package-announce/2012-May/080747.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2012/04/25/8"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2012/04/26/1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:31:54Z",
    "nvd_published_at" : "2012-07-18T18:55:01Z"
  }
}