# What Is Magecart? Client-Side Skimming and How to Detect It

Source: PageCrawl.io Blog
URL: https://pagecrawl.io/blog/what-is-magecart-client-side-monitoring

---

A mid-size retailer ran a routine quarter. Sales were steady, the checkout flow worked, and not a single server alarm fired. Then the card networks called: hundreds of customers who had bought from the site in the previous six weeks were reporting fraud, and the common point of purchase traced back to one place. The retailer's servers were clean and their database was untouched. The breach lived entirely in the customer's browser, in a few dozen characters of JavaScript that quietly copied every card number typed into the payment form and shipped it to a domain the attacker controlled. The checkout page looked and behaved exactly as it always had. That is Magecart.

This attack class has hit British Airways, Ticketmaster, Newegg, and thousands of smaller merchants who never made the news. It does not require breaching a database or cracking a password. It requires getting one script onto your payment page, and that script can arrive through a third party you have never audited. Because the skimmer runs in the browser and never touches your origin server, the tools most teams rely on (file-integrity scanners, web application firewalls, server logs) are looking in the wrong place.

This guide explains what Magecart is, how attackers inject card-skimming code, why it is so hard to spot, how PCI DSS 4.0 now requires you to watch for it, and how monitoring the scripts and integrity of your pages catches tampering before your customers do.

### What is Magecart?

Magecart is an umbrella term for client-side web skimming: malicious JavaScript injected into a checkout or payment page that harvests card numbers, CVVs, names, and addresses as customers type them, then sends that data to an attacker-controlled server. The code runs in the visitor's browser, not on your server, which is what makes it both effective and hard to detect.

The name originally referred to attacks against Magento storefronts, but the technique is platform-agnostic now. It works against any site that collects payment or sensitive data in a form, whether that is a custom checkout, a SaaS billing page, a donation form, or a login screen. Researchers track dozens of distinct threat groups under the Magecart label, each with their own infrastructure and tooling, so "Magecart" describes a category of attack rather than a single gang.

#### What client-side skimming actually steals

A skimmer hooks into the form fields a customer interacts with and reads the values directly, before they are encrypted and submitted to your payment processor. Because it operates at the keystroke or form-submit level inside the browser, it sees the data in the clear: the full card number, expiry, CVV, cardholder name, billing address, email, and phone. Some skimmers also grab login credentials or stored-card details from account pages. The data is base64-encoded or lightly obfuscated and beaconed out to an exfiltration domain, often one whose name mimics a real analytics or CDN provider so it blends into network traffic.

#### Why server-side defenses miss it

The defining trait of a Magecart attack is that nothing changes on your origin server in a way your usual tooling notices. The malicious code can be served from a compromised third-party script, injected through a tag manager, or planted in a JavaScript file your build pipeline never rebuilt. File-integrity monitoring, a WAF, and access-log review all assume the threat touches infrastructure you control. A browser-side skimmer routes around every one of them. The only place the attack is fully visible is the page as it renders in a real browser, after all scripts have executed.

### How do attackers inject card-skimming JavaScript?

Attackers get skimming code onto a payment page through two broad routes: compromising a third-party script the page already loads (the supply-chain path), or directly altering your own pages and files after gaining some level of access. Both end with malicious JavaScript executing in the customer's browser, and the supply-chain route is by far the more common because it scales.

A single payment page typically loads code from many origins: your own checkout script, the payment processor's library, analytics, a tag manager, session-replay tools, A/B testing, chat widgets, and fraud-scoring scripts. Every one is an entry point. If an attacker compromises any provider in that chain, their script gets weaponized against your customers without anyone touching your servers. This is why client-side risk is fundamentally a supply-chain problem, and why it overlaps with the package-level risk covered in our guide on [supply-chain monitoring for package releases](/blog/pypi-npm-package-release-supply-chain-monitoring).

#### The supply-chain route

The most damaging Magecart incidents have come through trusted third parties. An attacker compromises a widely embedded script (an analytics provider, a chat widget, a marketing pixel), modifies the file at its source, and every site that loads that script inherits the skimmer instantly. The merchant did nothing wrong on their own servers and gets breached anyway. The British Airways attack injected just 22 lines of code; the Ticketmaster breach came through a compromised third-party chat support script. From the merchant's side, the page is loading exactly the resources it always did, from exactly the domains it always trusted. Only the contents of one of those resources changed.

