Remote Command Execution Vulnerability in ruby-mail Package

ruby-mail Updated 02 Oct 2025

Summary

18/07/2012
N/A
Yes i
Unrated
Not published

DEBIAN-CVE-2012-2140: The Mail gem before 2.4.3 for Ruby allows remote attackers to execute arbitrary commands via shell metacharacters in a (1) sendmail or (2) exim delivery. Affects ruby-mail versions < 2.4.4-1. Fixed in 2.4.4-1. How to fix ↓

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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The ruby-mail package is a popular library in Ruby that facilitates the sending and receiving of emails. It provides a simple interface for developers to integrate email functionalities into their applications. However, prior to version 2.4.3, the package contained a critical vulnerability that allowed remote attackers to execute arbitrary commands through shell metacharacters in the delivery methods, specifically sendmail and exim.

Vulnerability Detail

The vulnerability, identified as CVE-2012-2140, originates from improper handling of user input in the Mail gem before version 2.4.3. This oversight allows attackers to inject shell commands via specially crafted email delivery configurations. The ramifications of this vulnerability are severe, as it could lead to unauthorized command execution on the server, potentially compromising the entire system. The technical aspect of this vulnerability lies in the failure to sanitize input, which is a common security oversight in software development.

How To Fix

Minimum fixed version

2.4.4-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade ruby-mail

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

Workaround

If immediate updating is not feasible, a temporary workaround is to avoid using the vulnerable delivery methods (sendmail and exim) until the package can be updated. Additionally, ensure that input to the email delivery methods is properly sanitized to mitigate the risk of command injection.

Conclusion

In summary, the ruby-mail package has a critical vulnerability (CVE-2012-2140) that allows remote command execution through improper input handling. It is crucial to update to the patched version 2.4.4-1 or later to secure your application. If immediate updates are not possible, implement workarounds to mitigate risks.

See every vulnerability recorded for ruby-mail →

Share this vulnerability

FAQ

CVE-2012-2140 is a vulnerability in the ruby-mail package that allows remote attackers to execute arbitrary commands via shell metacharacters in email delivery configurations.

You can use Vulert, which allows you to monitor and alert for open-source vulnerabilities in your software using just a manifest file like package-lock.json. Visit Vulert Scanner to check if your application is affected without any signup.

The potential consequences include unauthorized command execution on the server, which could lead to data breaches, system compromise, or complete control of the affected system by an attacker.

Yes, the vulnerability has been patched in ruby-mail version 2.4.4-1 and later. It is recommended to update to this version to mitigate the risk.

If you cannot update the package immediately, avoid using the vulnerable delivery methods and ensure that any input to these methods is properly sanitized to reduce the risk of exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for ruby-mail.

How To Fix

Minimum fixed version

2.4.4-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade ruby-mail

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