On this page
What this issue is
Magecart is the common name for web skimming attacks. An attacker gets a line of JavaScript onto your checkout page. The script reads the card number, expiry date and CVV from the form and sends them to a server the attacker controls. The customer still completes the order, so nothing looks wrong.
The script usually arrives in one of four ways: a hacked admin or hosting account, a vulnerable plugin or theme, a compromised third-party script or library you load, or a tag manager container edited by someone who should not have access. It is often tiny, obfuscated (made hard to read) and named to look like analytics.
Why it costs you leads or sales
The direct cost is stolen cards. Customers see fraud on their statements, card brands and your payment provider may investigate, and you can face fines, forced security audits, chargebacks and in the worst case losing the ability to take cards. You may also have legal duties to notify customers and regulators.
The indirect cost is trust. Browsers and security vendors can flag a site as dangerous, which drops traffic and conversions. Because checkout keeps working, skimmers can run for weeks before anyone notices.
- Attacker gains accessWeak admin password, plugin flaw or tampered third-party script
- Script added to checkoutA few lines of obfuscated JavaScript
- Customer types cardFields are read as they are typed
- Data sent outRequest to the attacker's domain
- Order completesLooks normal to you
The order succeeds, so the theft goes unnoticed.
How to check if your site has it
You are looking for scripts or network requests on the checkout that you did not put there. Do this in a normal browser window on your real checkout page, ideally with a test product in the basket.
List every script domain
Open the checkout, press F12, go to the Network tab, filter by JS and reload. Write down every domain that is not yours or a vendor you know (payment provider, analytics, chat).
Watch for requests when you type
Keep the Network tab open, type fake test data into the card fields (never a real card) and look for new POST or image requests to unfamiliar domains.
Search the page source
View source and search for eval(, atob(, fromCharCode, long encoded strings and script tags with odd domains or recent look-alike names such as google-analytics typos.
Check the tag managerGoogle Tag Manager
In Google Tag Manager, review Custom HTML tags and the version history for changes you did not make.
Check recently modified files
On your server or in your theme and plugin editor, look for files changed recently that nobody on your team edited.
Run a malware scan
Use your platform's or host's malware scanner and compare theme and core files against clean copies.
How to fix it
If you find a skimmer, treat it as a security incident. Act in this order so you stop the theft first and then close the door it came through.
Stop the data flow
Take the checkout offline or switch to a hosted payment page of your provider while you clean up. Keep a copy of the malicious code and logs as evidence.
Remove the malicious code
Delete the script from templates, files, database fields (such as footer or header injection settings) and tag manager tags. Restore changed files from a clean backup or fresh download.
Find the entry point
Review admin users, recent logins, plugin and theme versions and who can edit your tag manager. Remove unknown accounts and update or delete vulnerable plugins.
Rotate every credential
Change passwords and API keys for the CMS, hosting, database, FTP/SSH, payment and tag manager. Turn on two-factor authentication.
Tell your payment provider
Contact your payment provider and acquirer. They will advise on card brand notification, a forensic review and customer notification rules in your country.
Restrict scripts with a CSP
Add a Content Security Policy that only allows script sources you trust (see the snippet below).
Check users and plugins
Under Users, remove unknown administrators. Under Plugins, delete anything unused or abandoned and update the rest.
Check injected code
Look in Appearance > Theme File Editor (header.php, footer.php, functions.php) and any header/footer injection plugin settings. Reinstall WordPress core from Dashboard > Updates.
Review theme code
Under Online Store > Themes > Edit code, check theme.liquid and any recently modified files. Compare with a fresh copy of the theme.
Review apps and staff
Remove unused apps and their leftover code. Under Settings > Users and permissions, remove unknown staff and enable two-step authentication. Check checkout customizations in Settings > Checkout.
Audit tags and versions
Open Versions to see who published what and when. Delete unknown Custom HTML tags and restore a known-good version.
Tighten access
Under Admin > User Management, remove unknown users and limit Publish rights to people who need them.
Check custom code
In Site settings > Custom code and each page's settings, remove script tags you do not recognise. Review Workspace members and enable 2FA.
Compare against version control
Diff the deployed files against your repository, check build pipelines and dependencies, and look for modified files and new cron jobs or admin users.
Pin third-party scripts
Self-host critical libraries or add Subresource Integrity (integrity attribute) so changed files are blocked.
<meta http-equiv="Content-Security-Policy-Report-Only" content="script-src 'self' https://js.stripe.com https://www.googletagmanager.com; connect-src 'self' https://api.stripe.com;">
<!-- Adjust the allowed domains to the vendors you actually use.
Prefer sending the header from the server; move to Content-Security-Policy once reports are clean. -->Before
- Any script can load on the payment page
- Nobody owns the list of scripts
- Shared admin logins, no 2FA
After
- CSP allows only named script sources
- Documented list of checkout scripts with owners
- 2FA and least-privilege access
How to confirm it's fixed
- The Network tab on checkout shows only domains you can name and justify
- No unknown requests fire when you type into test card fields
- A fresh malware scan is clean
- Unknown admin users and tag manager tags are gone
- All passwords and API keys have been rotated and 2FA is on
- CSP reports show no blocked unknown sources
- Your payment provider has confirmed next steps
How to prevent it happening again
Skimmers thrive on scripts nobody is watching. Keep the checkout as small as possible and know what runs on it. If you take card payments, standards such as PCI DSS 4.0 ask you to keep an inventory of the scripts on payment pages and to detect unauthorised changes, so check what applies to you.
- Use a hosted or iframe payment form from your provider so card fields are not on your own page
- Keep an inventory of scripts on checkout with a reason and owner for each
- Remove tags and apps you no longer use
- Apply a Content Security Policy and Subresource Integrity where you can
- Limit who can publish in the tag manager and CMS, and require 2FA
- Update plugins, themes and dependencies promptly
- Review tag manager version history monthly
Day 0
Example: a plugin flaw lets an attacker add a script to the footer.
Day 1-30
Example: orders complete normally while cards are copied.
Day 31
Example: a bank or customer reports fraud linked to your store.
Day 32
Example: script removed, access closed, provider informed.
How FunnelGuard handles this
FunnelGuard detects this only partly. Its robot visitor runs your real checkout journey on a schedule and the check looks for new third-party domains. Today, a new third-party domain on the checkout is not flagged as a skimmer warning, so a new domain showing up there will not on its own trigger a skimmer alert.
FunnelGuard is not a malware scanner and does not read or judge what a script does, so it cannot confirm that a script is a skimmer. It never enters real card details and stops before payment unless your store's test mode is set up, so it will not see skimming behaviour that triggers only on real card entry.
Cover the rest by hand: keep a script inventory, review the Network tab on checkout after every release, set up a CSP in report-only mode, and watch your tag manager version history. FunnelGuard still helps by catching a broken checkout step or missing tracking hit that follows a bad script change, with a screenshot and a likely cause. The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans have a 3-day free trial.
Questions people ask
What is a Magecart attack?
Magecart is the name for web skimming attacks where criminals inject JavaScript into an online checkout. The script copies card details as the customer types and sends them to the attacker. The purchase still goes through, so it is hard to notice.
How do I know if my checkout has a card skimmer?
Open the checkout, press F12 and check the Network tab for script domains and requests you cannot explain, especially when typing into test card fields. Also review page source, theme files, tag manager Custom HTML tags and run a malware scan. Skimmers can hide, so repeat while logged out and with items in the cart.
How do I remove a skimmer script from my website?
Take or switch the checkout to a hosted payment page, delete the malicious code from files, database settings and tag manager, and restore changed files from clean copies. Then remove unknown users, update plugins, rotate all passwords and keys, and tell your payment provider.
How do skimmers get onto a checkout page?
Common routes are stolen admin or hosting credentials, vulnerable plugins or themes, a compromised third-party script or library, and unauthorised edits to a tag manager container. Anything that can add code to the page can add a skimmer.
Does a Content Security Policy stop Magecart?
A CSP can block scripts from unapproved domains and stop data being sent to unapproved destinations, which makes skimming much harder. It is not a complete defence, because an attacker who controls an allowed domain or your own files can still inject code. Use it alongside access controls and monitoring.
Does using Stripe or PayPal protect me from card skimmers?
A hosted payment page or iframe from your provider keeps card fields off your own page, which greatly reduces the risk. Skimmers can still target other pages, redirect customers to fake forms or steal other data, so you still need to control scripts on your site.
Can FunnelGuard detect a Magecart skimmer?
Only partly. FunnelGuard runs your checkout journey on a schedule, but a new third-party domain on checkout is not flagged as a skimmer warning, and it does not analyse script behaviour. Use it to catch broken steps and tracking, and check scripts by hand or with a CSP.
Related issues
- OPS-196Unknown third-party domain appears on checkout pageFix guide
- OPS-197Compromised npm/CDN library serving malicious codeFix guide
- OPS-198Abandoned script domain re-registered by attackerFix guide
- OPS-199Tag manager container edited by unknown userFix guide
- OPS-204Session recording capturing card or password fieldsFix guide
- OPS-200Too many third-party scripts (performance and risk)Fix guide