#### Direct compromise of your own pages

The second route is more conventional: an attacker gains access through a stolen admin credential, an unpatched CMS or plugin, an exposed deployment pipeline, or a misconfigured storage bucket, and edits your page templates or JavaScript bundles directly. They add a `<script>` tag, modify a form's action attribute, or insert a few lines into an existing bundle. Because the change is small and the page keeps working, it survives until someone looks closely. Defacement attacks are loud by comparison, which is why we cover them in the [website defacement monitoring](/blog/website-defacement-monitoring-detection) guide; a skimmer is engineered to be the opposite of loud. Authors keep the footprint tiny and the behavior conditional, often firing only on the checkout URL and staying dormant everywhere else, because dwell time (measured in weeks, not hours) is the attacker's entire business model.

### What does a Magecart skimmer look like on the page?

A skimmer reveals itself as a small set of structural changes to the rendered page: a new script element pointing at an unfamiliar domain, a modified form action, a hidden input added to capture data, an altered event handler on the payment form, or a new iframe overlaying the legitimate fields. Each change is subtle in isolation, which is why you compare against a known-good baseline rather than eyeballing the page.

The specific tells worth watching for are concrete and enumerable:

- A new `<script>` tag, especially one sourced from a domain you do not recognize or one that mimics a real provider (a near-miss of a CDN name).
- A change to an existing script's source URL or its Subresource Integrity hash.
- A modified form `action` attribute that redirects submitted data to a new endpoint.
- A hidden form field, or a new submit-event handler, added to harvest data the visible form does not request.
- A new or altered iframe positioned over the real payment fields.
- A weakened or removed Content-Security-Policy header that newly permits scripts from arbitrary origins.

Because attackers can introduce a skimmer by changing the contents of an already-allowed JavaScript file without altering one line of the page HTML, watching only the page markup is not enough. The individual bundle URLs and their integrity hashes matter as much as the page itself. Link-level tampering follows the same logic, which is why outbound link and resource integrity checks (covered in [backlink and link-tamper monitoring](/blog/backlink-monitoring-link-tamper-alerts)) belong in the same toolkit.

### Why are Magecart attacks so hard to detect?

Magecart attacks are hard to detect because they are engineered for invisibility on three fronts at once: the page keeps working perfectly, the change never touches your server, and the skimmer often activates only under narrow conditions. Nothing breaks, nothing logs, and nothing looks out of place to a customer or to a server-side scanner.

#### The page works exactly as before

Unlike ransomware or a defacement, a skimmer has every incentive to leave the checkout fully functional. Customers complete their purchases, orders flow through, and revenue looks normal. The attacker is copying data, not blocking it, so there is no degraded experience to trigger a support ticket or a synthetic-monitoring failure. Conversion dashboards stay green while card data leaks out the side.

#### Conditional, evasive, browser-only execution

Modern skimmers gate their behavior. They run only on the payment step, can detect developer tools and go dormant, and sometimes target only a fraction of sessions or exclude traffic that looks like automated scanning. A QA test or one-off manual review can easily land in the dormant path and come back clean while real customers are being skimmed. The check that beats this, and the one PCI DSS 4.0 codified, must evaluate the page as it is actually received and rendered by the consumer's browser. A skimmer delivered through a compromised CDN or tag manager never appears in your server's source files, so any check that reads server-side HTML or scans your repository misses it. You have to render the page the way a real visitor does, with all JavaScript executed, and compare that result to a trusted baseline.

### How does PCI DSS 4.0 address client-side skimming?

PCI DSS 4.0 added two requirements aimed squarely at Magecart, both mandatory since March 31, 2025. Requirement 6.4.3 makes you maintain an authorized inventory of every script on your payment pages, and 11.6.1 makes you deploy a change-and-tamper-detection mechanism that alerts staff when payment-page contents or HTTP headers are modified without authorization. Together they force the inventory-plus-detection model that skimmers exploit the absence of.

