PrestaShop 9 not sending emails over SMTP: the port 587 bug
Orders come in, but not a single email goes out. It's a PrestaShop 9 bug with port 587: 9.2 fixes it, and today you can…
A customer emails you: when they opened your store, a “verify you are human” box asked them to press two keys, paste something and hit Enter. You check and see nothing wrong. If this has happened to you, your PrestaShop store has been hacked with ClickFix: someone has slipped in a piece of code that shows that fake captcha to your visitors so they install a malicious program themselves, usually one that steals passwords.
It won't go away on its own: someone got into your store and left it there. It can be cleaned up, but what really matters is closing the door they came in through. And you are not alone: on 3 September Netskope counted more than 5,400 infected websites in this campaign, almost all of them small businesses. The ones they examined one by one were mostly WordPress and sometimes PrestaShop.
The page blurs behind a fake captcha that asks you to press the Windows key and R, paste and press Enter. What gets pasted is a command the page has already copied without telling anyone, and running it installs the attacker's program. A real captcha never asks you to open anything on your computer.
Not seeing it doesn't mean it isn't there. The code in your store fetches the trap from somewhere else every time a page opens, and the attacker decides what is shown and to whom without touching your store again. It targets Windows computers, and the variant The Hacker News described on 6 October even hides the program in the visitor's browser before asking them to do anything.
The customer's screenshot is enough to get started.
In the database, in a field the store prints on every page, or in the files: Netskope found it appended to legitimate JavaScript files and in folders that imitate a real plugin. The French merchant who described it on 5 October on the PrestaShop forum, with a 1.7.8 store, found nothing in his database, and the back doors were in files across several folders.
index.php. One more, or one whose name starts with a dot and that your FTP program hides, is a back door.The check under Advanced Parameters → Information → List of changed files only looks at whether core files have changed: not the theme, not the modules, not the images, and not files that were added. An empty list doesn't mean a clean store.
Netskope doesn't know yet how those sites were compromised. On PrestaShop, the usual doors are a module with a known flaw that was never updated, a stolen or easy back-office password, and “nulled” modules, paid modules downloaded for free from pirate sites, which often come with the back door already installed.
ps_facetedsearch, the catalogue filters module that ships with PrestaShop: anyone, without an account, could run code on your server. It is fixed in 4.0.4; if you had an older version, assume it may have been the way in. And remove modules you don't use./admin. A second step with a code on your phone doesn't come built in, but a module adds it.Read-only queries; replace ps_ with the store's prefix. Warehouse stores its code fields escaped, so search for <script as well.
SELECT name, LEFT(value, 120)
FROM ps_configuration
WHERE value LIKE '%<script%'
OR value LIKE '%<script%'
OR value LIKE '%eth_call%'
OR name LIKE '%codes_js';
SELECT id_cms, id_lang
FROM ps_cms_lang
WHERE content LIKE '%<script%';
SELECT id_employee, email,
id_profile, active,
last_connection_date
FROM ps_employee
ORDER BY id_employee DESC;
In the files, from the store's root:
find img upload download \
-name '*.php' ! -name index.php
find . -name '.*.php'
find . -type f -mtime -30 \
\( -name '*.php' -o -name '*.js' \) \
-not -path './var/cache/*'
grep -rl -e eth_call -e prebsc \
-e bsc-testnet -e claritydelivr \
--include=*.js --include=*.php \
--include=*.tpl .
The campaign's indicators are in Netskope's list. Reinstalling the core and modules from clean packages of the same version is safer than deleting file by file; afterwards, clear var/cache and themes/*/assets/cache. PrestaShop 9 ships an .htaccess that blocks PHP from running in img, upload, download, js, vendor and modules: make sure they are still there and, on Nginx, which doesn't read them, carry those rules into the server configuration.
If you've found something and have nobody to clean it up, if it came back after cleaning, or if you don't know where to start. It's part of our support and maintenance service: we clean the store, find out how they got in and close the door. Send us your customer's screenshot and your PrestaShop version, and we'll look at it the same day or the next.
Orders come in, but not a single email goes out. It's a PrestaShop 9 bug with port 587: 9.2 fixes it, and today you can…
It loads fine from abroad and times out from Spain, right on match day. It is not your server: it is a blocked…
A module, an app, a server that is giving you trouble, or just a second opinion. The first consultation is free, and a fixed quote comes out of it with a price and a date.