bvstone

Email Address Spoofing with MAILTOOL

Posted:

Email Address Spoofing with MAILTOOL

Now that a lot of our IBM i customers are moving to the cloud for their email servers (ie, Google, Microsoft Office 365, Godaddy, etc) we are finding that some "tricks" have been played up until now that just won't cut the mustard with these new email services.

The main trick we're seeing is that of email address "spoofing".  This means the FROM address you are specifying doesn't match the Account (AUTHUSER) parameter on the MAILTOOL command.

When using a cloud service you're required, in most cases, to provide an account ID and password.  In most cases this should match the FROM address (ie, FROMADDR should be the same as AUTHUSER).  

Examine this scenario:

You just set up your new cloud server through GMail.  You supply an account id of joe@yourcompany.com along with the associated password.  But, for the "from" address you specify "replytome@yourcompany.com".  With most cloud providers one of two things will happen:

  1. The "from" address will automatically get changed to the account id, overriding the specified "from" address.
  2. The email will not be delivered because the "from" address and the account ID do not match.

I ran a couple of examples and am including the results of the SMTP debug file created by MAILTOOL to show exactly how this works:

Test 1: Using GMail

​The following command was run to perform this test:

MAILTOOL TOADDR(bvstone@yahoo.com) FROMADDR(notme@bvstools.com) 
SUBJECT(Test) MESSAGE('Test Email') CONFIG('/bvstools/bvstools_test2.json') 
DEBUG(*YES)

The following configuration file settings were used:

{
	"variables": [
	{
		"name":"send_with_server_type",
		"default":"*MAILTOOL"
	},
	{
		"name":"mail_router",
		"default":"smtp.gmail.com"
	},
	{
		"name":"use_mail_router",
		"default":"*ONLY"
	},
	{
		"name":"use_ssl",
		"default":"*YES"
	},
	{
		"name":"smtp_port",
		"default":"465"
	},
	{
		"name":"smtp_auth_user",
		"default":"bvstone@bvstools.com"
	},
	{
		"name":"smtp_auth_password",
		"default":"*********"
	}	]
}

The resulting email headers are as follows:

From: bvstone@bvstools.com
X-Google-Original-From: notme@bvstools.com
MIME-Version: 1.0
To: bvstone@yahoo.com
Subject: Test

  As you can see, in the case of GMail the From address is overridden.  Google does add it's own header showing what actually was used as the From address, though.

Test 2:  Using Outlook and Office 365

​The following command was run to perform this test:

MAILTOOL TOADDR(bvstone@yahoo.com) FROMADDR(notme@outlook.com) 
SUBJECT(Test) MESSAGE('Test Email') 
CONFIG('/bvstools/bvstone_outlook_test.json') DEBUG(*YES)

The following configuration file settings were used:

{
	"variables": [
	{
		"name":"send_with_server_type",
		"default":"*MAILTOOL"
	},
	{
		"name":"mail_router",
		"default":"smtp-mail.outlook.com"
	},
	{
		"name":"use_mail_router",
		"default":"*ONLY"
	},
	{
		"name":"perform_mx_lookup",
		"default":"*NO"
	},
	{
		"name":"use_ssl",
		"default":"*TLS"
	},
	{
		"name":"smtp_port",
		"default":"587"
	},
	{
		"name":"smtp_auth_user",
		"default":"bvstone@outlook.com"
	},
	{
		"name":"smtp_auth_password",
		"default":"*************"
	}	]
}

The resulting email headers are as follows:

From: Brad Stone <bvstone@outlook.com>
To: "bvstone@yahoo.com" <bvstone@yahoo.com>
Subject: Test

So, as you can see the outlook also does allow the email through but again it updates the From address to the same as the account used.

I have also run into the following error from a customer trying to use a different From address and Office 365:

03/16/2016 17:06:07 <SMTP.OFFICE365.COM says:> 550 5.7.60 SMTP; Client does not have permissions to send as this sender

In this case it is pretty obvious what the error is.  Either this can't be done or somewhere in Office 365 there are settings to allow different senders for different accounts.

UPDATE:  Here is another example from Office 365:

<SMTP.OFFICE365.COM says:> 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 

In the end, it's best to set up accounts for email and use the appropriately instead of trying to take the quick and easy way out.  Normally this just results in spending 3 or 4 times more resources on the project that just doing it right the first time.