The two requirements work as a pair. 6.4.3 defines the baseline by establishing which scripts are authorized, why each is necessary, and how its integrity is assured (typically Subresource Integrity hashes or a strict Content-Security-Policy). 11.6.1 watches for deviation from that baseline, evaluating the page and its headers as received by the browser at least once every seven days, or more often if your risk analysis demands it. You cannot do 11.6.1 well without the 6.4.3 inventory, because every alert needs a known-good reference to compare against. We break down both requirements line by line in the dedicated guide on [PCI DSS 4.0 client-side script monitoring (6.4.3 and 11.6.1)](/blog/pci-dss-4-client-side-script-monitoring-6-4-3-11-6-1), and the broader audit workflow in [PCI DSS compliance with website change detection](/blog/pci-dss-compliance-website-change-detection).

The headers half of 11.6.1 matters more than it first appears. A weakened Content-Security-Policy is often the precursor to a script-injection attack, because relaxing the policy clears the path for code from new origins. Tracking the response headers (CSP, Strict-Transport-Security, X-Frame-Options) for unauthorized change catches the setup move, not just the skimmer itself. Even if you are not subject to PCI, these requirements describe a sound detection model for any site handling sensitive form data, and they fit a broader [compliance monitoring software](/blog/compliance-monitoring-software) program.

### How does monitoring page scripts and integrity detect tampering?

Page-integrity monitoring detects Magecart tampering by rendering each payment page in a real browser on a schedule, capturing the fully executed content and the response headers, and diffing that against the last known-good baseline. When a new script appears, a form action changes, a hidden field is added, or a security header is weakened, the diff surfaces the exact change and alerts your team. It catches what server-side scanning structurally cannot.

This is the browser-perspective check that 11.6.1 requires and that your incident-response process needs regardless of compliance. The monitor does not decide for you whether a change was authorized; it removes the genuinely hard part, which is noticing a tiny, silent change at all, and leaves you the tractable part of confirming whether the change matched a deployment you approved. Because it captures the page after JavaScript executes, it sees skimmers injected through third-party scripts and tag managers, the exact class of attack that server-side file-integrity monitoring walks straight past. A few related signals round out the picture: monitoring [certificate transparency logs](/blog/certificate-transparency-log-monitoring) catches attacker-issued certificates for lookalike exfiltration domains, and [domain and brand fraud monitoring](/blog/web-domain-fraud-monitoring-brand-protection) catches the spoofed domains skimmers beacon to.

### How do you set up Magecart detection monitoring with PageCrawl?

You set it up by monitoring each payment page as a real-browser render, tracking both the page contents and the HTTP response headers, scoping the diff to the structural elements a skimmer would alter, and routing alerts to a channel your security team watches. The free tier (6 monitors and 220 checks per month) is enough to prove the approach on your highest-value pages before you scale.

[Image: PageCrawl change diff for Checkout page scripts and integrity, highlighting the added and removed text]

**Step 1: Inventory every page that collects sensitive data.** List your checkout page, any hosted-payment-field container, account pages where cards can be added or edited, subscription and billing-management pages, and any login or form page handling sensitive input. If you have already done the PCI 6.4.3 work, you have this list. Each one becomes a monitor.

**Step 2: Add each page with full-page browser rendering.** Add the page URL and use full-page content monitoring so PageCrawl renders it in a real browser with JavaScript executed, capturing the page as the customer's browser receives it. This is what makes the check see dynamically injected skimmers rather than a static server-side source that misses them. PageCrawl ships with screenshots enabled by default, so every check stores a timestamped image of the rendered page.

**Step 3: Track the HTTP response headers.** Monitor the response headers alongside the content so a weakened Content-Security-Policy or a removed Strict-Transport-Security header triggers an alert. The header relaxation is frequently the first move in an injection campaign, and catching it early can mean catching the attack before the skimmer is even live.

**Step 4: Scope the diff to what a skimmer would change.** Payment pages contain dynamic noise (session tokens, cart timestamps, rotating nonces) that changes on every load and is not security-relevant. Use a focused [CSS selector or element-level approach](/blog/css-selector-guide-target-elements-monitoring) to watch the structural parts that matter (the script tags, the form markup, the headers) so legitimate churn does not bury a real signal in false positives.

**Step 5: Monitor the individual script bundles too.** Add the URLs of the first-party JavaScript bundles your payment page loads as their own monitors. A skimmer planted by modifying an already-allowed file changes the file's contents without touching the page HTML, and bundle-level monitoring is what catches that class of tampering.

