Formjacking, also called web skimming, e-skimming or Magecart, is malicious JavaScript added to a checkout or form page that copies what shoppers type, usually card details, and sends it to the attacker’s server. You detect it by knowing every script your payment pages run and every place they send data, and by getting an alert when either changes; Content Security Policy reports, subresource integrity and outside checks of the live page each catch part of it. Monity (monity.ai) does the outside check: its Script & connection watch loads your checkout in a real browser on a schedule and alerts on new script sources, changed scripts and new data destinations.
How a formjacking attack works
- The way in: a third-party script the page already loads (analytics, chat, a reviews widget) is changed at its source, or the attacker adds code through the CMS, a plugin, a tag manager or the site’s own files.
- What runs: code in the shopper’s browser that reads the card fields, or swaps the payment form, and sends the data to a domain that looks harmless.
- Why nobody notices: the order goes through as usual. The shop’s servers look normal, because the theft happens in the customer’s browser.
A well-documented case is British Airways. The UK Information Commissioner’s penalty notice of 16 October 2020 describes customer payment card data being sent to a site called “BAways.com”, with 429,612 people affected on BA’s estimate, and a revised penalty of £20m.
How to detect formjacking
| Method | What it catches | What it misses |
|---|---|---|
| An inventory of payment-page scripts | Unknown or unneeded scripts, at the time you review | Anything that changes between reviews |
| Content Security Policy with reporting | Scripts and connections to sites not on your list, reported by visitors’ own browsers, and blocked if you enforce it | A skimmer served from a site you allow, such as a compromised vendor or your own domain, and inline code if the policy allows it |
| Subresource integrity | A third-party file that changed: the browser refuses to run it | Scripts that change by design and can’t be pinned, inline code, and your own files |
| File integrity monitoring on your server | Changed files on your own server | Third-party scripts and tag-manager additions, which never touch your server |
| Outside checks of the live page (Monity) | New script sources, changed script content, new data destinations, removed integrity hashes, changed security headers, as a shopper’s browser receives the page | Skimmers that load only for some visitors, and anything that comes and goes between checks |
| In-browser protection tools | Script behaviour in every real visitor’s session, often with blocking | Depends on the vendor; it adds a script to every page |
No single method is enough. A common set is an inventory, a Content Security Policy in report mode at least, integrity hashes where scripts are fixed, and an alert when the live page changes.
What PCI DSS asks for
Two PCI DSS v4.0.1 requirements for payment pages took effect on 31 March 2025, per the PCI Security Standards Council:
- 6.4.3: manage every script that runs on the payment page in the shopper’s browser, confirm each one is authorized, assure its integrity, and keep “an inventory of all scripts … with written justification as to why each is necessary.”
- 11.6.1: “a change- and tamper-detection mechanism” that alerts on unauthorized changes to the security-impacting HTTP headers and script contents of “payment pages as received by the consumer browser”, at least weekly or as often as your targeted risk analysis says.
In January 2025 the Council removed 6.4.3 and 11.6.1 from SAQ A and added an eligibility criterion instead: merchants must “confirm their site is not susceptible to attacks from scripts that could affect the merchant’s e-commerce system(s).” It adds that the change does “not remove or diminish the underlying requirements within PCI DSS.” For the compliance side, see PCI DSS 6.4.3 and 11.6.1 script monitoring.
Detect formjacking with Monity
- Scan a page now, free and without an account, with the website script scanner: every script the page runs, injected ones too, with vendor, hash and integrity status, and where it sends data.
- Add a page monitor on the page that takes the card. A payment page usually sits behind a basket, so add steps that run before each check (add a product, open the basket, go to checkout), or sign in with a saved session (saved sessions are on paid plans and the Business trial).
- Turn on Script & connection watch. It’s on every plan, the free one included, and uses no extra credits. Each check lists every script (address, first or third party, vendor, size, SHA-256, integrity) and every place the page sends data (fetch, XHR, beacons, websockets, form posts). Approve the origins you’ve reviewed; they stay listed and never alert.
- Keep the default rules. They alert on a script source the page hasn’t used in 30 days, a script whose content changed and held on two checks, new or suspicious inline code on a payment page, data sent to a new destination, integrity removed, a form or card frame that points somewhere new, and changed security headers.
- Check often. One checkout page checked every hour uses about 720 credits a month, which fits Personal Small ($12 a month, $10 billed yearly). Every 15 minutes uses about 2,900, which fits Business Small ($35 a month or $25 billed yearly, 3 seats). See plans and credits.
- Send alerts to the people who act: a security channel in Slack or Microsoft Teams, email, or a signed webhook into your ticketing.

How Monity fits alongside CSP and SRI
- An outside view, on a schedule. Monity loads your checkout in a real browser on the schedule you set and alerts when its scripts, data destinations or security headers change. An enforced Content Security Policy does the blocking in visitors’ browsers; the two work together.
- One visit’s view, plus your visitors’. Each check records the scripts and destinations seen on that visit. CSP reports from real visitors cover skimmers that load only for some countries, devices or returning visitors.
- A dated record for your assessor. Monity keeps the script inventory, the origins you approved and dated alerts, as evidence for PCI DSS 6.4.3 and 11.6.1 reviews.
More: website security monitoring, which also watches security headers and the SSL certificate.