SMTP Command Injection Vulnerability in Ruby Mail Gem

ruby-mail Updated 02 Oct 2025

Summary

12/06/2017
N/A
Yes i
Medium
6.1

CVE-2015-9097: The mail gem before 2.5.5 for Ruby (aka A Really Ruby Mail Library) is vulnerable to SMTP command injection via CRLF sequences in a RCPT TO or MAIL FROM command, as demonstrated by CRLF sequences immediately before and a... Affects ruby-mail versions < 2.6.1+dfsg1-1. Fixed in 2.6.1+dfsg1-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 gem is a widely used library in Ruby applications for sending and receiving emails. It provides a simple interface for composing and sending emails via SMTP, making it an essential tool for developers. However, prior to version 2.5.5, the library was susceptible to a critical vulnerability that allowed attackers to exploit SMTP commands, potentially compromising the integrity of email communications.

Vulnerability Detail

The vulnerability, identified as CVE-2015-9097, arises from the improper handling of CRLF (Carriage Return Line Feed) sequences in the RCPT TO or MAIL FROM commands. This flaw allows an attacker to inject arbitrary SMTP commands, which can lead to unauthorized actions being performed on the mail server. The ramifications of this vulnerability include the potential for data leakage, email spoofing, and other malicious activities that could disrupt email services or compromise sensitive information.

How To Fix

Minimum fixed version

2.6.1+dfsg1-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 upgrading is not immediately possible, a temporary workaround is to sanitize input to the MAIL FROM and RCPT TO commands to prevent CRLF injection. This can be done by implementing input validation to reject any input containing CRLF sequences.

Conclusion

The CVE-2015-9097 vulnerability in the Ruby Mail gem poses significant risks to email communications through SMTP command injection. It is crucial for developers to upgrade to the patched version to ensure the security of their applications. Utilizing tools like Vulert can help monitor and alert for such vulnerabilities in real-time.

See every vulnerability recorded for ruby-mail →

Share this vulnerability

FAQ

CVE-2015-9097 is a vulnerability in the Ruby Mail gem that allows for SMTP command injection via CRLF sequences.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

The impacts include unauthorized actions on the mail server, data leakage, and email spoofing, which can compromise sensitive information.

The CVSS score for CVE-2015-9097 is 6.1, indicating a medium severity level.

Yes, you can implement input validation to sanitize the MAIL FROM and RCPT TO commands to prevent CRLF injection as a temporary measure.

Related vulnerabilities

Recent vulnerabilities recorded for ruby-mail.

How To Fix

Minimum fixed version

2.6.1+dfsg1-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