**Step 6: Set a risk-based check frequency.** Weekly is the PCI floor, not the target. Match frequency to transaction volume: high-volume checkouts deserve checks every few minutes to hourly, medium-volume pages a few times a day, low-volume pages daily. Faster checks shrink the window during which a live skimmer harvests cards undetected.

**Step 7: Route alerts to people who can act.** Use email for routine review, [Slack or Teams alerts](/blog/website-change-alerts-slack) for fast team visibility, and a [webhook into your SIEM or incident platform](/blog/webhook-automation-website-changes) to open a ticket and page on-call the instant an unexpected script appears.

**Step 8: Retain the evidence.** PageCrawl keeps the full change history with timestamped screenshots, which doubles as the artifact an assessor wants and the forensic record an incident responder needs. Pair it with a [website archiving workflow](/blog/website-archiving) for long-term retention of the page states.

### How do you tell a real attack from your own deployment?

You separate attacks from your own changes with a baseline-and-verify loop: announce payment-page deploys to the same channel that receives alerts, compare every alert's diff against what the deployment actually changed and your authorized script inventory, update the baseline when they match, and escalate anything that does not. The hard problem is not catching changes; it is making sure your team still reads the alerts.

A team that learns to ignore alerts is worse off than one with no monitoring, so tuning out legitimate noise is part of the control, not a distraction from it. The workable process is short:

1. **Notify before you deploy.** When you ship a payment-page change, post a heads-up to the alert channel so the next notification is expected rather than alarming.
2. **Verify against the diff.** When an alert fires, compare what PageCrawl shows changed against the deployment and your script inventory. Matches get documented and the baseline updated.
3. **Exclude dynamic noise.** Scope monitoring to scripts, forms, and headers so rotating tokens and timestamps do not generate constant false positives.
4. **Escalate the unexpected.** Any change that does not map to a known deployment is a potential incident and goes straight to investigation. That is the entire point.

This loop turns a stream of diffs into a clean signal and produces the investigation records that both auditors and your own post-incident reviews depend on.

### Choosing your PageCrawl plan

PageCrawl's **Free plan** lets you monitor **6 pages** with **220 checks per month**, which is enough to validate the approach on your most critical pages. Most teams graduate to a paid plan once they see the value.

| Plan | Price | Pages | Checks / month | Frequency |
|------|-------|-------|----------------|-----------|
| Free | $0 | 6 | 220 | every 60 min |
| Standard | $8/mo or $80/yr | 100 | 15,000 | every 15 min |
| Enterprise | $30/mo or $300/yr | 500 | 100,000 | every 5 min |
| Ultimate | $99/mo or $999/yr | 1,000 | 100,000 | every 2 min |

Annual billing saves two months across every paid tier. Enterprise and Ultimate scale up to 100x if you need thousands of pages or multi-team access.

The economics of client-side skimming are brutally one-sided. A skimmer that runs undetected for six weeks can leak tens of thousands of card numbers, and the cost lands on you as forensic investigation, card-brand fines, mandatory reissuance, and a breach disclosure your customers remember. Against that, monitoring is the cheapest insurance available. Standard at $80/year covers 100 payment pages and script bundles with checks every 15 minutes and timestamped screenshots, enough for most single-storefront merchants to cover their full checkout flow plus the third-party bundles it loads. Enterprise at $300/year handles 500 pages with five-minute checks, suitable for multi-brand operations or agencies managing detection across many client sites. If monitoring catches even one injection early, it has paid for itself many times over.

### Getting Started

Take your single most important page, the checkout step where card data is entered, and set up full-page browser-based monitoring on it right now, with HTTP-header tracking on and screenshots enabled. Add the JavaScript bundles that page loads as their own monitors, route the alerts to the channel your security team already watches, and run it daily at minimum. Spend two weeks building the verify-against-deployment habit so a real skimmer would stand out against noise you have already tuned away, then expand to the rest of your payment flow.

The next Magecart victim will not see the breach coming, because the page will look perfect right up until the card networks call. Monitor the page your customers actually receive, and you see the one line of code they never will.

---

Need more? The complete PageCrawl.io help center, with every article, is available as a single document at https://pagecrawl.io/llms-full.txt. Read it for context on anything this page does not cover.
