What is formjacking? The code that skims checkout pages (2026)

Formjacking injects JavaScript into checkout pages to steal card details from every customer. How it works and the CSP, SRI and admin controls that stop it in 2026.

Formjacking is digital skimming: attackers inject a few lines of JavaScript into an e-commerce site's checkout page, and every customer who pays has their card details quietly copied and sent to the attacker's server. The shopper sees nothing — the payment goes through normally — and the business often learns of it from a bank's fraud team weeks later. It is the web equivalent of a card skimmer glued to an ATM, and the victims are the store, not just its customers.

TL;DR

What formjacking means in plain terms

Every online checkout is a web form: card number, expiry, CVV. Formjacking adds a hidden listener to that form. When the customer clicks Pay, the form submits normally to the payment gateway — and a second, invisible copy of the same data goes to the attacker's domain. Nothing breaks, no error appears, and the skimmed data is sold or used within days.

Where the code comes from:

Why formjacking is a business problem, not just a customer problem

The direct cost lands on the store. Payment-card industry rules assign liability for skimmed data to the site whose checkout was compromised: investigation, card-scheme fines, compulsory forensic audits and re-security all follow. Reputationally, the store is the one named in the bank's fraud alerts its customers receive.

The surrounding threat environment sets the stakes: the Australian Signals Directorate logged more than 84,700 cybercrime reports in 2024-25 — one every six minutes — with small business averaging $56,600 per self-reported incident (ASD Annual Cyber Threat Report 2024-2025). For an online retailer, a formjacking incident is squarely in that distribution — and the average incident is long: the code often sits on a checkout page for weeks before anyone notices, skimming every sale in the meantime.

How a formjacking attack runs

  1. The entry. Attackers obtain a way to change what the checkout page loads: stolen admin credentials (usually phished), an unpatched plugin, or a compromised third-party script.
  2. The injection. A few lines of JavaScript are added — often obfuscated and loaded from a domain that mimics a legitimate analytics host.
  3. The skim. Every checkout submission is silently copied to the attacker's collection server. The customer's payment completes normally.
  4. The quiet period. The code runs for weeks or months, skimming continuously, until a bank's fraud analytics, a researcher, or a customer chargeback surfaces it.
  5. The aftermath. Forensic investigation, PCI DSS non-compliance findings, card-scheme penalties, and re-issued customer trust.

How to prevent formjacking

Signs your site may be formjacked

Any one of these justifies an immediate inspection of what scripts your checkout actually loads.

FAQ

What is formjacking in simple terms? Malicious JavaScript hidden in an online store's payment form that quietly copies customers' card details as they pay — the web version of a skimmer on an ATM.

How is formjacking different from phishing? Phishing needs the victim to act on a message; formjacking happens entirely on the store's site without the customer doing anything unusual. One targets people; the other targets code.

Who is liable when formjacking skims customers? The store whose checkout was compromised generally carries the liability under payment-card rules — fines, forensic audits and re-security, regardless of how the code got there.

Can customers tell they've been formjacked? Usually not in the moment: the payment completes normally. The fraud surfaces weeks later as unauthorised charges — which is why banks' fraud analytics, not users, detect most cases.

Does HTTPS protect against formjacking? No. The skimmer runs inside the encrypted page itself, so the padlock says nothing about whether the code on the page is legitimate.

What's the fastest way to check a checkout page? Open the page, list every script domain it loads, and challenge each one: do you know what this script does and who owns it? Anything unrecognised is either removed or allow-listed through a CSP that day.

One last thing

One hour this week closes the most common formjacking door: list every third-party script on your checkout page, remove the ones you can't justify, and put MFA on every admin account that can edit it. Most skimmers ride in through exactly those two gaps — an unjustified script or a phished admin login.

Related guides

Ready to deploy

Same playbook.
Your brand.

Cyber Aware's Human Risk Score works the same way for every MSP partner - under your brand, on your cadence.