WordPress Security

Investigating a Credit Card Skimmer on a WooCommerce Store

Investigating a Credit Card Skimmer on a WooCommerce Store

It usually starts with an uncomfortable phone call or email. A payment provider says several cards used on your store have later been used fraudulently. Or customers report suspicious charges shortly after buying from you. Or a security researcher contacts you about strange code on your checkout page.

In my forensic work, these situations almost always lead to the same discovery: a card skimmer. A small piece of malicious JavaScript, hidden somewhere in the site, quietly copying payment details as customers type them and sending them to the attacker.

Skimming incidents are serious. They affect real customers, can lead to fines and investigations and can cost a business its ability to take card payments. They’re also very investigable if you know where to look. Here’s how skimmers work on WooCommerce and how I approach finding them.

How web skimmers work

Web skimming, sometimes called a Magecart attack after groups that popularised it, is the online version of a card skimmer fitted to an ATM. The attacker doesn’t need access to your payment provider. They only need to run JavaScript on your checkout page.

Once their script runs in a customer’s browser, it can:

  • Read form fields as the customer types card details, billing address and email.
  • Inject a fake payment form that looks like your real one, collecting card details before showing an error and letting the customer try again on the genuine form.
  • Overlay or replace an embedded payment form with an attacker-controlled copy.
  • Send captured data to a server the attacker controls, often disguised as an analytics or image request.

Modern payment integrations that use secure fields or frames from the payment provider make direct skimming harder, because the card fields are inside the provider’s frame. That’s why many skimmers on WooCommerce sites inject a fake payment form instead, which the customer has no way to distinguish from the real one.

How attackers get the script onto the site

Common entry points include:

  • A vulnerable plugin that allows file uploads, code injection or privilege escalation.
  • A stolen administrator password, after which the attacker edits theme files or plugin settings.
  • A compromised third-party script, like a chat widget or analytics library, loaded on the checkout page.
  • Nulled plugins or themes containing hidden code from the start.

The skimmer is then hidden somewhere it will run on checkout pages.

Where skimmers hide

From investigations I’ve done, common hiding places are:

The database

Many skimmers live in the database rather than in files, because file integrity monitoring won’t notice them. Typical locations:

  • wp_options: settings fields that plugins print into pages, like custom header or footer scripts, theme options or plugin settings that accept HTML.
  • Widgets containing custom HTML.
  • Posts or pages, especially the checkout page content.
  • Settings of code snippet plugins.

Theme and plugin files

  • The theme’s functions.php, header.php or footer.php.
  • JavaScript files of popular plugins, modified to append malicious code at the end of an otherwise legitimate file.
  • New, innocently named files in plugin folders.

Third-party scripts

A compromised external script loaded on checkout, or a script loaded from a domain that has expired and been re-registered by an attacker.

Conditional loading

Many skimmers only activate on the checkout page, only for visitors who aren’t logged in as administrators, or only after a certain date. Some check whether developer tools are open. That’s why admins browsing their own store often see nothing wrong.

Step 1: Preserve evidence

Before changing anything:

  • Take a full backup of files and database.
  • Save web server access logs; they may be rotated soon.
  • Record the current checkout page source, as served to an anonymous visitor.

You may need this evidence for your payment provider, for forensic investigators or for legal reasons. Changing things first can destroy it.

Step 2: Look at the checkout as a customer

Open the checkout in a private browser window, not logged in, ideally from a different network. Add a product to the cart and go to checkout. Then:

  • View the page source and look for unfamiliar scripts, especially obfuscated code or scripts from domains you don’t recognise.
  • Open developer tools and look at the network tab. Fill in the billing fields with test data, without submitting a real card, and watch for requests to unexpected domains.
  • Compare the payment form with what your payment provider’s integration should look like. An extra card form outside the provider’s frame is a major red flag.

Because some skimmers detect developer tools or admin visitors, repeat this on a different device if the first attempt shows nothing.

