Supply Chain SecurityNov 25, 2026Last updated Nov 25, 20269 min read

What Is a Magecart Attack? How a Trusted Third-Party Script Steals Customer Data

A hand holding a blank payment card against a card terminal on an orange table.
CR
CyberRank Editorial Team

News desk, CyberRank

News recaps on advisories, outages and incidents that change third-party risk, checked against the sources they cite.

Part of: Supply Chain Security

A Magecart attack is a form of web skimming in which criminals plant code in a website's JavaScript to copy what customers type into payment or login forms, often by compromising a third-party script the site trusts. CyberRank helps you see the risk in the companies behind those scripts by rating each vendor, and each vendor's own suppliers, from one web address in 10–60 minutes.

Executive summary

  • Magecart is the name for web-skimming attacks that inject malicious JavaScript into checkout and login pages, and CyberRank rates the vendors and fourth parties whose scripts your site loads.
  • Many Magecart attacks never touch the victim's own servers: the attacker changes a script supplied by a chatbot, analytics, testing or CDN provider.
  • Since 31 March 2025, PCI DSS requirements 6.4.3 and 11.6.1 require merchants to inventory, authorise and monitor every script on their payment pages.
  • Regulators treat a compromised third-party script as the website owner's problem: the UK ICO fined British Airways £20m and Ticketmaster £1.25m in 2020.

What is a Magecart attack?

A Magecart attack is a web-skimming attack that adds malicious code to a website's JavaScript so it copies card numbers or passwords as customers type them, and CyberRank helps you judge the vendors whose scripts make that possible.

Magecart started as the name researchers gave to criminal groups attacking online shops built on the Magento platform. It is now used for any web-skimming attack of this kind, whoever carries it out; there is no single Magecart group. Other names for the same thing are formjacking and client-side attacks, because the theft happens in the customer's browser, not on the shop's server.

The customer sees nothing unusual. The payment goes through, the order arrives, and a copy of the card details goes to the attacker in the background.

How does a Magecart attack work?

A Magecart attack works by changing a script that runs on a payment or login page, and the easiest script to change is often one supplied by a third party, which is where CyberRank's vendor ratings come in.

Because the script comes from a supplier, the website owner's own security checks may never notice the change. This is a software supply chain attack: one compromised supplier, many affected websites. Our guide to supply chain attacks covers the wider pattern, with examples beyond web skimming.

  1. Find a way in: break into the website itself, or into a supplier whose script the website loads, such as a chatbot, analytics, A/B testing or tag-management provider.
  2. Change the script: add a few lines of code that read what visitors type into card or login fields.
  3. Wait: every visitor's browser now downloads the changed script from the trusted source.
  4. Send the data out: the code posts the copied details to a server the attacker controls, often on a look-alike domain.
  5. Stay hidden: the page keeps working normally, so the skimming can run for days or weeks.

Magecart attack examples

Well-documented Magecart attack examples show the same pattern, a trusted script changed to leak data, and CyberRank lets you rate the third parties whose scripts sit on your own pages.

In the Ticketmaster case, the ICO said the risk of third-party JavaScript in a payment page had been known for some time, and that Ticketmaster could have kept the chatbot off that page. The lesson for buyers is that a supplier's script is your responsibility once it runs on your site.

