Hello,
I would like to discuss with SmarterMail users community about behavior where email is being spoofed inside message content which allows it to pass SPF checks and simple SMTP session connection dropping with error "550 Authentication is required for relay" when spoofed email is located on primary server.
Issue here is that when this message hits recipient Inbox he sees that this message has been sent from his own domain. There is no trace of email used in SMTP session which is completely different than email in FROM field in message content headers. There is still DMARC error but hey how many users looks at that?
This is how it looked inside client webmail:
FROM field contained spoofed email address from client domain to which email has been delivered with message content that some invoice must be paid. This message has been delivered with this spam score:
X-SmarterMail-Spam: SPF [Pass]: 0, Null Sender: 0, DMARC [failed]: 0, RemoteSpamd [raw:-3]: -3, DKIM [None]: 0
additionally Trusted Sender is marked as "green" because this spoofed email address is on clients mailbox contact list so it is Trusted right....?
SMTP LOG:
2025.01.13 13:12:39.724 [SENDERSMTPSERVER][24990761] rsp: 220 INCOMINGGATEWAYHOST
2025.01.13 13:12:39.724 [SENDERSMTPSERVER][24990761] connected at 2025-01-13 13:12:39
2025.01.13 13:12:39.724 [SENDERSMTPSERVER][24990761] Country code: PL
2025.01.13 13:12:39.740 [SENDERSMTPSERVER][24990761] cmd: EHLO SENDERSMTPSERVERHOT
2025.01.13 13:12:39.740 [SENDERSMTPSERVER][24990761] rsp: 250-INCOMINGGATEWAYHOST Hello [SENDERSMTPSERVER]250-SIZE 139810133250-AUTH LOGIN CRAM-MD5250-STARTTLS250-8BITMIME250-DSN250 OK
2025.01.13 13:12:39.755 [SENDERSMTPSERVER][24990761] cmd: STARTTLS
2025.01.13 13:12:39.755 [SENDERSMTPSERVER][24990761] rsp: 220 Start TLS negotiation
2025.01.13 13:12:39.833 [SENDERSMTPSERVER][24990761] cmd: EHLO SENDERSMTPSERVERHOT
2025.01.13 13:12:39.833 [SENDERSMTPSERVER][24990761] rsp: 250-INCOMINGGATEWAYHOST Hello [SENDERSMTPSERVER]250-SIZE 139810133250-AUTH LOGIN CRAM-MD5250-8BITMIME250-DSN250 OK
2025.01.13 13:12:39.849 [SENDERSMTPSERVER][24990761] cmd: MAIL FROM:<SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE> SIZE=139051 BODY=8BITMIME
2025.01.13 13:12:39.849 [SENDERSMTPSERVER][24990761] senderEmail(1): SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE
2025.01.13 13:12:39.974 [SENDERSMTPSERVER][24990761] rsp: 250 OK <SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE> Sender ok
2025.01.13 13:12:39.974 [SENDERSMTPSERVER][24990761] Sender accepted. Weight: 0. Block threshold: 90.
2025.01.13 13:12:39.989 [SENDERSMTPSERVER][24990761] cmd: RCPT TO:<CLIENTVALIDMAILBOX@CLIENTDOMAIN> ORCPT=rfc822;CLIENTVALIDMAILBOX@CLIENTDOMAIN
2025.01.13 13:12:40.021 [SENDERSMTPSERVER][24990761] rsp: 250 OK <CLIENTVALIDMAILBOX@CLIENTDOMAIN> Recipient ok
2025.01.13 13:12:40.052 [SENDERSMTPSERVER][24990761] cmd: DATA
2025.01.13 13:12:40.052 [SENDERSMTPSERVER][24990761] Performing PTR host name lookup for SENDERSMTPSERVER
2025.01.13 13:12:40.083 [SENDERSMTPSERVER][24990761] PTR host name for SENDERSMTPSERVER resolved as SENDERSMTPSERVERHOT
2025.01.13 13:12:40.083 [SENDERSMTPSERVER][24990761] rsp: 354 Start mail input; end with <CRLF>.<CRLF>
2025.01.13 13:12:40.099 [SENDERSMTPSERVER][24990761] senderEmail(2): SPOOFEDEMAILADDRESSINCLIENTSDOMAIN parsed using: NAME DISPLAYED IN EMAIL <SPOOFEDEMAILADDRESSINCLIENTSDOMAIN>
2025.01.13 13:12:40.099 [SENDERSMTPSERVER][24990761] Sender accepted. Weight: 0. Block threshold: 90.
2025.01.13 13:12:40.239 [SENDERSMTPSERVER][24990761] DMARC Results: Failed (Domain: CLIENTDOMAIN, Reason: SPF: True, DKIM: False, Alignments: 0, Domain: CLIENTDOMAIN), Reason: SPF: True, DKIM: False, Alignments: 0, Domain: CLIENTDOMAIN, Reject? False
2025.01.13 13:12:40.239 [SENDERSMTPSERVER][24990761] rsp: 250 OK
2025.01.13 13:12:40.255 [SENDERSMTPSERVER][24990761] Received message size: 139822 bytes
2025.01.13 13:12:40.255 [SENDERSMTPSERVER][24990761] Successfully wrote to the HDR file. (SPOOLPATH\Spool\SubSpool9\-2096324960707.hdr)
2025.01.13 13:12:40.255 [SENDERSMTPSERVER][24990761] Data transfer succeeded, writing mail to -2096324960707.eml (MessageID: <20250113121239.757E04E050D@s.........>)
2025.01.13 13:12:40.255 [SENDERSMTPSERVER][24990761] cmd: QUIT
2025.01.13 13:12:40.255 [SENDERSMTPSERVER][24990761] rsp: 221 Service closing transmission channel
2025.01.13 13:12:40.255 [SENDERSMTPSERVER][24990761] disconnected at 2025-01-13 13:12:40
and then DELIVERY LOG
2025.01.13 13:12:42.532 [24960707] Delivery started for SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE at 13:12:42
2025.01.13 13:12:45.559 [24960707] Added to SpamCheckQueue (0 queued; 3/30 processing)
2025.01.13 13:12:45.559 [24960707] [SpamCheckQueue] Begin Processing.
2025.01.13 13:12:45.559 [24960707] Blocked Sender Checks started.
2025.01.13 13:12:45.559 [24960707] Spam Checks started.
2025.01.13 13:12:45.964 [24960707] Finished running spam checks. Time (non-rbls): 397ms, Time (URIBL/RBLS): 0ms
2025.01.13 13:12:45.964 [24960707] Spam Check results: [_SPF: 0,Pass], [NULL SENDER: 0,passed], [_DMARC: 0,failed], [_REMOTERSPAMD: -3:-3], [_DKIM: 0,None]
2025.01.13 13:12:45.964 [24960707] Spam Checks completed.
2025.01.13 13:12:45.964 [24960707] Removed from SpamCheckQueue (2 queued or processing)
2025.01.13 13:12:48.569 [24960707] Added to RemoteDeliveryQueue (0 queued; 3/200 processing)
2025.01.13 13:12:48.569 [24960707] [RemoteDeliveryQueue] Begin Processing.
2025.01.13 13:12:48.569 [24960707] Sending remote mail from SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE
2025.01.13 13:12:48.569 [24960707] Sending remote mail to: CLIENTVALIDMAILBOX@CLIENTDOMAIN
2025.01.13 13:12:48.569 [24960707] Initiating connection to PRIMARYSMIP
2025.01.13 13:12:48.569 [24960707] Connecting to PRIMARYSMIP:25 (Id: 1)
2025.01.13 13:12:48.569 [24960707] Binding to local IP INCOMINGGATEWAYIP (Id: 1)
2025.01.13 13:12:48.569 [24960707] Connection to PRIMARYSMIP:25 from INCOMINGGATEWAYIP:57017 succeeded (Id: 1)
2025.01.13 13:12:48.663 [24960707] RSP: 220 PRIMARYSMHOST
2025.01.13 13:12:48.663 [24960707] CMD: EHLO INCOMINGGATEWAYHOST
2025.01.13 13:12:48.694 [24960707] RSP: 250-PRIMARYSMHOST Hello [INCOMINGGATEWAYIP]
2025.01.13 13:12:48.694 [24960707] RSP: 250-SIZE 139810133
2025.01.13 13:12:48.694 [24960707] RSP: 250-AUTH LOGIN CRAM-MD5
2025.01.13 13:12:48.694 [24960707] RSP: 250-STARTTLS
2025.01.13 13:12:48.694 [24960707] RSP: 250-8BITMIME
2025.01.13 13:12:48.694 [24960707] RSP: 250-SMTPUTF8
2025.01.13 13:12:48.694 [24960707] RSP: 250-DSN
2025.01.13 13:12:48.694 [24960707] RSP: 250 OK
2025.01.13 13:12:48.694 [24960707] CMD: STARTTLS
2025.01.13 13:12:48.725 [24960707] RSP: 220 Start TLS negotiation
2025.01.13 13:12:48.725 [24960707] CMD: EHLO INCOMINGGATEWAYHOST
2025.01.13 13:12:48.788 [24960707] RSP: 250-PRIMARYSMHOST Hello [INCOMINGGATEWAYIP]
2025.01.13 13:12:48.788 [24960707] RSP: 250-SIZE 139810133
2025.01.13 13:12:48.788 [24960707] RSP: 250-AUTH LOGIN CRAM-MD5
2025.01.13 13:12:48.788 [24960707] RSP: 250-8BITMIME
2025.01.13 13:12:48.788 [24960707] RSP: 250-SMTPUTF8
2025.01.13 13:12:48.788 [24960707] RSP: 250-DSN
2025.01.13 13:12:48.788 [24960707] RSP: 250 OK
2025.01.13 13:12:48.788 [24960707] CMD: MAIL FROM:<SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE> RET=HDRS ENVID=8e1c5581-8d63-409d-a397-de83349c4da6 SIZE=140088
2025.01.13 13:12:48.819 [24960707] RSP: 250 OK <SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE> Sender ok
2025.01.13 13:12:48.819 [24960707] CMD: RCPT TO:<CLIENTVALIDMAILBOX@CLIENTDOMAIN> NOTIFY=FAILURE
2025.01.13 13:12:48.850 [24960707] RSP: 250 OK <CLIENTVALIDMAILBOX@CLIENTDOMAIN> Recipient ok
2025.01.13 13:12:48.850 [24960707] CMD: DATA
2025.01.13 13:12:48.881 [24960707] RSP: 354 Start mail input; end with <CRLF>.<CRLF>
2025.01.13 13:12:48.913 [24960707] RSP: 250 OK
2025.01.13 13:12:48.913 [24960707] CMD: QUIT
2025.01.13 13:12:48.944 [24960707] RSP: 221 Service closing transmission channel
2025.01.13 13:12:48.944 [24960707] Process delivery status notification step from recipient success. Recipient: [CLIENTVALIDMAILBOX@CLIENTDOMAIN], Notify: [], LastError: [], RanDomainFilter: [False], RanGlobalFilter: False
2025.01.13 13:12:48.944 [24960707] Delivery for SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE to CLIENTVALIDMAILBOX@CLIENTDOMAIN has completed (Delivered)
2025.01.13 13:12:48.944 [24960707] Removed from RemoteDeliveryQueue (0 queued or processing)
2025.01.13 13:12:51.580 [24960707] Removing Spool message: Killed: False, Failed: False, Finished: True
2025.01.13 13:12:51.580 [24960707] Delivery finished for SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE at 13:12:51 [id:-2096324960707]
Issue here is that during SMTP session remote server introduces itself as email sender:
2025.01.13 13:12:39.849 [SENDERSMTPSERVER][24990761] senderEmail(1): SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE
BUT inside message content we have:
2025.01.13 13:12:40.099 [SENDERSMTPSERVER][24990761] senderEmail(2): SPOOFEDEMAILADDRESSINCLIENTSDOMAIN parsed using: NAME DISPLAYED IN EMAIL <SPOOFEDEMAILADDRESSINCLIENTSDOMAIN>
SPF check and simple SMTP session bouncing with:
550 Authentication is required for relay
error is being checked ONLY for senderEmail(1) which allows message to be delivered to primary mail server with only DMARC error and no other SPAM scoring is message does not look too SPAM looking for rspamd and has been sent from some valid SMTP server which is not being listed on RBL lists.
Bottom line for now I've received two client different complains about that. Both of them received identical email message with some invoice to be paid right away.
Now I would like to open discussion how this should be handled by SmarterMail. For now only SMTP session senderEmail(1) is being used for SMTP session dropping and SPF check and IMHO this should be expanded to senderEmail(2) especially that this second senderEmail(2) is already known during SMTP session right? This is visible in SMTP session log above:
2025.01.13 13:12:39.849 [SENDERSMTPSERVER][24990761] senderEmail(1): SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE
....
2025.01.13 13:12:40.099 [SENDERSMTPSERVER][24990761] senderEmail(2): SPOOFEDEMAILADDRESSINCLIENTSDOMAIN parsed using: NAME DISPLAYED IN EMAIL <SPOOFEDEMAILADDRESSINCLIENTSDOMAIN>
Response from SmarterTools support that this should be handled by DMARC policy but should it be? Maybe I'll ask from different view. Why not just add this email address to SPF and SMTP session dropping with "550 Authentication is required for relay" error. If SMTP Session would be dropped then even SPF check would be not needed here. I don't have SMTP auth bypass enabled on primary server for incoming gateways,
Thanks
P.S. If someone needs additional clarification then just ask questions.
P.P.S. PHP script which I've made to reproduce this issue:
$mail->isSMTP();
$mail->Host = 'REMOTESMTPHOST;
$mail->SMTPAuth = true;
$mail->Username = 'SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE ;
$mail->Password = '****************';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->Sender = 'SOMEREMOTEEMAILADDRESSUSEDTOSENDMESSAGE ';
$mail->setFrom('SPOOFEDEMAILADDRESSINCLIENTSDOMAIN ');
$mail->addAddress('CLIENTVALIDMAILBOX@CLIENTDOMAIN');
$mail->isHTML(true);
$mail->Subject = 'test subject';
$mail->Body = 'test body';
$mail->CharSet = 'UTF-8';
$mail->send();