Step 3: Search the database

Look for script tags and suspicious patterns in places where content is stored:

Then look for unfamiliar domains. Skimmers often send data to domains designed to look legitimate, such as names resembling analytics, CDN or payment services with small spelling changes.

Check the settings of any plugin that lets you add custom code to the header, footer or specific pages.

Step 4: Check files

  • Verify core and repository plugins against checksums:
<code>find wp-content -name "*.js" -mtime -60 -printf "%TY-%Tm-%Td %pn"sorttail -50</code>
  • Look at the end of large JavaScript files. Appending malicious code to legitimate libraries is a common trick.
  • Check theme files for unexpected script output.

Step 5: Review logs and accounts

  • Check administrator accounts for unfamiliar users.
  • Review activity logs for changes to plugin settings, theme files or code snippets.
  • Search access logs around the time the skimmer likely appeared for POST requests to admin pages, plugin endpoints or file upload handlers.

Finding the entry point matters. Without it, the attacker can come back.

Step 6: Contain and clean

Once you’ve found the skimmer:

  1. Remove the malicious code, from the database and files.
  2. Replace core, plugins and themes with fresh copies from official sources.
  3. Remove rogue users and rotate all credentials: WordPress admins, hosting, SFTP, database, payment provider API keys and any other integrations.
  4. Regenerate WordPress security keys.
  5. Fix the entry point, such as updating or removing a vulnerable plugin.
  6. Check again as an anonymous visitor, using developer tools, that no unexpected scripts load and no data goes to unknown domains.

If you can’t be confident the site is clean, consider taking checkout offline temporarily, or switching to a fully hosted payment page where card details are entered entirely on the provider’s site.

Step 7: Notify the right people

A card skimming incident has obligations beyond fixing the site:

  • Your payment provider or acquiring bank. Tell them promptly. They may require a forensic investigation by an approved investigator, depending on the scale and your agreements.
  • Customers, where required by law or advised by your provider. Data breach notification rules vary by country.
  • Data protection authorities, if personal data breach rules in your region require it, often within strict deadlines.

Get legal advice if you’re unsure of your obligations. Being open and quick usually leads to better outcomes than delay.

Step 8: Prevent it happening again

  • Keep checkout pages lean, with as few scripts as possible.
  • Use a Content Security Policy on checkout that restricts script sources and where data can be sent.
  • Use your payment provider’s secure fields or hosted payment pages.
  • Monitor checkout page scripts for changes, using external monitoring that loads the page as a customer would.
  • Use file integrity monitoring and an activity log.
  • Enforce two-factor authentication for all administrator and shop manager accounts.
  • Keep everything updated and remove unused plugins.
  • Never use nulled plugins or themes.

Frequently asked questions

Can a skimmer steal cards if I use a payment provider’s embedded fields?

It’s harder, because card fields are inside the provider’s frame. But skimmers often inject fake payment forms outside the frame, so customers type card details into the attacker’s form. Your checkout page still needs protecting.

Why can’t I see the skimmer when I visit my checkout?

Many skimmers hide from logged-in administrators, only activate on certain pages or detect developer tools. Test as an anonymous visitor on a different device and network.

Do I have to tell my customers?

It depends on your location, the data involved and your payment provider’s requirements. Many regions have breach notification laws. Get advice quickly.

Should I keep selling while investigating?

If you suspect an active skimmer, taking checkout offline or switching to a fully hosted payment page until the site is clean protects your customers from further harm.

Final thoughts

A card skimmer turns your checkout into a trap for your own customers, and it’s usually hidden where you won’t casually look. Preserve evidence, test checkout as a real customer would, search both the database and files, find the entry point, clean thoroughly, rotate every credential and notify the right people promptly. Then lock down your checkout with fewer scripts, a strict Content Security Policy and active monitoring. Quick, methodical action limits the damage and protects the trust your customers placed in you.