Magento 2 Fake Subscriber (SPAM) Sign Ups – Newsletter Security

One of the most powerful tools in any business’ arsenal is a well maintained subscriber list. However, in Magento 2 there is a glaring oversight in the protection of the basic subscription functionality, leaving the platform open to the potential for cross-site insertion of fake subscribers. These fake subscriber attacks/spam lead to larger costs in email marketing by sending to dead-end email addresses as well as a large amount of spam complaints from scraped email addresses, which can lead to blacklisting and even serious legal trouble.

So what can be done? The simplest solution is to require a “form key” at the time of email subscription. You may ask, “What is a form key? It is merely a unique identifier that is only present when a page is loaded directly into a client and is not present when scammers/spammers use remote scripts to pollute your subscriber list.

To this end, I wrote a Free Extension, which inserts a form key into the default Magento 2 newsletter subscription form and then checks for that form key whenever a new newsletter subscription is processed.

E-Commerce Gorilla Newsletter Form Key Download & Installation Instructions

The free module can be downloaded from the following link:

Once you have downloaded and unzipped the module, move the files into the root of your Magento 2 store.

Log in to your hosting via SSH and navigate to the root of your Magento 2 store and run the following commands:

And there you go! Now any time a subscription request is run through Magento’s core subscription controller, it will check for and validate the attached form key, greatly improving the integrity of your email lists.

Hans-Eirik Hanifl

view all posts

Hans-Eirik Hanifl is a forward thinking e-commerce and marketing consultant. As an advocate for the free exchange of knowledge, he founded E-Commerce Gorilla as a place where like-minded individuals can ask questions and share their expertise on practical solutions in the area of e-commerce and marketing. He is the owner of TRM Marketing and an avid supporter of the open source community.

0 Comments Join the Conversation →


Leave a Reply

Stay in the loop!

E-Commerce Gorilla Avatar

Join the E-Commerce Gorilla e-mail newsletter. We provide monthly updates on new articles featuring all aspects of online sales and E-Commerce setup. We cover the do's and don'ts of effective online sales, along with great giveaways. As a newsletter subscriber you are automatically entered for any competitions and giveaways.* Join our community of engaged online marketing experts, great content, and great giveaways. You can't go wrong.