Skip to content

Commit 6dad66c

Browse files
David MaloneyDavid Maloney
authored andcommitted
add Date header support to SMTP deliver
the SMTP mixin now supports the Date header. The user can supply a a value for the Date Header or else it will automatically use the current local DateTime. This will help alleviate certain issues caused by servers setting this field for the cliebnt incorrectly MSP-9390
1 parent 7876401 commit 6dad66c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/msf/core/exploit/smtp_deliver.rb

Lines changed: 9 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,14 @@ 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 propper 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+
143152
resp = raw_send_recv("DATA\r\n", nsock)
144153

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

0 commit comments

Comments
 (0)