Skip to content

Commit 72878e0

Browse files
David MaloneyDavid Maloney
authored andcommitted
fixes bug with smtp header order
SMTP servers that support pipelining will not accept any commands other than MAILFROM and RCPTTO before the DATA command. We were sending Date and Subject before Data which would cause some mailservers to suddenly drop the connection refusing to send the mail. MSP-12133
1 parent 309159d commit 72878e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/msf/core/exploit/smtp_deliver.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ def send_message(data)
141141
raw_send_recv("MAIL FROM: <#{datastore['MAILFROM']}>\r\n", nsock)
142142
raw_send_recv("RCPT TO: <#{datastore['MAILTO']}>\r\n", nsock)
143143

144+
resp = raw_send_recv("DATA\r\n", nsock)
145+
144146
# If the user supplied a Date field, use that, else use the current
145147
# DateTime in the proper RFC2822 format.
146148
if datastore['DATE'].present?
@@ -154,8 +156,6 @@ def send_message(data)
154156
raw_send_recv("Subject: #{datastore['SUBJECT']}\r\n", nsock)
155157
end
156158

157-
resp = raw_send_recv("DATA\r\n", nsock)
158-
159159
# Avoid sending tons of data and killing the connection if the server
160160
# didn't like us.
161161
if not resp or not resp[0,3] == '354'

0 commit comments

Comments
 (0)