In short
- Do not delete anything in a rush. The files, accounts and logs left by the attacker show how they got in.
- Notify quickly your hosting provider or agency, your payment provider if cards may have been stolen, and your data protection authority if personal data is involved: within 72 hours of discovery, where possible.
- Restoring a backup is not enough: if the flaw is still open, the attacker comes back.
- After the clean-up, change every password, key and token, apply the security patches and keep a close eye on the store.
Contents
The signs of a hacked Magento 2 store
A hack rarely shows on the shop front. The attacker prefers to stay out of sight: the longer they stay, the more they collect. The signs are often small. One alone proves nothing, but two or three together call for an immediate check.
What your customers see
- Redirects to another site (gambling, pharmacy, fake shop), sometimes only from Google or only on mobile.
- A payment form that looks different, an extra payment step, or a payment that fails and then goes through on the second attempt.
- Customers reporting fraud on their card after buying from you.
What you see in the admin panel
- An admin account nobody recognises, or an existing account that has been given full admin rights. See our guide: spot a suspicious admin account.
- An integration or API access you did not create.
- Unusual orders: many small declined orders, a string of failed payments, customer accounts created in bulk.
- A content block or header setting changed for no reason, with a script you do not recognise.
What others tell you
- Google shows a warning in its results or in the browser. The Search Console “Security issues” report then tells you what it found: hacked content, malware or social engineering.
- Your hosting provider writes to you: spam sent from the server, malicious file detected, unusual load, account suspended.
- Your bank or payment provider tells you that your store is the common point between several fraudulent cards. This is often the sign of a card skimmer.
How attackers get in in 2026: StyleSmuggler, SessionReaper, PolyShell
Most recent Magento store hacks go through a known flaw, exploited at scale in the days after it is published. If your store did not get the right patch in time, that is the first lead to check. Here are the three most exploited flaws this year, with the traces to look for (situation as of 26 October 2026).
StyleSmuggler (APSB26-146, CVE-2026-75650)
- What it allows: an attacker with no account can run code on the server through the GraphQL API. Adobe gives it the most severe score (10 out of 10). It has been exploited since early September 2026; Adobe published an emergency hotfix on 7 September.
- Affected versions: Magento 2.4.4 to 2.4.9, up to and including the August 2026 releases. No Magento release includes the fix yet: you need to apply the isolated VULN-39341 hotfix. The October security update (APSB26-153) does not replace it: Adobe asks you to apply both.
- The traces: in the web server logs, requests containing
styles[generatorClass]orstyles[first]; invar/log/exception.log, errors such asMap file provided does not existorType Error occurred when creating object: Aws\S3\S3Client. - After an exploitation: the attacker may have read the encryption key. Adobe asks you to change it, along with every credential (see the passwords, keys and tokens to change).
SessionReaper (APSB25-88, CVE-2025-54236)
- What it allows: taking over customer accounts through the REST API and, depending on the configuration, running code.
- Fixed versions: 2.4.8-p3, 2.4.7-p8, 2.4.6-p13, 2.4.5-p15 and 2.4.4-p16 (October 2025), or the isolated VULN-32437 hotfix. A store left on an older version is still exposed.
- The traces: PHP files dropped in
pub/media, which should only hold images and documents.
PolyShell
- What it allows: uploading a file with no account, through the custom options of a cart. A
.phtmlor.pharfile dropped inpub/media/custom_options/can then be run. - Affected versions: when Sansec disclosed it in March 2026, it was only fixed in the 2.4.9 branch. On an older version, block PHP execution in
pub/mediaat web server level, and check with whoever manages the store where the patches stand for your version. - The traces: many uploads to guest carts (
guest-carts) from the same address,.phtmlor.pharfiles inpub/media, anaccesson.phpfile in an images folder, an unknown script in a CMS block or page.
To find out whether your store is up to date, see also Adobe security patches for Magento.
Hacked Magento: what not to do in the first hours
The first instinct is often to wipe everything so the problem goes away. It is the worst thing you can do.
- Do not delete files, accounts or logs. They are the evidence. They show how the attacker got in, what they took and since when. Without them, you cannot close the right door, or answer your bank, the data protection authority or your insurer.
- Do not restore a backup without understanding what happened. If the flaw is still there, the attacker comes back. And a backup may already contain their backdoor.
- Do not switch the server off. Isolate it if needed, but leave it running: its memory also holds traces. Visa recommends disconnecting the machine from the network without shutting it down, and the French government’s Cybermalveillance.gouv.fr service advises unplugging it from the internet.
- Do not log in to the compromised machine to change passwords there: Visa advises against it. Change the passwords of exposed accounts quickly, but from a clean computer. The full change of every access comes afterwards, once the door is closed.
- Do not handle it alone. Bring in someone who knows Magento.
Who to notify when your Magento store is hacked
- Your hosting provider or agency, straight away. They have access to the server, the logs and the backups. If they process your data on your behalf, the GDPR also requires them to report any breach they become aware of.
- Your payment provider or bank, if cards may have been stolen. Visa’s guide asks you to notify the merchant’s bank (the acquirer) immediately and to hand over an incident report within three business days. Your contract may set other rules: read it again.
- Your data protection authority (the CNIL in France), if personal data is affected: customers’ names, addresses, emails, passwords, bank cards. You are the data controller. The GDPR asks you to notify the breach without undue delay and, where feasible, no later than 72 hours after becoming aware of it, unless it poses no risk to the people concerned. If you do not have all the information yet, the notification can be made in stages.
- Your customers, if the risk to them is high (bank cards, passwords). The GDPR requires this without undue delay, except in the cases set out in article 34.
- The police. Cybermalveillance.gouv.fr advises filing a complaint before reinstalling anything.
- Your insurer, if your policy covers cyber attacks.
In every case, record the breach in your internal documentation: the facts, their effects and the action taken. The GDPR requires this even when you do not notify the authority.
Hello,
We believe our Magento store has been hacked: [describe what you saw, for example an unknown admin, a redirect, an alert from the bank].
Could you, as a matter of urgency:
- keep a copy of the web server, PHP and Magento logs (var/log), without deleting anything;
- tell us which backups exist and from which dates;
- let us know if you see any unusual activity on the server;
- not clean up or restore anything until we understand how the intrusion happened.
Please reply as soon as possible.
You manage the server: first checks on a hacked Magento 2
These commands change nothing on the site. They are used to preserve the evidence and assess how far the intrusion goes. Replace /var/www/store with your Magento folder.
-
Put the logs somewhere safe before they are rotated. Adjust the folders to your web server, then copy the archive off the server:
Terminalsudo tar --ignore-failed-read -czf /root/evidence-$(date +%F).tar.gz /var/log/nginx /var/log/apache2 /var/www/store/var/log -
Look for PHP files in
pub/media. This folder only holds images and documents. A PHP file has no business being there:Terminalfind /var/www/store/pub/media -type f \( -name '*.php' -o -name '*.phtml' -o -name '*.phar' \) -print -
List the files changed in the last seven days, leaving out the folders Magento rewrites itself:
Terminalfind /var/www/store \( -path /var/www/store/var -o -path /var/www/store/generated -o -path /var/www/store/pub/static -o -path /var/www/store/pub/media \) -prune -o -type f -mtime -7 -printA file date is easy to fake. An empty list therefore proves nothing.
-
If the code is versioned with Git, compare it with the repository:
Terminal, from the Magento foldergit status --short -
Check the scheduled tasks of the site user and the authorised SSH keys. Attackers use them to come back:
TerminalScheduled tasks of the site user sudo crontab -u www-data -l SSH keys authorised on the server sudo find /root /home /var/www -name authorized_keys -print -
In the database, list the admin accounts and the integrations. The queries are in our article on suspicious admin accounts. For scripts injected into CMS blocks and the configuration, see the article on skimmers.
For developers
What Adobe recommends. Adobe’s “Best practices to respond to a security incident” page asks you, among other things, to: audit the admin accounts, keep the logs, compare the production code with the Git repository, reinstall the files from a clean source, review the HTML fields of the header and footer at every level (website, store view), and reset every access: database, files, payment, shipping, integrations and API keys.
Regaining control of a hacked Magento 2: with or without a clean backup
Once you understand how the attacker got in, there are two cases.
You have a clean backup
A backup is clean if it dates from before the intrusion. Only the investigation can give you that date: one more reason to keep the traces.
- The code can safely be restored from the backup or, better still, from the Git repository and Composer.
- The database is trickier: restoring it wipes the orders and customers recorded since. It is often better to clean it by hand (accounts, integrations, blocks, configuration), then compare it with the backup.
- Then apply the security patches before reopening the store. Otherwise, the same flaw gets used a second time.
You have no clean backup
You need to clean up. Adobe recommends removing unnecessary files, reinstalling the ones the store needs from a clean source, quarantining suspicious code and redeploying all the code. In practice:
- the Magento core and the extensions are reinstalled from Composer;
- the store’s own code (theme, custom modules) is compared line by line with its repository, or reviewed;
- the database is reviewed: admin accounts, integrations, CMS blocks and pages, HTML configuration, store URLs.
When to start again on a new server
Cleaning the Magento folder is not always enough. If the attacker was able to run commands on the server, they may have left traces outside the store: a scheduled task, an SSH key, a system account, a modified program, a file in another site hosted on the same machine. Nobody can then guarantee that everything has been removed.
Start again on a new server, installed from scratch, in any of these cases:
- the attacker gained access to the server itself (command line, SSH, hosting account), not just to the Magento admin panel;
- files were changed outside the store folder, or unknown scheduled tasks, SSH keys or accounts have appeared;
- other sites on the same server are affected;
- the investigation cannot tell how far the attacker went.
On the new server, the code is redeployed from the Git repository and Composer, never copied from the old one. The database is imported after being reviewed, and every access is changed (see below). The old server stays isolated, without being wiped, for the duration of the investigation: it holds the evidence. Your hosting provider can supply a new machine; it is often quicker and safer than a long clean-up.
The passwords, keys and tokens to change
Once the door is closed, change everything the attacker may have read. If you do it before, they may see the new credentials go by:
- the passwords of all admin accounts, and delete the accounts you do not need;
- the database password, stored in
app/etc/env.php; - SSH and SFTP access, and access to the hosting control panel;
- Magento’s encryption key: Adobe asks you to change it as soon as it may have been compromised, which is the case after a StyleSmuggler exploitation (the
bin/magento encryption:key:changecommand, the only method since Magento 2.4.8). Changing the key is not enough: credentials already read must be changed too; - the API keys of the payment provider, the carrier and the email service;
- the integrations: delete the ones you do not recognise, recreate the others.
After the clean-up: avoid another Magento 2 hack
Adobe points it out: many sites are compromised again within hours of an incident. The PCI Security Standards Council makes the same observation for skimmers: if the flaw is not fixed, or if a piece of the attacker’s code stays in place, the infection comes back.
- Apply Adobe’s security patches and keep them up to date. See Adobe security patches for Magento.
- Keep two-factor authentication on the admin panel. It has been on by default since Magento 2.4.0, and Adobe strongly advises against turning it off.
- Monitor code integrity: any change to a file outside a deployment should be reported to you.
- Monitor accounts, integrations and content: a new admin or a script added to a block should trigger an alert.
- Read the logs in the following days, and ask Google to review the site from the Search Console once every page has been cleaned.
- Take stock once things have calmed down: our Magento 2 security audit and our guide to securing Magento 2 list the settings to review.
Tocsin24 spots the traces of a hack, not just the outage
Tocsin24 checks your Magento store every hour by default and alerts you by email, notification or text message. It compares Magento’s sensitive files with the official version installed, and flags a PHP file dropped into pub/media, a file changed outside a deployment, or a file changed in a way that hides the change. It also flags a new admin account, an unknown integration, a CMS block or header setting that contains a script, and a changed store URL. Each incident has its own page: the items involved, the history and the evidence.
Tocsin24 is neither a firewall nor an automatic clean-up: it alerts and it explains. The work itself stays in human hands, with our post-compromise intervention.
Critique Ouvert #214
Fichier officiel différent de la version officielle
Sécurité · détecté le 22 octobre 2026 à 03:29 · 1 occurrence
Traiter l'incident
Fichiers concernés1 Relevé du 22 octobre 2026 à 03:29
Fichiers sensibles de Magento dont l'empreinte n'est ni celle de la version officielle installée, ni celle d'un patch officiel. Sous chaque fichier, la commande qui le compare à sa version officielle (dépôt public d'Adobe), à lancer à la racine de la boutique : les lignes « > » sont celles de la boutique ; un correctif Adobe appliqué apparaît aussi.
| Fichier et commande de comparaison | Changement |
|---|---|
| pub/index.php curl -s 'https://raw.githubusercontent.com/magento/magento2/2.4.8-p2/pub/index.php' | diff - 'pub/index.php' | MModifié |
« Légitime » valide tout le lot.
Preuve de chaque passage dans « Historique et preuves ».
Référentiel
Ce qui est connu et validé sur l'instance : domaines, comptes, intégrations, contenus, fichiers. Tout écart est à valider.
- Domaines 2
- Comptes administrateur 3 1
- Intégrations 2
- Tokens API 3
- Blocs CMS 18
- Pages CMS 9
- Configuration HTML 4
- Fichiers inattendus dans media 0
- Fichiers de code 68412
Comptes administrateur
Dernier rapprochement : 23 octobre 2026 à 09:00. Cochez les éléments que vous reconnaissez comme légitimes. Tout élément « à valider » est un écart ; un acquittement est daté et signé, et peut être révoqué.
-
À valider
support2
- username
- support2
- support2@example.net
- firstname
- Support
- lastname
- Technique
- role
- Administrators
- is_active
- true
Légitime Non légitime
-
Légitime
cdurand
-
Légitime
direction
Application screens with example values.
Frequently asked questions
How can I tell whether my Magento site has been hacked?
Look for several signs together: an unknown admin account, an integration you did not create, a redirect to another site, a warning from Google, an alert from your bank or hosting provider. One sign alone is not proof, but it is reason enough for whoever manages the server to check.
Is my Magento store affected by StyleSmuggler (APSB26-146)?
Yes, if it runs Magento 2.4.4 to 2.4.9 without the isolated VULN-39341 hotfix: as of 26 October 2026, no Magento release includes the fix yet, not even the October security update (APSB26-153). Ask whoever manages the store to check that VULN-39341 is applied, then to look for traces of exploitation in the logs. If the store was exploited, change the encryption key and every credential.
Do I have to report a hacked Magento store to the data protection authority?
Yes, if personal data may have been read or stolen and this puts your customers at risk. The GDPR requires you to notify your data protection authority (the CNIL in France) without undue delay and, where feasible, within 72 hours of discovering it. In every case, you must record the breach internally.
Can I just restore a backup?
Not without knowing how the attacker got in. The flaw is still open after the restore, and the backup may already contain their backdoor. Restoring the database also wipes the orders placed since. Understand first, restore second, then apply the patches.
Should I close the store during the clean-up?
If card details or customer data are being stolen right now, yes, long enough to stop the leak. Otherwise, the store can often stay open during the investigation. Decide with the person handling the incident.
Why has my Magento site been hacked again after the clean-up?
Because the way in was left open, or something the attacker left behind survived: an account, an integration, a scheduled task, an SSH key, a hidden file. You need to fix the flaw, change every access and watch the store closely in the following weeks. If the attacker had control of the server itself, the safest option is to start again on a new server.
Sources
- Adobe Commerce: APSB26-146, critical security update (StyleSmuggler, CVE-2026-75650)
- Adobe: security bulletin APSB26-153 (October 2026)
- Adobe: security bulletin APSB25-88 (SessionReaper, CVE-2025-54236)
- Sansec Research: PolyShell
- Adobe Commerce: Best practices to respond to a security incident
- Adobe Commerce: Encryption key
- Magento Open Source 2.4.0: release notes (two-factor authentication)
- GDPR, articles 33 and 34 (text published by the CNIL, in French)
- CNIL: notifying a personal data breach (in French)
- Cybermalveillance.gouv.fr: hacking of a business IT system (in French)
- Cybermalveillance.gouv.fr: website defacement (in French)
- Visa: data security, what to do if compromised
- PCI Security Standards Council: The Threat of Online Skimming to Payment Security (2019)
- Google Search Console: Security issues report
- NIST SP 800-61 Rev. 2 (withdrawn in 2025): Computer Security Incident Handling Guide, § 3.3.4 eradication and recovery