CVE-2012-2139: Mail Path Traversal vulnerability in RubyGems Mail

mail Updated 02 Oct 2025

Summary

24/10/2017
Yes i
Moderate
Not published

CVE-2012-2139: Mail Gem Path Traversal vulnerability. Affects mail versions < 2.4.4. Fixed in 2.4.4. How to fix ↓

Also tracked for

The same CVE-2012-2139 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The Mail gem is a Ruby library used for handling email messages. It provides functionality for creating, sending, and parsing email messages. The gem is widely used in Ruby applications for email-related tasks. However, versions before 2.4.4 are vulnerable to a directory traversal vulnerability in the lib/mail/network/delivery_methods/file_delivery.rb file. This vulnerability allows remote attackers to read arbitrary files by exploiting a '..' (dot dot) in the 'to' parameter of the email message.

Vulnerability Detail

The directory traversal vulnerability in the Mail gem allows an attacker to bypass file access restrictions and read arbitrary files on the system. By including '..' in the 'to' parameter of an email message, an attacker can traverse directories and access sensitive files outside the intended scope. This can lead to unauthorized disclosure of sensitive information, such as configuration files, user data, or other confidential data stored on the system. The impact of this vulnerability depends on the specific files that can be accessed and the sensitivity of the information contained within them.

How To Fix

Latest published version: 2.9.1 as of 23 Oct 2026

gem install mail -v 2.9.1

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

2.4.4

This is the first release that contains the fix.

gem install mail -v 2.4.4

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to the latest version of the Mail gem is not immediately feasible, a workaround can be implemented by validating and sanitizing user input before using it in the 'to' parameter of email messages. This can involve checking for the presence of '..' or other directory traversal characters and rejecting or sanitizing the input accordingly. Additionally, access controls and file permissions should be properly configured to limit the impact of any potential directory traversal attacks.

Conclusion

The Mail gem before version 2.4.4 for Ruby is vulnerable to a directory traversal vulnerability that allows remote attackers to read arbitrary files. To mitigate this vulnerability, it is recommended to upgrade to version 2.4.4 or later of the Mail gem. If immediate upgrading is not possible, implementing input validation and sanitization can help reduce the risk. Proper access controls and file permissions should also be in place. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for mail →

Share this vulnerability

FAQ

The vulnerability allows remote attackers to read arbitrary files on the system, potentially leading to unauthorized disclosure of sensitive information.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply upload your manifest file (e.g., package-lock.json) and Vulert will analyze it for any open-source vulnerabilities, including this Mail gem vulnerability.

Yes, upgrading to version 2.4.4 or later of the Mail gem fixes this vulnerability. It is recommended to update your application's dependencies to use the latest version of the gem.

If immediate upgrading is not possible, you can implement input validation and sanitization to mitigate the risk of directory traversal attacks. Additionally, ensure proper access controls and file permissions are in place.

Related vulnerabilities

Recent vulnerabilities recorded for mail.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: 2.9.1 as of 23 Oct 2026

gem install mail -v 2.9.1

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

2.4.4

This is the first release that contains the fix.

gem install mail -v 2.4.4

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback