Scams & Online Safety

Card Skimming on Websites

How hidden scripts steal card details at checkout, how shoppers can limit the damage and what site owners should lock down.

Key takeaways

  • A web skimmer is malicious script on a real site that copies form data before or while it is submitted.
  • HTTPS protects data in transit but can't protect it from code already running inside the page.
  • Wallets, virtual card numbers and payment pages hosted by a payment provider reduce what a skimmer can capture.
  • Transaction alerts and prompt statement checks catch misuse that nothing on the page would reveal.
  • Site owners should minimize payment-page scripts, patch software, restrict script sources and monitor for unexpected changes.

Web skimming is when someone tampers with a shopping site so that card details are copied as you type them at checkout. The shop may be completely genuine, the page may look normal and the connection may show HTTPS. As a shopper you often can't see it, so your best defense is limiting what a stolen number can do and noticing misuse quickly.

If you run a store, the defense is controlling exactly which code runs on your payment pages and detecting changes to it.

What web skimming is

Physical card skimmers are devices attached to card readers. A web skimmer, sometimes called formjacking or grouped under the name Magecart, does the digital equivalent: a piece of JavaScript added to a web page that reads what you enter and sends a copy to a server the attacker controls.

Your order often goes through as usual, which is why it goes unnoticed. The card numbers may be used or sold later, long after you've forgotten which shop it was.

How a web skimming incident unfolds
1 Entry A weakness in the store, a stolen login or a tampered third-party script. 2 Planted code Extra script is added where payment pages will run it. 3 Capture Shoppers type details and the script copies them. 4 Exfiltration The copy goes to a server the intruder controls. 5 Misuse Cards are tried or sold, sometimes much later. Entry A weakness in the store, a stolen login or a tampered third-party script. 1 Planted code Extra script is added where payment pages will run it. 2 Capture Shoppers type details and the script copies them. 3 Exfiltration The copy goes to a server the intruder controls. 4 Misuse Cards are tried or sold, sometimes much later. 5

How the code gets in

Attackers don't need to break encryption. They look for places where someone can change what the browser receives.

  • Unpatched store software or plugins with known flaws.
  • Weak or reused administrator passwords without multi-factor authentication.
  • Third-party scripts for analytics, chat, ads or reviews, where a compromise at the supplier spreads to every site using it. This is a form of supply chain attack.
  • Injection flaws that let outside input become part of the page or database; see SQL injection and cross-site scripting.
  • Compromised hosting or deployment credentials.

Browser extensions create a related risk on your side. An extension with permission to read and change page content can see form fields on any shop. See browser extensions: benefits, risks and permissions.

Why you usually can't see it

A skimmer runs inside the same page as the real checkout. It can read the fields as you type, and its network request can look like one more analytics call among dozens. It may run only on certain pages or for certain visitors.

Some variants add a fake payment form on top of the real one, or redirect you to a look-alike page before the genuine processor. Clues can include:

  • A card form that appears twice, or an error followed by a second, different form.
  • Fields asking for unusual data, such as a card PIN or bank password.
  • A payment page whose style clearly differs from the rest of the checkout.
  • A redirect to an unfamiliar domain.

None of these is reliable, and their absence proves nothing.

Skimming compared with phishing and breaches

The three are often confused, and they call for different habits.

Threat Where the data is taken What helps most
Web skimming A genuine site's page, as you type Tokens, virtual numbers, alerts
Phishing A fake page you were lured to Checking the address, typing it yourself
Database breach Stored records on a company's servers Not saving cards, unique passwords
Device malware Your own computer or phone Updates, careful installs

The overlap is that all four produce charges you didn't make, and the first response is the same: lock the card and report. Telling them apart matters for what you do next. If you typed your details into a look-alike page, change the passwords you entered there immediately; fake login pages explains the signs. If a device is infected, clean it before entering a new card number.

What shoppers can do

Shopper defenses, from outermost to last resort
Keep the number off the page Use a wallet or payment service where offered. Limit what a copy can do Virtual or single-use numbers with spending limits. Clean browser Updated software and few, trusted extensions. Notice quickly Real-time alerts and statement checks. Recover Lock the card, dispute charges and get a new number. Keep the number off the page Use a wallet or payment service where offered. Limit what a copy can do Virtual or single-use numbers with spending limits. Clean browser Updated software and few, trusted extensions. Notice quickly Real-time alerts and statement checks. Recover Lock the card, dispute charges and get a new number.

