Skip to content
RCE Disclosed report Intermediate

SMTP command injection

Net::SMTP does not validate input for MAIL FROM or RCPT TO, allowing SMTP command injection that could manipulate the SMTP conversation.

jeremy Follow

Originally disclosed on HackerOne

  • Fixed in 28 days
  • Disclosed after 50 days

Net::SMTP is vulnerable to RCPT TO/MAIL FROM injection due to lack of input validation and conformance to the SMTP protocol.

Publicly disclosed already: http://www.mbsd.jp/Whitepaper/smtpi.pdf

People are wrongly assigning this to the mail gem (http://rubysec.com/advisories/OSVDB-131677/) and thinking it's fixed, when in fact the underlying vuln remains in Net::SMTP.

Discussed as an issue with the mail library here: https://github.com/rubysec/ruby-advisory-db/issues/215. And mentioned that it's likely an issue with net-smtp not doing input validation, per RFC spec: https://github.com/rubysec/ruby-advisory-db/issues/215#issuecomment-163906956

The mail gem should do input validation too, of course. But its responsibility is creating internet messages, and it would validate addresses against that spec. Its responsibility is not SMTP protocol compliance. Net::SMTP is.

Addressing this in Ruby in a timely manner will help resolve the considerable confusion that's emerged due to the lack of response to a publicly disclosed vulnerability.

The original report as published on HackerOne, by jeremy. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

An attacker could inject additional SMTP commands, potentially altering the recipient list.

What the attacker needed

Attacker controls email address input

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When a program sends email, it talks to a mail server using a set of commands. One of those commands includes the sender's address. If the program does not check that the address is clean, an attacker can sneak extra commands into it, like adding a hidden instruction to send the email to someone else. This is called command injection.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More from Ruby

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.