Skip to content

Commit 204f0f8

Browse files
committed
Land rapid7#4573, Date/Subject support for SMTPDeliver
2 parents ac4eb3b + 052c14b commit 204f0f8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/msf/core/exploit/smtp_deliver.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def initialize(info = {})
2626
[
2727
OptAddress.new("RHOST", [ true, "The SMTP server to send through" ]),
2828
OptPort.new("RPORT", [ true, "The SMTP server port (e.g. 25, 465, 587, 2525)", 25 ]),
29+
OptString.new('DATE', [false, 'Override the DATE: field with this value', '']),
2930
OptString.new('MAILFROM', [ true, 'The FROM address of the e-mail', '[email protected]' ]),
3031
OptString.new('MAILTO', [ true, 'The TO address of the email' ]),
3132
OptString.new('SUBJECT', [ true, 'Subject line of the email' ]),
@@ -140,6 +141,19 @@ def send_message(data)
140141
raw_send_recv("MAIL FROM: <#{datastore['MAILFROM']}>\r\n", nsock)
141142
raw_send_recv("RCPT TO: <#{datastore['MAILTO']}>\r\n", nsock)
142143

144+
# If the user supplied a Date field, use that, else use the current
145+
# DateTime in the proper RFC2822 format.
146+
if datastore['DATE'].present?
147+
raw_send_recv("Date: #{datastore['DATE']}\r\n", nsock)
148+
else
149+
raw_send_recv("Date: #{DateTime.now.rfc2822}\r\n", nsock)
150+
end
151+
152+
# If the user supplied a Subject field, use that
153+
if datastore['SUBJECT'].present?
154+
raw_send_recv("Subject: #{datastore['SUBJECT']}\r\n", nsock)
155+
end
156+
143157
resp = raw_send_recv("DATA\r\n", nsock)
144158

145159
# Avoid sending tons of data and killing the connection if the server

0 commit comments

Comments
 (0)