A wallet that uses tokens, as many mobile wallets do, sends the merchant a substitute value in place of your card number. A virtual number locked to one merchant is useless elsewhere. If you must type your card, using a credit card keeps your own bank balance out of the first line of fire. Safer ways to pay online compares these in more detail.

Think twice about saving your card at every shop. A saved card isn't what a skimmer reads, but it enlarges what an account takeover can spend.

An ad or script blocker can stop some third-party code, and may also break checkouts. Treat it as a modest extra layer.

A hypothetical timeline

Say you buy hiking socks from a small shop you've used before. The checkout looks as usual. Nearly two months later your bank texts you about an online purchase in another country that you didn't make. You freeze the card, call and get a replacement. Some weeks after that, the shop emails that malicious code ran on its checkout page during a period that includes your order.

Nothing you could see at the time would have warned you. What limited the harm was the alert, which turned a silent theft into a quick phone call. If you had paid through a wallet token or a virtual number locked to that shop, the stolen value would likely have been of little use to the thief.

When a notice arrives, read it for the dates, the types of data exposed and what the company is doing. Beware of emails that imitate such notices and include a link to "verify" your card.

If your card may have been skimmed

A shop may notify you, your bank may replace your card proactively, or you may spot odd charges.

  1. Lock or freeze the card in your banking app if possible.
  2. Call the number on the card, report unauthorized charges and ask for a new number.
  3. Review recent statements, including small test amounts.
  4. Update stored card details at services you trust.
  5. Change the password for the shop's account and anywhere you reused it.
  6. Be alert to follow-up phishing that mentions your order or address. See what to do after a data breach notice.

Chargebacks and disputing an online charge covers deadlines for getting money back.

What site owners should do

Reduce what your pages handle

Use a payment provider's hosted page or embedded fields, so card data is typed into the provider's frame rather than your own form. This shrinks your exposure, though the page that loads or redirects to the provider can still be tampered with, so it still needs protection.

Control the code

  • Keep an inventory of every script on payment pages, who owns it and why it is there. Remove the rest.
  • Set a Content Security Policy, a response header that tells browsers which sources may load scripts and where pages may send data. Content Security Policy in practice shows how to roll it out in report-only mode first.
  • Use Subresource Integrity for third-party files that don't change, so the browser refuses an altered copy.
<script src="https://cdn.example.com/lib.js"
        integrity="sha384-BASE64HASHOFTHEFILE"
        crossorigin="anonymous"></script>

The hash value above is a placeholder. You generate the real one from the exact file you reviewed.

Protect the way in

Patch store software and plugins quickly, remove unused ones, require multi-factor authentication for administrators and hosting accounts, limit who can edit templates and tag managers, and keep logs.

Watch for change

Monitor files, checkout pages and outgoing requests for differences. Compare what a real browser loads with what you expect, and investigate new domains. The Payment Card Industry Data Security Standard (PCI DSS) includes requirements about managing and watching scripts on payment pages in its recent versions; ask your payment provider or assessor which apply to you.

Have a plan

If you find a skimmer, preserve copies and logs before cleaning, close the entry point, rotate credentials, tell your payment provider promptly and get qualified help. Breach notification laws vary by place and may set deadlines.

Cleaning only the visible script often fails because the intruder kept another way in. Rebuild from known good sources where you can.

Testing your own store like a visitor

Owners often learn about a skimmer from a customer or a bank, which is late. A regular routine finds problems sooner.

  1. Open your checkout in a clean browser with developer tools, and list every domain the page contacts.
  2. Compare that list with your inventory. Anything unexplained needs an owner or removal.
  3. Check the rendered page for scripts you didn't deploy, including ones added through a tag manager.
  4. Review administrator accounts, API keys and recent changes to templates.
  5. Confirm that alerts for file and header changes still reach a person.
  6. Repeat after each plugin update or new marketing tool.

Do this only on sites you own or are authorized to assess. For a larger store, ask a qualified security professional for a review, and tell your payment provider about anything suspicious.

Common questions

Does HTTPS or a security badge mean the checkout is clean?

HTTPS means nobody between you and the server can read the traffic. It says nothing about the code the server sends. A badge image is not a continuous inspection.

Should I avoid small shops?

Size isn't a reliable guide. Prefer shops that hand payment to a recognized provider or offer wallets, and use alerts everywhere.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in Scams & Online Safety →

Latest news on this topic