I‘ve been following the various threads about how to prevent spammers from signing up random emails for whatever reasons. It happens to my super small self-hosted blog as well. Obviously, I don’t want people to receive unwanted signup emails and possibly declaring them as spam which can hurt my sender’s reputation.
My idea was to set a custom header that nginx verifies when /members/api/send-magic-link/ is hit. So I added this code to Settings→Advanced→Code Injection→Header:
You’re right, my method doesn’t help against headless browsers. However, I’m seeing 5-10 potential spammers who get the 403 error when hitting the send-magic-link directly.
With that said, I still don’t understand why the Ghost team doesn’t add a few Captcha options.
Thank you for this, I’ll have to try it out soon. Spam signups have been getting really annoying recently. I don’t want random people to receive a welcome message and subsequently think I’m spamming them. Though I’m still puzzled what the final goal is, as my site doesn’t even offer comment functionality.
Giving this a shot as I’ve been getting a TON of spam signups. Wild that Ghost cant put some sort of challenge in front of this. I also added cloudflare managed challenge on the signup though not yet sure how much that will help.
combined with a fail2ban rule on 4xx this should be pretty interesting
This is a worthy mod to add to the arsenal, caught 7 attempts yesterday. Well done. I did modify the code slightly so its not exactly like how youve posted here so that if they mirror your solution it wont work.
yeah, just tested, youre correct. I dont use them though so not a concern for me. good for anyone else to be aware of though. all the more reason for a proper solution from the ghost development team.
Thanks for pointing this out! It should still be possible to put the code snippet that sets the x-ghost-human header in front of the code for the form. Alternatively, let the IP address of the webserver with the signup form pass through in the nginx.conf part where it checks for the x-ghost-human header.
I’ve been getting bombarded with fake sign-ups for the last few days on my mostly-inactive blog. This morning they were coming in every few minutes, non-stop…
Did the code injection as shown at the top of this thread. Since I use a Cloudflare Tunnel for my site, I created a Security Rule in Cloudflare instead of the nginx.conf to block the bots.
EDIT: Now up to 41 bot attempts blocked in just under 24hrs, from IPs all over the world. A majority seem to come from “Green Floid LLC” in the U.S., “M247” in Europe, and “The Constant Company LLC” in Canada & Europe. And an occasional consumer ISP IP sprinkled in there. I wonder what this apparent botnet hopes to accomplish.