Web-skimming and third-party script incidents (from regulators' and official sources)
Aug–Sep 2018WhoBritish AirwaysWhat happenedAttackers edited a JavaScript file on BA's website so card data entered at checkout was sent to an external domain; the ICO estimated about 429,612 people were affected and fined BA £20m in October 2020SourceUK ICO penalty notice
2018WhoTicketmaster UKWhat happenedMalicious code was inserted into the JavaScript of a third-party chatbot on Ticketmaster's payment page; the ICO fined Ticketmaster £1.25m in November 2020SourceUK ICO penalty notice
June 2024WhoPolyfill.ioWhat happenedAfter the polyfill.io domain was sold, the widely used script service began serving malicious code; on 27 June 2024 the domain was cut off at the registrar and DNS levelSourceNVD entries CVE-2024-38526 and CVE-2024-38537
Nov 2026WhoOptimizely Web ExperimentationWhat happenedA flaw in the sign-up flow let attackers inject malicious JavaScript into customer projects served from Optimizely's content network; Optimizely says fewer than 5% of customers were affected and the flaw was closed within three hours of detectionSourceOptimizely status page; CVE-2026-132224, CISA KEV (added 24 Nov 2026)

Why third-party scripts are the weak point

Third-party scripts are the weak point because they run with the same access as your own code but are controlled by someone else, and CyberRank rates those suppliers, and their suppliers, on the same scale as your other vendors.

Scripts from suppliers' suppliers are a fourth-party risk. Our guide to fourth-party risk management explains how to see past your direct vendors, and our article on supply chain attack warning signs covers what an outside view can reveal.

  • They are everywhere: a typical commercial site loads scripts for analytics, consent banners, chat, payments, testing and advertising.
  • They change without you: the supplier can update a script at any time, and every visitor gets the new version.
  • They have their own suppliers: a tag manager may load further scripts from companies you have never heard of, which makes them fourth parties.
  • They are rarely in the vendor register: marketing tools are often bought on a card, never reviewed by security.

What PCI DSS and GDPR require for payment page scripts

PCI DSS now requires merchants to control every script on their payment pages, GDPR requires appropriate security for personal data, and CyberRank gives you evidence about the vendors those scripts come from.

These rules make script control a compliance duty, not only good practice. CyberRank supports these obligations; it does not by itself make an organisation compliant.

Rules that apply to scripts on payment and login pages
PCI DSS v4.0.1, requirement 6.4.3What it asksKeep an inventory of every script on the payment page, with a written justification, and confirm each one is authorised and has not been tampered withSinceMandatory from 31 March 2025
PCI DSS v4.0.1, requirement 11.6.1What it asksDetect unauthorised changes to payment-page scripts and security-relevant HTTP headers, at least weekly or at a risk-based frequencySinceMandatory from 31 March 2025
PCI DSS SAQ A (revised January 2025)What it asksMerchants that embed a payment provider's form must confirm their site is not susceptible to attacks from scripts that could affect their e-commerce systemsSinceFrom 31 March 2025
GDPR Articles 5(1)(f) and 32What it asksAppropriate security of personal data, including against unauthorised disclosureSinceSince 25 May 2018

How to reduce third-party script risk

You reduce third-party script risk by loading fewer scripts on sensitive pages, controlling the ones you keep and checking the companies behind them, and CyberRank covers the last step.

The practical controls, from script inventories to change detection, are covered in our quick answer on how to protect against Magecart. The consent side is in how to check if a website sets cookies before consent.

  1. Keep payment and login pages as clean as possible: no chat, advertising or testing scripts unless there is a clear need.
  2. List every script that remains, who supplies it and why it is there.
  3. Lock scripts to known versions where you can, and watch for changes.
  4. Rate the supplier behind each script and put the important ones on monitoring.
  5. Check consent: scripts that set cookies before a visitor agrees create a privacy problem as well as a security one.

How CyberRank helps with Magecart and third-party script risk

CyberRank helps by rating the vendors whose scripts run on your pages, and their own suppliers, so the companies with access to your customers' browsers are on the same scale as the rest of your supply chain.

CyberRank rates what an organisation exposes publicly, and AI-powered questionnaires add internal evidence where you need it.

  • Vendor ratings in 10–60 minutes: security, privacy and AI risk for each script supplier, from its web address.
  • Fourth-party vendors: a supplier's own suppliers rated with the same pipeline, with combined risk damped by distance.
  • Privacy lens: public privacy policy and consent practices, the area where third-party scripts most often cause problems.
  • Monitoring: daily re-scans, darknet monitoring and email alerts when a script supplier's findings change.
  • Evidence: an audit-ready PDF report for each supplier, useful for PCI DSS and GDPR vendor files.

Why CyberRank for third-party script risk

CyberRank makes the companies behind your scripts as visible as the companies behind your contracts.

Create a free account to see how your organisation rates.

  • Minutes, not weeks: a full security, privacy and AI rating from one web address in 10–60 minutes, with no questionnaires, agents or system access.
  • Your whole supply chain in one number: fourth parties rated with the same pipeline, combined risk damped by distance, impact tiers mapped to DORA.
  • Twelve risk lenses, one rating: privacy, AI & EU AI Act and quantum risk alongside vulnerabilities, leaked credentials and breach history.
  • Pay for vendors, not seats: 20 credits ($20) per assessment, unlimited users; see pricing.
  • Certified and proven: ISO/IEC 27001 and 42001 certified; 100,000+ assessments.

References

Primary sources for the outside facts on this page (accessed 25 November 2026), and the CyberRank brochure for CyberRank facts.

  1. UK ICO: Penalty notice, British Airways (16 October 2020)
  2. UK ICO: Penalty notice, Ticketmaster UK Limited (November 2020)
  3. CISA Vulnerability Summary bulletin SB24-183 (CVE-2024-38526, polyfill.io)
  4. Optimizely status page: Web Experimentation security incident (November 2026)
  5. NIST National Vulnerability Database: CVE-2026-132224
  6. PCI Security Standards Council: Important updates for merchants validating to SAQ A (30 January 2025)
  7. PCI Security Standards Council: Payment page security and preventing e-skimming
  8. Regulation (EU) 2016/679 (GDPR), Articles 5 and 32, EUR-Lex
  9. CyberRank Product Brochure 2026 (figures as of Oct 2026)

Quick answers

Short, direct answers to questions this article raises.

Frequently asked questions

Magecart is the umbrella name for web-skimming attacks that inject malicious JavaScript into websites to steal card or login details as customers type them. CyberRank helps you rate the third parties whose scripts run on your pages, which is where many of these attacks start.

No, there is no single Magecart group: the name covers many criminal groups using the same web-skimming technique. CyberRank focuses on what you control, the suppliers whose scripts your site trusts, rather than on who the attacker is.

In the British Airways attack, criminals edited a JavaScript file on BA's website in 2018 so card details entered at checkout were sent to an outside domain, and the UK ICO fined BA £20m in 2020. CyberRank helps you check the security of the vendors that supply code to your own site.

Magecart and web skimming describe the same thing: malicious code in a web page that copies payment or login data. CyberRank rates the vendors behind the scripts on your pages, which is how many web-skimming attacks get in.

A Magecart attack is a software supply chain attack whenever it comes through a third-party script, because one compromised supplier then affects every website that loads its code. CyberRank rates fourth parties with the same pipeline, so suppliers of suppliers are visible too.

Yes, PCI DSS requirements 6.4.3 and 11.6.1 have required merchants to inventory, authorise and monitor payment-page scripts since 31 March 2025. CyberRank adds evidence about the vendors those scripts come from; it supports these obligations but does not by itself make an organisation compliant.

Yes, a third-party script breach can make your company liable: the UK ICO fined Ticketmaster £1.25m after malicious code entered through a chatbot on its payment page. CyberRank gives you a dated rating of each script supplier as part of your vendor file.

CyberRank helps with Magecart risk by rating each script supplier and its own suppliers in 10–60 minutes and re-scanning monitored vendors daily. Privacy findings, such as consent practices, sit alongside security findings in one grade.

Create a free account to see how your organisation rates.

CyberRank rates any organisation from its web address in 10–60 minutes: one IISRI® rating across 12 risk lenses, with no questionnaires, agents or system access. Your first assessment is ready within the hour.