Feel free to contact us with any questions regarding these issues.  Thanks!

Brad
www.bvstools.com


Last edited 02/21/2019 at 15:00:41



Latest Posts:

GreenTools For G Suite (G4G) v12.00 Released With Base OAuth 2.0 Functionality GreenTools For G Suite (G4G) v12.00 Released With Base OAuth 2.0 Functionality
Posted by July 28, 2019
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
BVSTools Small Price Increase in 2020 BVSTools Small Price Increase in 2020
Posted by July 26, 2019
BVSTools >> BVSTools Announcements
GreenTools for Vertex Cloud (VTXCLOUD) Now Available GreenTools for Vertex Cloud (VTXCLOUD) Now Available
Posted by July 22, 2019
BVSTools >> BVSTools Announcements >> GreenTools for Vertex Cloud (VTXCLOUD) Specific Announcements
GreenTools for Google Apps (G4G) - Drive Addon Successfully Verified by Google GreenTools for Google Apps (G4G) - Drive Addon Successfully Verified by Google
Posted by July 22, 2019
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
Why I Cancelled my DynDNS Service and How I Replaced It with an IBM i Application Why I Cancelled my DynDNS Service and How I Replaced It with an IBM i Application
Posted by July 17, 2019
IBM Power Systems >> (QGPL) IBM i
Green Tools for G Suite (G4G) Product Updates (Licensing, Functionality, Base Product) Green Tools for G Suite (G4G) Product Updates (Licensing, Functionality, Base Product)
Posted by July 13, 2019
BVSTools >> BVSTools Announcements >> GreenTools for G Suite (Google Apps) (G4G) Specific Announcements
Reading JSON Data from Standard Input With YAJL and RPG Reading JSON Data from Standard Input With YAJL and RPG
Posted by July 12, 2019
Programming >> Proof of Concept (POC)
MAILTOOL Updated to Allow Use of IBM Global Security Kit (GSKIT) for SSL/TLS Communications MAILTOOL Updated to Allow Use of IBM Global Security Kit (GSKIT) for SSL/TLS Communications
Posted by June 19, 2019
BVSTools >> BVSTools Announcements >> eMail Tool (MAILTOOL) Specific Announcements
GETURI v10.00 Released Supporting IBM Global Security Kit (GSKIT) and Server Name Indication (SNI) GETURI v10.00 Released Supporting IBM Global Security Kit (GSKIT) and Server Name Indication (SNI)
Posted by June 11, 2019
BVSTools >> BVSTools Announcements >> Get URI (GETURI) Specific Announcements
BVSTools Now Offers Vertex Cloud Interface BVSTools Now Offers Vertex Cloud Interface
Posted by April 15, 2019
BVSTools >> BVSTools Announcements
Token Has an Invalid Signature Error for Office 365 Email Token Has an Invalid Signature Error for Office 365 Email
Posted by March 22, 2019
BVSTools >> BVSTools Software Discussion >> GreenTools for Microsoft Apps (G4MS) Specific Discussion
Resending Emails that have Errored Out with Updated Router or Authentication Information Resending Emails that have Errored Out with Updated Router or Authentication Information
Posted by March 1, 2019
BVSTools >> BVSTools Software Discussion >> Email Tools (MAILTOOL) Specific Discussion
BVSTools Offers Toolset to Work With HubSpot OAuth 2.0 APIs On Your IBM i BVSTools Offers Toolset to Work With HubSpot OAuth 2.0 APIs On Your IBM i
Posted by January 27, 2019
BVSTools >> BVSTools Announcements
G4MSDRV Currently Not Supported G4MSDRV Currently Not Supported
Posted by January 17, 2019
BVSTools >> BVSTools Announcements >> GreenTools for Microsoft Apps (G4MS) Specific Announcements
Removing Trailing Carriage Returns and/or Line Feeds from a String with RPG Removing Trailing Carriage Returns and/or Line Feeds from a String with RPG
Posted by December 26, 2018
Programming >> RPG Programming

Reply




Copyright 1983-2019 BVSTools
GreenBoard(v3) Powered by the eRPG SDK, MAILTOOL Plus!, GreenTools for Google Apps, jQuery, jQuery UI, BlockUI, CKEditor and running on the IBM i (AKA AS/400, iSeries, System i).